Skip to content
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

Ensure Sequential output components come first in the sorted list #68

Merged
merged 3 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions riscv/examples/riscv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ fn main() {
let memory = if !args.use_elf {
elf_from_asm(&args);
let bytes = fs::read("./output").expect("The elf file could not be found");
let elf = ElfFile::new(&bytes).unwrap();
riscv_elf_parse::Memory::new_from_elf(elf)
riscv_elf_parse::Memory::new_from_file(&bytes, true)
} else {
let bytes =
fs::read(format!("{}", args.elf_path)).expect("The elf file could not be found");
let elf = ElfFile::new(&bytes).unwrap();
riscv_elf_parse::Memory::new_from_elf(elf)
riscv_elf_parse::Memory::new_from_file(&bytes, true)
};

println!("{}", memory);
Expand Down
1 change: 0 additions & 1 deletion src/gui_egui/components/wire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ impl EguiComponent for Wire {
_clip_rect: egui::Rect,
) {
let oh: fn((f32, f32), f32, egui::Vec2) -> egui::Pos2 = offset_helper;
let offset = offset;
let s = scale;
let o = offset;
let mut line_vec = vec![];
Expand Down
14 changes: 13 additions & 1 deletion src/simulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,22 @@ impl Simulator {
trace!("--- topologically ordered graph \n{:?}", top);

let mut ordered_components = vec![];
//two passes ensure the sorted list of nodes always starts with ALL of the roots
//first push the sequential components, eg. graph roots
for node in &top {
#[allow(suspicious_double_ref_op)]
let c = (**node_comp.get(node).unwrap()).clone();
ordered_components.push(c);
if c.get_id_ports().1.out_type == OutputType::Sequential {
ordered_components.push(c);
}
}
//now push all of the other components
for node in &top {
#[allow(suspicious_double_ref_op)]
let c = (**node_comp.get(node).unwrap()).clone();
if c.get_id_ports().1.out_type == OutputType::Combinatorial {
ordered_components.push(c);
}
}

let component_ids: Vec<Id> = ordered_components
Expand Down
Loading