I looked quickly at the source, and I think the problem spots are here (in macros.js):
Code: Select all
// simulate a single clock phase with no update to graphics or trace
function halfStep(){
var clk = isNodeHigh(nodenames['clk0']);
eval(clockTriggers[cycle]);
if (clk) {setLow('clk0'); handleBusRead(); }
else {setHigh('clk0'); handleBusWrite();}
}
Code: Select all
// simulate a single clock phase, updating trace and highlighting layout
function step(){
var s=stateString();
var m=getMem();
trace[cycle]= {chip: s, mem: m};
if(goldenChecksum != undefined)
traceChecksum=adler32(traceChecksum+s+m.slice(0,511).toString(16));
halfStep();
if(animateChipLayout)
refresh();
cycle++;
chipStatus();
}
In halfStep() the irq signal changes (as part of the clockTriggers for that cycle), and then the clock is flipped. In step(), the log (and maybe the visual display too) is updated in chipStatus(). Together this means that the change in the input signal will be logged as part of the
next cycle after it changes.
Rearranging things so that you first do the clockTriggers, then log, and finally flip the clock would be a fix I think, if that wouldn't be too messy.