From 9b21faabd52b98d1cc8758ae385f4fd1aae900a8 Mon Sep 17 00:00:00 2001 From: onsdagens Date: Fri, 13 Oct 2023 16:45:31 +0200 Subject: [PATCH 1/3] ensure sequential components are always first in the sorted list --- src/simulator.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/simulator.rs b/src/simulator.rs index b33d7b76..9eba2afe 100644 --- a/src/simulator.rs +++ b/src/simulator.rs @@ -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 = ordered_components From 8eccefe276b3a949f6f7e10a35ca5ec1e7feb9d4 Mon Sep 17 00:00:00 2001 From: onsdagens Date: Fri, 13 Oct 2023 16:48:05 +0200 Subject: [PATCH 2/3] adjust riscv_elf_parse call to bumped API --- riscv/examples/riscv.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/riscv/examples/riscv.rs b/riscv/examples/riscv.rs index d3c1effe..e854d4ba 100644 --- a/riscv/examples/riscv.rs +++ b/riscv/examples/riscv.rs @@ -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); From 30a8772027c869184a4325106acaeff0c915a2ab Mon Sep 17 00:00:00 2001 From: onsdagens Date: Fri, 13 Oct 2023 17:06:10 +0200 Subject: [PATCH 3/3] fix unrelated clippy warning --- src/gui_egui/components/wire.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui_egui/components/wire.rs b/src/gui_egui/components/wire.rs index 66da17a0..7da2c7b7 100644 --- a/src/gui_egui/components/wire.rs +++ b/src/gui_egui/components/wire.rs @@ -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![];