Search code examples
mipscpu-architecturetruthtable

ALU control logic equation on MIPS processor


I'm reading on MIPS processors, I try to understand wow they get the logic equation (scheme or second picture) from this truth table

for example for ALU0, I understant the x meaning and understand how they get this small table :

ALUOp | Funct        ||  ALU 
1 0   | 5 4 3 2 1 0  ||  2 1 0
------+--------------++------------
1 x   | x x 0 1 0 1  ||  0 0 1
1 x   | x x 1 0 1 0  ||  1 1 1

but now, the question is : how did they get this logic equation ALU i ??? :

ALU 0 = ALUOp1 (F0 + F3) 

ALU 1= UALOp1\ + F2\

ALU 2 = ALUOp0 + ALUOp1.F1

truth table enter image description here

scheme enter image description here


Solution

  • You can do the logic by your eyes:

    1. For ALU_0: you see the last 2 rows only are ones, ALUOp is required to be 1, Fun(5) and Fun(4) are constant as 10 in the 2 rows, so they are dont care. The others Fun(3) to Fun(0) are 0101 and 1010, thus Fun(3) OR Fun(0) is sufficient.
    2. For ALU_2: they are ones in the third, fifth and the eighth row, For the third ALuop(0) is sufficient, for the other two you will find that {ALUop(1)} AND {Fun(1)} should be ones. thus the final equation is true.