Electronics and Communication Engineering‹›⌂ 0:00 studied

Module 3 · 12 min read · Free chapter

Logic gates, CMOS logic and combinational circuits

In short

A static CMOS gate pairs an NMOS pull-down network with its dual PMOS pull-up, so it draws almost no static current. Dynamic power is αC_L V_DD² f. NAND and NOR are universal. A full adder gives S = A ⊕ B ⊕ C_in, carry lookahead speeds addition, and a 2ⁿ-to-1 multiplexer can implement any function of n variables.

What are you preparing for? We show the practice and previous year questions of your exam.

Start from zero: circuits whose output depends only on now

A light switch on a staircase can be wired so that either switch turns the light on or off. The light depends only on the present positions of the two switches. A circuit like this, with no memory, is called combinational.

Combinational circuits are built from logic gates, each a small circuit that computes one Boolean operation. Today almost every gate is made in CMOS, using complementary pairs of n-channel and p-channel MOSFETs from the device chapters. The way those transistors are arranged sets the gate's speed, power and noise tolerance.

From gates we build larger blocks: adders that do arithmetic, multiplexers that select data, decoders that pick one line from many, and code converters. These blocks fill every processor, phone and controller.

This chapter covers gates, their CMOS implementation and the main combinational building blocks.

Why it matters. GATE EC asks a CMOS gate, an adder or a multiplexer function nearly every year, and JE papers test gate counts and truth tables.

Logic gates and universal gates

The basic gates are AND, OR and NOT. Combining them gives NAND (AND followed by NOT), NOR (OR followed by NOT), XOR and XNOR.

XOR gives 1 when its inputs differ, A⊕B=AB‾+A‾BA \oplus B = A\overline{B} + \overline{A}B. With many inputs it gives 1 when an odd number of them are 1, so it is the parity function used in error detection. XNOR gives 1 when the inputs are equal, so it is an equality detector.

NAND and NOR are called universal gates, because any Boolean function can be built using only one of them. With NAND, tying both inputs together gives NOT, a NAND followed by NOT gives AND, and NANDs on inverted inputs give OR by De Morgan's theorem. NOR works the same way with the roles of AND and OR swapped.

Universality matters in practice. In CMOS, NAND and NOR are the natural gates and are smaller and faster than AND and OR, so designers build logic from them.

A two-level SOP expression maps directly to a NAND-NAND circuit, and a POS expression maps to NOR-NOR. You draw the AND-OR form, then replace every gate by NAND, and the bubbles cancel in pairs.

Worked example. An XOR needs four two-input NAND gates. With N=AB‾N = \overline{AB}, the output is AN‾⋅BN‾‾=A⊕B\overline{\overline{A N}\cdot\overline{B N}} = A \oplus B.

Why it matters. Questions ask the minimum number of NAND or NOR gates for a function, or the output of a gate network.

Static CMOS gates

The CMOS inverter has a PMOS from VDDV_{DD} to the output and an NMOS from the output to ground, with both gates driven by the input. When the input is high, the NMOS is on and the PMOS off, so the output is pulled to 0. When the input is low, the reverse happens and the output is pulled to VDDV_{DD}.

In either steady state one transistor is off, so no current flows from supply to ground. This is why CMOS uses almost no static power and why it replaced older logic families.

Every static CMOS gate has the same structure. A pull-down network of NMOS transistors connects the output to ground when the function should be 0. A pull-up network of PMOS transistors connects it to VDDV_{DD} when the function should be 1. The two networks are duals: NMOS in series become PMOS in parallel, and the other way round.

A two-input NAND has two NMOS in series, since the output falls only when both inputs are 1, and two PMOS in parallel. A two-input NOR has two NMOS in parallel and two PMOS in series. Because holes are slower than electrons, series PMOS are slow, so NAND is usually preferred over NOR in CMOS.

CMOS gates are naturally inverting. An AND gate is a NAND followed by an inverter, so it needs six transistors against four for the NAND.

