-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Minimal example:
#[test]
fn test() {
let mut sim = Simulation::new();
// TEST_A
sim.add_testbench(move |mut endpoint: Sim<NandGate>| {
let mut x = endpoint.init()?;
x.input_1.next = true.into();
x.input_2.next = true.into();
let mut x = endpoint.wait(10 * sim_time::ONE_MICROSECOND, x).unwrap();
sim_assert_eq!(endpoint, x.output_signal.val(), false, x);
endpoint.done(x)
});
// TEST_B
sim.add_testbench(move |mut endpoint: Sim<NandGate>| {
let mut x = endpoint.init()?;
x.input_1.next = false.into();
x.input_2.next = true.into();
let mut x = endpoint.wait(10 * sim_time::ONE_MICROSECOND, x).unwrap();
endpoint.done(x)
});
sim.run_to_file(
Box::new(NandGate::default()),
5 * sim_time::ONE_SEC,
"nandgate.vcd",
)
.unwrap();
}(note the absence of clocks; I don't know if it's a factor)
When the tests are added in the order above, the simulation hangs instead of succeeding. If they're added in the opposite order, (TEST_B then TEST_A), the simulation succeeds.
If TEST_A is changed to fail, there are two scenarios:
- If TEST_A is added before TEST_B, the simulation succeeds.
- If TEST_B is added before TEST_A, the simulation fails.
Basically the simulation only "remembers" the last test.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels