Here's the problem. The instruction pointer DRAM is configured as four rows of 12 bits, each row representing one of the four instruction pointers. The normal cycle is:
- Pre-charge the DRAM column sense lines.
- Read all 12 bits of the active IP into a 12-bit register.
- Gate the low-order 4 bits onto the data bus.
- Add 1 to the low 4 bits, saving the carry out.
- Update the low 4 bits of the register.
- Gate the middle 4 bits onto the data bus.
- Add the carry to the middle 4 bits, saving the carry out.
- Update the middle 4 bits of the register.
- Gate the high 4 bits onto the data bus.
- Add the carry to the high 4 bits.
- Update the high 4 bits of the register.
- Write the 12-bit register back to the active IP.



The problem appears to be in the way I've coded the 12-bit temporary register. This register (really charges on MOSFET inverter gates in a real i4004 CPU) is written from three non-overlapping sources. Because of the way the circuitry is implemented, any of these three can set the register content without conflict.
In an FPGA, this is implemented using a mux to select an input source and a storage element to retain the value. Since I coded the input selection logic as implemented in the real i4004 CPU, the mux selectors and the latch gate are driven by the same signals. In this case, though, the mux output is changing 25 picoseconds before the latch gate has gone inactive, and the latch captures the wrong value. This is why most modern logic uses clocked flip-flops rather than latches.
The challenge I face is to separate the mux selectors from the latch gates such that the mux outputs are stable before and after the latch is enabled. This is turning out to be non-trivial.
No comments:
Post a Comment