Close

ALU

A project log for Tetra - 4-bit CPU

Experiment to create a minimal 4-bit CPU that can do something fun

kaimackaimac 08/28/2022 at 15:470 Comments

Here is what I am thinking of for the "ALU":

That allows for these instructions: 

000m vvvv  lda    acc = value
001m vvvv  add    acc = acc + value
010m vvvv  nan    acc = ~(acc & value)
011x xxxx  in     acc = in

m: 0=immediate value, 1=value from given RAM address
v: 4-bit value
x: don't care

  
I really like how this turned out, because the decoding for these instructions requires no additional chips!

opcode bits:
   3210 vvvv
   ||||
   |||\- operand/memory mux select
   ||\-- accumulator source mux select
   |\---             -"-
   \---- accumulator write enable (active low)

Two opcodes are taken up by "in" but it's worth that small cost.

Discussions