OpenCores
Issue List
POP instruction doesn't update SP properly #5
Closed mcleod_ideafix opened this issue almost 6 years ago
mcleod_ideafix commented almost 6 years ago

Simulation of instructions POP HL and POP BC shows that SP is incremented only once. The issue seems to be caused by this code, located at line #643 of NextZ80CPU.v

REG_WSEL = {1'b0, FETCH5:4, 1'bx};

In other instructions, bit 0 of REG_WSEL is used to select hi or low order byte of the destination register depending on the stage cycle of the instruction. Changing that line with this:

REG_WSEL = {1'b0, FETCH5:4, ~STAGE0};

fixed the issue for me.

ndumitrache commented almost 6 years ago

You may replace the 'x' with '0' or '1',or use the "Post-Translate" simulation.

ndumitrache closed this almost 6 years ago
mcleod_ideafix commented almost 6 years ago

The bug manifested after I changed all "x" by "0" in the code.


Assignee
No one
Labels
Bug