Beta ALU


We have implemented an ALU that accepts three inputs: Input_A, Input_B and ALU function. It produces output at three pins as shown below:

ALU is implemented as a combinational logic. In order to use it, all you need to do is set opcode line to appropriate opcode value and provide inputs through the lines labelled A and B. ALU will produce three copies of output as shown above. A, B, ALU function and ALU output are all 32-bit bus lines.

Although we are using 32-bit bus for ALU function input, only eight least significant bits  are used to select from among different ALU functions.

Before you start using ALU, you need to know the structure of ALU function input to the ALU. Here is a table that lists different bits of the input and their respective function.
 
 
Pin/Bus Name Bit Position Description
ADD 5 True(1)= Add
False(0)= Subtract (use subtract for CMP instructions)
LEFT 0 True(1)= Barrel shift left
False(0)= Barrel shift right
ASHIFT 1 True(1)= Arithmetic shift (use only on right-shift)
False(0)= Logical shift (shift in zeros)
EQ 7 True(1)= Output a 1 if FUNC is Compare and A==B
False(0)= Don't do anything on equal
LT 6 True(1)= Output a 1 if FUNC is Compare and A<B
False(0)= Don't do anything on A<B
FUNC[2:0] 4,3,2 Specify which output:
000 ADD/SUB
001 AND
010 OR
011 XOR
100 SHIFT
101 PASS_A
110 COMPARE
111 none (this will disconnect the ALU from the output if you use buffers) 

Following is a summary of the functions implemented:
 
FUNCTION INSTRUCTION MNEMONIC
addition
LD, ST, LDR, ADD
subtraction SUB
comparisons CMPEQ, CMPLT, CMPLE
logical and AND
logical or OR
logical xor XOR
barrel shifting SHL, SHR, SRA
pass a value LDR, BEQ, BNE

As you might have realized by now, ALU function input to the ALU is quite different from the first six bits of Beta instruction called OPCODE part of the Instruction. The translation of OPCODE to ALU function is handled by Control ROM which you will eventually wire up to the Beta ALU.