
A purely combinational 2-bit magnitude comparator. Two numbers, A = A1A0 and B = B1B0 (0–3 each), are compared and the result is shown on the 7-segment display:
Logic (minimized with Karnaugh maps):
The comparison works like comparing numbers by hand: the most significant bit decides first; only if it ties does the least significant bit decide.
Set A on ui[3:2] and B on ui[1:0] with the DIP switches and check the display. All 16 combinations should give 6× "A", 6× "b" and 4× "=" (with the dot).
| A1 A0 B1 B0 | Display |
|---|---|
| 0000, 0101, 1010, 1111 | = (dot on) |
| 0001, 0010, 0011, 0110, 0111, 1011 | b |
| 0100, 1000, 1001, 1100, 1101, 1110 | A |
7-segment display on the Tiny Tapeout demo board (uo[0..7]).
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | B0 | SEG_A | |
| 1 | B1 | SEG_B | |
| 2 | A0 | SEG_C | |
| 3 | A1 | SEG_D | |
| 4 | SEG_E | ||
| 5 | SEG_F | ||
| 6 | SEG_G | ||
| 7 | SEG_DP (A = B) |