The inverter's voltage transfer curve is very steep. Its switching threshold VMV_M is near VDD2\dfrac{V_{DD}}{2} when the PMOS is made wider by about μnμp\dfrac{\mu_n}{\mu_p}, two to three times, to match the NMOS drive. The noise margins measure how much noise an input can take:

NMH=VOH−VIH,NML=VIL−VOLNM_H = V_{OH} - V_{IH}, \qquad NM_L = V_{IL} - V_{OL}

CMOS power is mostly dynamic, spent charging and discharging the load capacitance:

P=α CL VDD2 fP = \alpha\, C_L\, V_{DD}^2\, f

Here α is the fraction of clock cycles in which the node switches. Because power rises with VDD2V_{DD}^2, lowering the supply is the most effective way to save energy, which is why chip supplies fell from 5 V to below 1 V. Delay rises roughly as CLVDDID\dfrac{C_L V_{DD}}{I_D}, so lower supplies also mean slower gates.

Worked example. A node with CL=10C_L = 10 fF switches with α = 0.1 at 1 GHz and VDD=1V_{DD} = 1 V. Then P=0.1×10−14×1×109=1P = 0.1 \times 10^{-14} \times 1 \times 10^{9} = 1 µW.

Why it matters. Drawing a CMOS gate for a given function and finding dynamic power are standard GATE questions.

Arithmetic circuits: adders and subtractors

A half adder adds two bits and gives a sum and a carry:

S=A⊕B,C=ABS = A \oplus B, \qquad C = AB

A full adder also takes a carry in from the previous column:

S=A⊕B⊕Cin,Cout=AB+Cin(A⊕B)S = A \oplus B \oplus C_{in}, \qquad C_{out} = AB + C_{in}(A \oplus B)

It can be built from two half adders and an OR gate. CoutC_{out} can also be written as the majority function AB+BCin+ACinAB + BC_{in} + AC_{in}.

An nn-bit ripple-carry adder chains nn full adders, each carry feeding the next. It is small, but the carry may have to travel through every stage, so the worst-case delay grows in proportion to nn. For a 64-bit adder this is far too slow.

The carry-lookahead adder removes the wait. For each bit it forms a generate term Gi=AiBiG_i = A_i B_i, which means this column makes a carry by itself, and a propagate term Pi=Ai⊕BiP_i = A_i \oplus B_i, which means it passes an incoming carry on. Then:

Ci+1=Gi+PiCiC_{i+1} = G_i + P_i C_i

Expanding this gives every carry directly from the inputs and C0C_0, in two gate levels. Wide adders use lookahead in groups and trees, giving delay that grows only as log⁡n\log n.

Subtraction uses the same adder. To find A−BA - B, invert every bit of B and set C0=1C_0 = 1, which adds the 2's complement of B. An XOR on each B input, controlled by a single add-subtract line, gives an adder-subtractor.

Worked example. With A=1011A = 1011 and B=0110B = 0110, ripple addition gives sum 0001 with a carry out of 1, that is 11+6=1711 + 6 = 17. In 4 bits this shows as 0001 plus a carry.

Why it matters. Adder equations, delay comparisons and the adder-subtractor are frequent GATE questions.

Multiplexers, demultiplexers and decoders

A multiplexer (MUX) is a data selector. A 2n2^n-to-1 MUX has 2n2^n data inputs, nn select lines and one output, and the select code chooses which input reaches the output. For a 4-to-1 MUX:

Y=S1‾ S0‾ I0+S1‾S0I1+S1S0‾ I2+S1S0I3Y = \overline{S_1}\,\overline{S_0}\,I_0 + \overline{S_1}S_0 I_1 + S_1\overline{S_0}\,I_2 + S_1 S_0 I_3

Each term is a minterm of the select lines ANDed with one data input. So a MUX can implement any function: connect the variables to the select lines and put the truth-table output values, 0 or 1, on the data inputs. A 2n2^n-to-1 MUX can even implement any function of n+1n + 1 variables, by using the last variable, its complement, 0 or 1 as the data inputs.

