As discussed in the earlier post (Let Me Look That Up For You!), my initial implementation for conditional jumps was not a robust solution creating a lot more complexity than it solved, so I made the decision to remove the Carry-Flag(CF) and Zero-Flag(ZF) from the microcode lookup-table. The original pseudo code would have looked like this:
if [LDA==1] ; then if [CF==0 & ZF==0] ; then copy data to registerA else if [CF==0 & ZF==1] ; then copy data to registerA else if [CF==1 & ZF==0] ; then copy data to registerA else if [CF==1 & ZF==1] ; then copy data to registerA endif endif
But after removing the CF and ZF from the microcode, the result is reduced to this:
if [LDA==1] ; then copy data to registerA endif
Since the CF and ZF were no longer being handled in the microcode, I needed a different solution for handling conditional jumps. What I implemented in hardware is a bit mask. Since my Instruction Set Architecture (ISA) is 8-bit ( for more details see All Your ISA Belong To Me!), adding a bit mask to the immediate data portion of the command was easy to do. The new jump command (JMP) includes a 2-bit mask that determines how the jump command is handled (i.e. JMP 0x03). The bit mask is implemented with two OR gates and two AND gates. When the bit mask value is 0x03 (11b), the jump is unconditional allowing the active low JUMP signal to trigger a load of the program counter (PC). When the bit mask value is 0x01 (01b) the jump signal is only passed on to load the program counter IF the active low Carry-Flag is set. Similarly, the "jump if zero" only happens when the bit-mask is 0x02(10b). This solution reduces the complexity of the microcode, and actually provides a more robust programming instruction set that can be expanded. The interesting part of this is that I've used bit masks in software for decades but this is the first time, I've implemented one in hardware at this low level. It really adds a new level of understanding of how concepts in the software world are translated into physical hardware solutions.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.