-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Mips related compoennts, change wire ui, new UI helpers, new misc compoents #87
Added Mips related compoennts, change wire ui, new UI helpers, new misc compoents #87
Conversation
…n making the wire
…yncrim into mips_components
…nto mips_components
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of comments
src/components/clk.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed 1fadfac
src/autowire.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The warnings here can be allowed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 3c77dbf
mips-lib/src/main.rs
Outdated
#[command(author, version, about, long_about = None)] | ||
struct Args { | ||
/// Path to the model to load on startup | ||
#[arg(short, long, default_value = "empty.json")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe change this to the single cycle mips?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in d19ff00
fn to_(&self) { | ||
trace!("jump_merge"); | ||
} | ||
// #[cfg(feature = "gui-egui")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead code can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a bunch of random commented code scattered about, we can probably get rid of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 29d9553
src/gui_egui/editor.rs
Outdated
}), | ||
Rc::new(Register { | ||
id: "reg".to_string(), | ||
pos: (0.0, 0.0), | ||
r_in: dummy_input.clone(), | ||
}), | ||
Rc::new(MIPSCLK { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 1fadfac
let render_return = (*Rc::get_mut(c).unwrap()).render_editor( | ||
let debug_id = c.get_id_ports().0; | ||
let render_return = (*Rc::get_mut(c) | ||
.expect(&format!("More than one reference exist to {}, can't get mut, therefore not render editor", debug_id))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just #[allow] this lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 3c77dbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Syncrim
simulator common etc
syncrim::common::Input
now derives partial eq and eq.get_input_location
which is used to get a location of a port based upon its relevant input struct.component_store
now saves JSON with pretty formatting.Component changes
Most constants for out id has been changed from
"out"
to"{component_type}_out"
.Most components now implement
get_input_location
.Add
Now supports a scale variable allowing the scale of the rendered component to be modified.
Mem
Documented some code.
Mux
Now supports a scale variable allowing the scale of the rendered component to be modified.
Wire
Wire color was added, this changed how active is implemented, if component now read from is inactive wire is dashed
Changed om hover is handed, using distance from line.
In editor, added duplicate point button and color editor
Probe edit
if unable to format as signal signed try formatting as signal unsigned
new components
And
bitwise logical and.
clk
adds input with a 4.
equals
sends a 1 if the inputs are equal 0 else (if a == b => 1).
shift_left_const
shifts left by a constant value.
zero_extend
zero extends.
Mips-Lib
components required to implement a single cycle and pile lined mips
New components and related
PhysMem
This component has no input nor outputs, this is because this is basically a wrapper for a MipsMem struct which takes care of reset and unclock. This was necessary since there are multiple components that need to access the memory (IM, DM).
access to mips_mem is done in this not so nice way
This should probably be updated to not panic and instead return condition::error
MipsMem
A struct which contains the memory as well as the symbols and sections of that memory it has methods to read and write to addresses with sizes of byte half and word, endianes can be specified. There exist version which would return error when a write is unaligned. Each write also returns a MemWriteReturn which is used with the revert method to undo an operation, note the order of which reverts are called matters, revert the newest operation first.
MipsMem also has the ability be created from an elf, note this method panics when an the passed byte slice is not en elf
IM
The instruction memory components reads the given address from its associated physical memory, this component will panic if its physical memory is not found.
When IM encounters a break point from its MemViewWindow a halt condition is returned stopping the simulation.
There is also a button that loads an elf to memory by passing the bytes to physmem.
DM
When the control signal is one of the read ones (read-byte, -half, -word), the data at the address is returned. If the address is unaligned the component will return an condition::error, this is also true for the write operations. When a read or write happens at an address that is a breakpoint (determined according to MemViewWindow) a condition::halt is returned.
MemViewWindow
This is used to display a window showing the content of the passed mips_mem.
features
RegFile
This component have 32 internal registers that can be written to and can output 2 two of those registers. This component displays the internal registers when rendered. Format and reg names can be chosen.
ALU
This an simple ALU which support basic orations such as add, add, sub and bit-wise operations (including shifting but not roll), other supported operations are slt sltu and lui. The operations are supplied trough the op input.
Branch Logic
This component compares both rs and rt in in accordance to what operation is done (jr, beq and ect) and outputs a signal to control mux which determines next pc.
Jump merger
Combines the instruction with current pc to calculate the jump address of an jump instruction.
Instructions splitter
Takes an 32 bit instruction and splits it into rs, rt, rd, shamt, funct, immediate, and target.
SignZeroExtend
compoents sign or zero extend the input signal according to its control input
ControlUnit
Sends control signal to muxes, alu and other mips components according to the given instruction
Models
This includes PR includes a functioning single cycle mips and a work in progresses pipeline version
Single cycle MIPS
Pipe-lined MIPS
Work In Progress