All projects

Four-bit add/subtract unit in VLSI

Simulated 2026

I never fabricated it. The layout matches the schematic (LVS) and simulates correctly, but DRC still flags same-net notches where the power straps overlap.

A 4-bit adder/subtractor with tri-state outputs, laid out as one row of transistors in Electric VLSI and checked against all 512 input combinations in LTspice, on both the schematic and the extracted layout.

Close-up of the full adder layout with orange PMOS diffusion on top, green NMOS diffusion below, red polysilicon gates and blue and purple metal routing

What it does

Two 4-bit inputs, A and B, and one control bit, Sub:

The four result bits go out through tri-state buffers, so with En low the outputs let go and another block can drive the same bus. Cout comes out too. When subtracting, Cout = 1 means B is at least A.

Built from my own cells

Everything is made from a small standard cell set I drew earlier: NOT, NAND, XOR and a full adder built from two XORs and three NANDs. The one new cell is the tri-state buffer. Every transistor is the same size, 6 by 2 lambda on the MOSIS 0.6 um process (lambda = 0.3 um).

Each bit is the same three blocks in a row:

Bit 0 of the schematic. The other three slices are identical, with the carry chaining left to right

The tri-state buffer

Two inverters make D_bar and En_bar, and those drive a four-transistor stack: two PMOS in series from vdd and two NMOS in series to ground. With En high both outer transistors are on and the stack is just an inverter of D_bar, so the output equals D. With En low both outer transistors are off and the output floats.

Tri-state schematic
Tri-state layout, rails at the same height as the other cells

One row

The whole unit is a single row, 1202 by 72 um. Every cell sits on the same vdd and ground rails, so the rails run straight through from end to end. The routing follows one rule: metal 1 runs horizontally and metal 2 runs vertically, so anything that crosses a rail does it in metal 2 and can’t short to power.

The inputs come in along the bottom edge, the outputs leave from the top, and the carry runs along the top of the row into the next slice. Sub and En are two long buses under the row.

All four bits, 4007 by 240 lambda
One slice. The XOR output crosses to the full adder in the gap, and the carry runs along the top to the next slice

Checking it

Electric’s LVS (NCC) says the layout matches the schematic for every cell, all the way up to the full unit.

For simulation I counted through every combination of A, B and Sub, 512 vectors at 20 ns each, and sampled the outputs just before each step. All 512 are right.

All 512 combinations

Then I ran the same tests on the netlist Electric pulls back out of the layout. That netlist includes the source and drain area of every transistor, which adds capacitance the schematic leaves out. It still gets 512 out of 512, and the demo vectors come out identical, but it is about twice as slow.

Schematic (solid) against extracted layout (dashed). Same answers, a little later
Schematic Extracted layout
All 512 combinations correct correct
Slowest settle 1.6 ns 3.0 ns
Median settle 0.75 ns 1.6 ns

The slowest case is a carry rippling through all four bits, like going from 0111 to 1000.

The worst case: the carry ripples through every bit before the top output settles

What I’d change

The cells are taller than they need to be. The space between the PMOS and NMOS rows holds about eight rows of gate wiring, and redrawing the cells with tighter wiring would cut maybe 10 to 15 percent off the height. A carry-lookahead adder would fix the ripple delay, but for four bits the ripple is already only a few nanoseconds.