Lab 6: Execute Unit Components

We are in the home stretch! Only a few more parts to go and we will have enough to put together our machine and let it run.

All we are going to do for this lab is add an ALU unit. This component will implement the operations we set up the decoder to process in our last lab:

  • ADD
  • SUB
  • AND
  • OR
  • NOT (COM)
  • EOR

These operations all work on 8-bit data. For the time being, we will not worry about the possibility of generating a 9-bit result when we add things, we will just let that extra bit slide away. We will implement the zero status flag, though, since it will be needed to set up branching later.

ALU Unit

After that decoder project, this one will be easy.

The ALU has the following signals:

  • Inputs

    • Op1 = 8_bit input
    • Op2 - 8-bit input
    • ALUop - 3-bit instruction code

These signals will come from the ALU:

  • Outputs

    • res - the result of the operation
    • zero - a boolean indicating a zero result

Testing the ALU

You should add test code to verify that all operations work. (This may be the biggest part of this project, but copy-and-paste will help get this test code set up easily!) This unit is a mess to build, so take it slowly. Work with your team, and add one instruction at a time. You should test things as you go.

As usual, place this new code (header file, implementation, and test code) in the Lab2 project repository.