Close

Small wiring change to the control board

A project log for Pilot-1 CPU (ECM-16/TTL partial build)

This is a proof-of-concept sub-project spun off from my main homebrew CPU project.

pavelPavel 01/06/2022 at 16:320 Comments

I found out that the choice to use positive conditions for conditional jumps forces me to use additional instructions for creating a loop. As the simplest example, here is a program which shifts a single bit to the left and stops when it falls off:

0     ADD r0 0x01    ; initialising register r0 with value of 1
1     ROLC r0 r0     ; rotating word in register r0 through carry 1 bit left
2     JC [4]         ; jump to address 4 if carry is set
3     J [1]          ; jump to address 1 to continue rotation
4     HLT            ; stop execution

 As seen on snippet above, there are two jump instructions in row, and the conditional jump is executed each time, but until the end is just skipped, as condition is false.

Given that here I can only use 16 words for instruction, this is just dead weight that bloats the code. It would be wiser to use negative condition, Jump If Not Carry, thus needing only 1 jump instruction: 

0     ADD r0 0x01    ; initialising register r0 with value of 1
1     ROLC r0 r0     ; rotating word in register r0 through carry 1 bit left
2     JNC [1]        ; if carry is not set, jump to address 1 to continue rotation
3     HLT            ; else, stop execution

To change the positive to negative condition, a simple rewiring is sufficient: as the flag value is stored in 74hc74 d-flip-flop, I just need to use its inverted outputs instead of direct ones, and switch places for couple of outputs:


As for the whole Pilot-1 contraption, it has at least 1 bug (most probably intermittent short in Fast Adder) which I still haven't fixed yet. This bug shows as stuck bit 9, and is prominent at faster clock speeds, so it is fairly difficult to pinpoint the root cause.

Discussions