A decoder does the opposite of selecting. An nn-to-2n2^n decoder has nn inputs and 2n2^n outputs, and exactly one output is active for each input code. Each output is one minterm, so a decoder with an OR gate on the chosen outputs implements any function in sum-of-minterms form. Decoders also select memory chips and devices by address.

A demultiplexer (DEMUX) sends one data input to one of 2n2^n outputs chosen by the select lines. It is simply a decoder whose enable input carries the data.

MUXes and DEMUXes together let many signals share one wire by taking turns, which is time-division multiplexing, the basis of telephone exchanges and digital buses.

Worked example. Implement F(A,B,C)=∑m(1,2,6,7)F(A, B, C) = \sum m(1, 2, 6, 7) with a 4-to-1 MUX using A and B as selects. For AB = 00, F is 1 only at C = 1, so I0=CI_0 = C. For 01, F = 1 at C = 0, so I1=C‾I_1 = \overline{C}. For 10, F = 0, so I2=0I_2 = 0, and for 11, F = 1, so I3=1I_3 = 1.

Why it matters. "What function does this MUX implement" is one of the most common GATE digital questions.

Encoders, comparators, hazards and logic families

An encoder does the reverse of a decoder: it outputs the binary code of whichever input is active. If several inputs can be active at once, a priority encoder outputs the code of the highest-priority one and a valid flag. Keyboards and interrupt controllers use priority encoders.

A magnitude comparator compares two binary numbers and gives three outputs, A>BA > B, A=BA = B and A<BA < B. Equality uses XNOR on each bit pair, and the greater-than test checks bits from the MSB down. Code converters, such as binary to Gray or BCD to seven-segment, are designed like any combinational circuit, from a truth table and K-maps.

Real gates have delay, and different paths have different delays. When one input changes, the output may briefly take the wrong value, a glitch.

If the output should stay at 1 but dips to 0, that is a static-1 hazard. On a K-map it occurs where two adjacent 1s are covered by different groups. Adding the consensus term, a group covering both, removes it. Hazards matter when the output drives a clock or an asynchronous input.

Several logic families have been used. TTL used bipolar transistors and a 5 V supply. ECL kept transistors out of saturation and was the fastest, but drew high power.

CMOS has the lowest static power and the widest noise margin, and dominates today. Families are compared by propagation delay, power and their product, the speed-power product, and by fan-out, the number of inputs one output can drive.

Why it matters. Hazard identification, priority encoder outputs and family comparisons appear in GATE, ESE and JE papers.

Descriptive lens: how this topic is asked in written papers

Written papers ask this topic in four ways:

  1. Draw a static CMOS gate for a given function, or the NAND-only form of a circuit.
  2. Explain why CMOS has low static power, why NAND is preferred to NOR, or why ripple-carry is slow.
  3. Design a full adder, a carry-lookahead stage, a comparator or a code converter from its truth table.
  4. Implement a function with a multiplexer or a decoder.

Practice questions (our own, not previous-year questions).

  1. Draw the transistor-level static CMOS circuit for F=A(B+C)‾F = \overline{A(B + C)} and explain how the pull-up and pull-down networks are derived. (15 marks)
  2. Derive the carry-lookahead expressions for a 4-bit adder and compare its delay with a ripple-carry adder. (10 marks)
  3. Implement F(A,B,C,D)=∑m(0,1,3,4,8,9,15)F(A, B, C, D) = \sum m(0, 1, 3, 4, 8, 9, 15) using an 8-to-1 multiplexer. (10 marks)

Answer plan for question 1.

  • Note that F is inverted, so the pull-down network realises A(B+C)A(B + C) directly.
  • Draw NMOS A in series with the parallel pair NMOS B and NMOS C, from output to ground.
  • Form the dual pull-up: PMOS A in parallel with the series pair PMOS B and PMOS C, from VDDV_{DD} to output.
  • Check one input case each way, such as A = 1, B = 1 giving output 0, and A = 0 giving output 1.
  • State the count, six transistors, and that only one network conducts in any steady state.

