Commit 92679d32 authored by phlo's avatar phlo

fixed replaying of traces ending in an EXIT call

parent 92cc4915
......@@ -457,13 +457,13 @@ void Simulator::flush ()
void Simulator::execute ()
{
// skip state updates during final step
if (step > bound)
return;
const Program & program = (*programs)[thread];
const Instruction & op = program[pc()];
// skip all state updates except EXIT calls during the final step
if (step > bound && &op.symbol() != &Instruction::Exit::symbol)
return;
op.execute(*this);
// set state to halted if it was the last command in the program
......
......@@ -151,7 +151,7 @@ TEST_F(Main, simulate_uninitialized)
ASSERT_EQ(mmap.at(1), trace.accu(1));
}
TEST_F(Main, simulate_exit_greater_zero)
TEST_F(Main, simulate_demo)
{
const std::filesystem::path demo = "examples/demo/";
......@@ -174,7 +174,8 @@ TEST_F(Main, simulate_exit_greater_zero)
const auto trace = create_from_file<Trace>(sim_trace);
const auto mmap = create_from_file<MMap>(sim_mmap);
ASSERT_EQ(15, trace.size());
ASSERT_FALSE(trace.empty());
ASSERT_EQ(1, trace.exit);
ASSERT_EQ(0, trace.accu(0));
ASSERT_EQ(0, trace.accu(1));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment