P6: 16-bit comparator

Published

February 27, 2026

Due
March 04, 2026 at 11:59 PM

Goals

  • Demonstrate your knowledge of basic circuit design
  • Put your knowledge about binary numbers to use

Objective

This circuit will implement a 16-bit comparator. It will take in two 16-bit inputs representing unsigned binary integers and indicate if the first number is greater than, equal to or less than the second number.

Requirements

  • your work must be in a file called sixteen_bit_comp.circ
  • your implementation must be in the main circuit (you are welcome to create sub-circuits however)
  • your circuit must have two inputs: A and B
  • A and B are both 16-bit unsigned integer values
  • the circuit should have a 1-bit output called gt that will be 1 only when A is greater than B and 0 otherwise
  • the circuit should have a 1-bit output called eq that will be 1 only when A is equal to B and 0 otherwise
  • the circuit should have a 1-bit output called lt that will be 1 only when A is less than B and 0 otherwise
  • you are restricted to
    • input pins
    • output pins
    • splitters
    • components in the Gates library (i.e., basic logic gates)
  • you must include a text vector in a file called comparator-test.txt that provides sufficient tests to test the functionality of your circuit

Implementation

With 32 bits of input, it would be impractical to try to design a 16-bit comparator with a truth table. So start small. What if this a 1-bit comparator? Then recall the theme of the class: abstraction.

You may add as many subcircuits as you deem appropriate.

Submission

Upload your .circ file and test vector to Gradescope.