Quick revision

  • NAND and NOR are universal, XOR is parity and XNOR is equality.
  • SOP maps to NAND-NAND and POS maps to NOR-NOR.
  • Static CMOS has an NMOS pull-down and its dual PMOS pull-up, with series in one meaning parallel in the other.
  • CMOS NAND has series NMOS and is preferred to NOR, which has series PMOS.
  • Noise margins are NMH=VOH−VIHNM_H = V_{OH} - V_{IH} and NML=VIL−VOLNM_L = V_{IL} - V_{OL}, and dynamic power is αCLVDD2f\alpha C_L V_{DD}^2 f.
  • The full adder gives S=A⊕B⊕CinS = A \oplus B \oplus C_{in} and Cout=AB+Cin(A⊕B)C_{out} = AB + C_{in}(A \oplus B).
  • Ripple-carry delay goes as n, while lookahead uses Ci+1=Gi+PiCiC_{i+1} = G_i + P_iC_i and goes as log n.
  • A 2n2^n-to-1 MUX implements any function of n, or n + 1, variables, and a decoder plus OR gives any function.
  • A static hazard is removed by adding the consensus group.

Check yourself

Exam-style questions on this chapter. Pick an answer to see the explanation. 0 of 12 answered

  1. Which gates are called universal gates?

  2. The output of a four-input XOR gate with inputs 1, 0, 1, 1 is:

  3. In a static CMOS two-input NAND gate, the NMOS and PMOS transistors are connected as:

  4. How many transistors does a static CMOS realisation of F=AB+C‾F = \overline{AB + C} need?

  5. A CMOS gate drives 20 fF at 500 MHz with VDD=1.2V_{DD} = 1.2 V and activity factor 0.2. Its dynamic power is about:

  6. Halving the supply voltage of a CMOS circuit at the same frequency reduces its dynamic power to:

  7. For a full adder with A = 1, B = 1 and carry-in 1, the sum and carry-out are:

  8. In a carry-lookahead adder, the carry out of stage i is:

  9. A 4-to-1 MUX has select lines S1=AS_1 = A, S0=BS_0 = B and data inputs I0=0I_0 = 0, I1=1I_1 = 1, I2=1I_2 = 1, I3=0I_3 = 0. It implements:

  10. How many select lines does a 32-to-1 multiplexer need?

  11. An 8-to-3 priority encoder (input 7 highest) has inputs 2, 4 and 5 active. Its output code is:

  12. The function F=AB+A‾CF = AB + \overline{A}C can show a static-1 hazard when A changes with B = C = 1. The term that removes it is:

Previous year questions

Previous year questions for UPSC CSE will appear here once each one is checked word for word against the official question paper.

Learn with AI

A tutor that asks instead of telling, a partner that argues the other side, and this chapter told through your own district.

Tell the tutor what you are stuck on. It will guide you with questions and give the answer after a few tries.

🙋 Raise a doubt or feedback

Stuck somewhere, or spotted a mistake? Write to the ExamHike team. We usually reply within a day, and you will see the reply on My progress.

Log in to ask a doubt or send feedback →

Frequently asked questions

Why is NAND preferred to NOR in CMOS?

NAND puts the slow PMOS transistors in parallel and the fast NMOS in series, while NOR puts PMOS in series, which makes it slower or larger.

How does supply voltage affect CMOS power?

Dynamic power goes as the square of V_DD, so halving the supply cuts switching power to a quarter at the same frequency.

Why is a ripple-carry adder slow?

Each stage waits for the carry from the one before, so the worst-case delay grows in proportion to the number of bits.

How can a multiplexer implement a function?

Connect the variables to the select lines and place the truth-table outputs, or the last variable and its complement, on the data inputs.

More in this module: Digital circuits

Official sources

Facts in this chapter were checked against these official sources.

  1. GATE 2026 Electronics and Communication Engineering (EC) syllabus, IIT Guwahati
  2. NPTEL Digital Electronic Circuits (IIT Kharagpur, 108105132): logic gates, logic families, combinational circuits