ed255 / riscu-jolt

RISCU emulator and zk circuit simulator as a reference for a Jolt implementation
23 stars 1 forks source link

Refactor simulator to verify instead of evaluate #20

Closed ed255 closed 1 year ago

ed255 commented 1 year ago

Currently the simulator is implemented by updating the state of the RISC-V machine. It would be a better match with the final circuit if instead it verifies the state change. So each simulator instruction would receive the arguments (instruction arguments, state, state_next) And verify that state_next is correct considering state, instruction and the instruction arguments.

For example, instead of doing:

self.pc = self.pc + 4;

it would be:

assert_eq(state_next.pc, state.pc + 4);