Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksToolsOpen the lab →

AOI gate: an AND-OR-INVERT gate in 6 transistors

An AOI (AND-OR-INVERT) gate computes NOT (A B + C) in a single CMOS stage. This AOI21 uses only 6 transistors: the NMOS pull-down network is A and B in series, in parallel with C, and the PMOS pull-up network is its dual, A and B in parallel, in series with C.

Static CMOS gates are naturally inverting, so any function written as NOT of a sum of products fits in one gate: each AND becomes transistors in series in the pull-down network, each OR becomes transistors in parallel, and the pull-up network is the same picture with series and parallel swapped. Built from separate gates, NOT (A B + C) would be an AND (a NAND plus an inverter, 6 transistors) followed by a NOR (4 more), 10 transistors in two stages; the AOI does it in 6 and one stage, which is why standard-cell libraries offer AOI and OAI cells. The name counts the inputs of each AND: AOI21 has one 2-input AND and one single input, while AOI22 is NOT (A B + C D) in 8 transistors. The mirror image is the OAI (OR-AND-INVERT) gate, NOT ((A + B) C), whose pull-down is A parallel B, in series with C. On every input row exactly one of the two networks conducts, so Y is always driven; all 8 rows are checked on the transistor circuit before the page is built. Compare the simpler CMOS NAND and CMOS NOR.

Live circuit: click the inputs to toggle them and watch the outputs update. It runs the real simulator, right here on the page.

Open this circuit in the lab →

What you need

Step by step

  1. Place a VDD rail, a GND rail, inputs A, B and C, and a probe Y.
  2. Build the pull-down network from the expression inside the NOT, A B + C: NMOS A and NMOS B in series from Y to GND for the AND, and NMOS C from Y to GND in parallel with them for the OR.
  3. Build the pull-up network as its dual: PMOS A and PMOS B in parallel from VDD to a middle node, then PMOS C in series from that node to Y.
  4. Drive each transistor's gate from its input, then step through all eight rows: Y is 0 whenever A and B are both 1 or C is 1.

AOI21 truth table

ABCA B + CY
00001
00110
01001
01110
10001
10110
11010
11110

Y is 1 on three rows only: C = 0 and at least one of A and B is 0. Those are exactly the rows where the pull-up path is closed (C's PMOS on, plus A's or B's) and the pull-down is open.

You can also read the full theory in the lesson on designing CMOS gates from truth tables. Prefer to build it yourself from scratch? Open the digiwleea lab and place the gates on the canvas, or start from the logic gate simulator.

Build more parts from gates

half adderfull adderhalf subtractorfull subtractor2:1 multiplexer4:1 multiplexerXOR gate from NAND gates2-to-4 decoderSR latchD flip-flopJK flip-flopT flip-flop4-bit shift register4-bit ripple carry adderD latch1-to-4 demultiplexer4-bit magnitude comparator4-bit ring counter4-bit Johnson counter4-to-2 priority encoder4-bit synchronous counter3-to-8 decoder8-to-1 multiplexer4-bit carry lookahead adderhalf adder from NAND gates2-bit comparatorBCD to 7-segment decoder4-bit up/down counterdecade counter2-bit multiplier4-bit ALU4-bit array multiplierNOT, AND, OR and NOR from NANDNOT, OR, AND and XOR from NORfull adder from NAND gatesSR latch from NAND gatesparity generator and checker4-bit adder/subtractorBCD adder4-bit universal shift registermod-6 counter4-bit ripple counterbinary to Gray code converterhalf adder from NOR gatesfull adder from NOR gates4-bit register with parallel load1011 sequence detectorbinary to BCD converterD flip-flop from NAND gates1-bit ALUCMOS inverterCMOS NAND gateCMOS NOR gatePISO shift registerSR flip-flop from NAND gatesBCD to excess-3 code converterHamming (7,4) code encoder and correctortraffic light controller4-bit barrel shifterCMOS AND gateCMOS OR gateCMOS XOR gate1-bit magnitude comparatorhalf subtractor from NAND gatesfull subtractor from NAND gates8-to-3 encoderGray to binary converter4-to-16 decoderfull adder using 4:1 multiplexersedge detectorserial adder4-bit carry-select adder4-bit Kogge-Stone adder4-bit carry-skip adder4x4 Wallace tree multiplier8-bit adderfrequency divider (by 2, 4 and 3)switch debouncer (SR latch)3-bit Gray code counterMealy machine (1011 detector)master-slave JK flip-flop (NAND)half subtractor from NOR gates1-to-8 demultiplexerexcess-3 to BCD code convertervending machine FSM4-bit carry-save adder3-bit synchronous counter (JK)CMOS transmission gatetri-state buffer (CMOS)2-to-1 mux from transmission gatesmod-5 counterflip-flop conversion (JK to D)8-bit ALUdecimal to BCD encoderBCD to decimal decoder4-to-1 mux from 2-to-1 muxesXOR gate from NOR gates4-bit LFSR74LS138 decoderBCD subtractor74181 ALUD latch vs D flip-flop74LS47 BCD to 7-segment decoder74HC595 shift register7400 quad NAND gate chip7402 quad NOR gate chip7404 hex inverter chip7408 quad AND gate chip7432 quad OR gate chip7486 quad XOR gate chip

Each of these is one step from a transistor to a working CPU. Build every gate from CMOS transistors and work all the way up in the free digiwleea lab, with the free theory reference alongside.

Open the CMOS AOI gate (AOI21) in the lab →

Frequently asked

What is an AOI gate?

An AND-OR-INVERT gate: it ANDs some inputs, ORs the results and inverts, all in one CMOS stage. The AOI21 computes Y = NOT (A B + C).

How many transistors are in an AOI21 gate?

Six: three NMOS in the pull-down network and three PMOS in the pull-up network, one of each per input. An AOI22, NOT (A B + C D), needs eight.

What is the difference between AOI and OAI gates?

They are duals. An AOI gate is NOT (A B + C): ANDs first, then OR. An OAI (OR-AND-INVERT) gate is NOT ((A + B) C): ORs first, then AND. In an OAI21 the pull-down is A parallel B, in series with C, and the pull-up is A series B, in parallel with C.

Why use AOI gates?

Because static CMOS gates invert for free, an AND-OR-INVERT function fits in one stage with one transistor pair per input. Making it from separate AND, OR and NOT gates takes more transistors and more stages, so it is bigger and slower.

How do you design the pull-up network of a CMOS gate?

Write the pull-down network from the expression inside the NOT (AND as series, OR as parallel), then take its dual: swap every series connection for parallel and every parallel one for series, using PMOS transistors. Exactly one network then conducts for every input combination.