Lab 3b: Pixel Array

From Microlab Classes
Jump to navigation Jump to search

Background

You have been taught what encoders and multiplexers are. How do we use them?

A significant amount of real-world logic is easier to think of in terms of decoders and multiplexers. For example, a if/else statement is simply a multiplexer. A binary-to-7-segment decoder can be implemented as a simple idea with a decoder and 7 OR gates.

Instructions

Your assignment is as follows:

  1. Download the ALU template in UVLe.
  2. Implement an 8-bit ALU that can perform ADD, SUBTRACT, Bitwise AND, and Bitwise OR, depending on the input ALU_OP. Make sure it follows the table below. Additional constraint: DO NOT USE A SUBTRACTOR ARITHMETIC BLOCK TO IMPLEMENT SUBTRACTION.
  3. Implement the 4 flags Z, N, C, O.
Operation ALU_OP Expression
ADD 00 RA + RB
SUB 01 RA - RB
Bitwise AND 10 RA & RB
Bitwise OR 11 RB

Notes:

  • Again, do not move any input or output pins in the template.
  • A bitwise OR example: 0011 | 1000 = 1011
  • A bitwise AND example: 0111 & 0101 = 0101