Lab 11 of 15 · rank 10

2-bit comparator

Inputs A0 A1 B0 B1 (A0/B0 the lowest bit). Outputs EQ (1 when A = B) and GT (1 when A > B).

← All labsNext lab →
  1. 1
    Build itPorts named A0, A1, B0, B1 and EQ, GT
  2. 2
    Pass the truth table16 rows checked
  3. 3
    Etch it (optional)a verified die in your project
⊼
Cellsclick one, then click the canvas

Build your die

Turn logic into a permanent, verifiable part.

NAND used0 / par 23
LATCH used0 / par 0
Ainput · pin0Youtput · pin
Pick a cell on the left, click to place it · drag from an output pin to an input pin to wire · click a wire to remove it · click a cell to rename it
→ Y=0

What it should do

A0 A1 B0 B1EQ GT
0 0 0 01 0
0 0 0 10 0
0 0 1 00 0
0 0 1 10 0
0 1 0 00 1
0 1 0 11 0
0 1 1 00 1
0 1 1 10 0
1 0 0 00 1
1 0 0 10 0
1 0 1 01 0
1 0 1 10 0
1 1 0 00 1
1 1 0 10 1
1 1 1 00 1
1 1 1 11 0

Stuck?

EQ: both bit pairs equal (two XNORs into an AND). GT: A1 > B1, or the top bits are equal and A0 > B0.

Par is 23 NAND. Using more still passes here. To etch it as a verified die that mines, keep it within 46 NAND-equivalent (a LATCH counts 2): the verifier refuses bigger designs, so padding can't buy mining weight.

Etch it as a die (optional)

Turn this circuit into a verified die you own. It burns 0 NAND. Get materials at the Foundry.

connect a wallet to pick a project