Skip to content

Logic Fundamentals

Digital electronics represents information with a finite set of levels. Binary systems use two logic states, written 0 and 1. A logic value is an abstract state; the corresponding voltage range depends on the logic family.

For radix rr, a positional number (dndn−1…d0.d−1…d−m)r(d_nd_{n-1}\ldots d_0.d_{-1}\ldots d_{-m})_r has value

N=∑k=−mndkrk,0≤dk<r.\boxed{N=\sum_{k=-m}^{n}d_kr^k},\qquad 0\le d_k<r.
SystemBaseDigitsMain use
Binary, 1Native representation of logic and storage
Octal–7Compact grouping of three binary bits
Decimal–9Human-readable quantities
Hexadecimal–9, A–FCompact grouping of four binary bits

Number systems used in digital electronics.

  • To convert an integer from decimal to base rr, divide repeatedly by rr and read the remainders from last to first.

  • To convert a decimal fraction, multiply repeatedly by rr and read the integer parts in order. A non-terminating result must be rounded to a stated number of places.

  • For binary–octal conversion, group bits in threes about the radix point. For binary–hexadecimal conversion, group them in fours.

An nn-bit word has 2n2^n distinct patterns. Their interpretation depends on the chosen code.

RepresentationRange for nn bitsZeroNegative-value rule
Unsigned00 to 2n−12^n-1oneNot available
Sign magnitude−(2n−1−1)-(2^{n-1}-1) to 2n−1−12^{n-1}-1twoSet sign bit to 1
One’s complement−(2n−1−1)-(2^{n-1}-1) to 2n−1−12^{n-1}-1twoComplement every bit
Two’s complement−2n−1-2^{n-1} to 2n−1−12^{n-1}-1oneComplement and add 1

Common binary integer representations.

For an nn-bit two’s-complement word bn−1…b0b_{n-1}\ldots b_0,

N=−bn−12n−1+∑k=0n−2bk2k.\boxed{N=-b_{n-1}2^{n-1}+\sum_{k=0}^{n-2}b_k2^k}.

To form −N-N, invert all nn bits of NN and add 1, discarding any carry beyond the word. For example, in eight bits,

+37=0010 0101,−37=1101 1011.+37=0010\,0101, \qquad -37=1101\,1011.

Sign extension copies the sign bit into new high-order positions; zero extension is correct only for unsigned values.

Binary-coded decimal (BCD) stores each decimal digit separately in four bits. Thus 5910=0101 1001BCD59_{10}=0101\,1001_{\mathrm{BCD}}, whereas ordinary binary gives 5910=0011 1011259_{10}=0011\,1011_2. The six patterns 1010–1111 are invalid BCD digits.

In positive logic, the higher specified voltage range represents 1 and the lower range represents 0. The intermediate voltage interval is normally undefined, not a third state.

Symbols and Boolean expressions of the basic logic gates. An output bubble denotes inversion; XOR has an additional curved input line.

Symbols and Boolean expressions of the basic logic gates. An output bubble denotes inversion; XOR has an additional curved input line.

GateExpressionOutput condition
BUFFERY=AY=Afollows the input
NOTY=A‾Y=\overline A1 when A=0A=0
ANDY=ABY=AB1 only when every input is 1
ORY=A+BY=A+B1 when any input is 1
NANDY=AB‾Y=\overline{AB}complement of AND
NORY=A+B‾Y=\overline{A+B}complement of OR
XORY=A⊕BY=A\oplus B1 when the inputs differ
XNORY=A⊕B‾Y=\overline{A\oplus B}1 when the inputs agree

Boolean functions of the basic gates.

AABBABABA+BA+BAB‾\overline{AB}A+B‾\overline{A+B}A⊕BA\oplus BA⊕B‾\overline{A\oplus B}

Complete two-input truth table.

Boolean variables take values in {0,1}\{0,1\}. Addition denotes OR, multiplication denotes AND, and an overbar denotes NOT.

Core Boolean identities.

LawOR formAND form
IdentityA+0=AA+0=AA⋅1=AA\cdot 1=A
NullA+1=1A+1=1A⋅0=0A\cdot 0=0
IdempotentA+A=AA+A=AAA=AAA=A
ComplementA+A‾=1A+\overline A=1AA‾=0A\overline A=0
InvolutionA‾‾=A\overline{\overline A}=A—
CommutativeA+B=B+AA+B=B+AAB=BAAB=BA
AssociativeA+(B+C)=(A+B)+CA+(B+C)=(A+B)+CA(BC)=(AB)CA(BC)=(AB)C
DistributiveA+BC=(A+B)(A+C)A+BC=(A+B)(A+C)A(B+C)=AB+ACA(B+C)=AB+AC
AbsorptionA+AB=AA+AB=AA(A+B)=AA(A+B)=A
De MorganA+B‾=A‾ B‾\overline{A+B}=\overline A\,\overline BAB‾=A‾+B‾\overline{AB}=\overline A+\overline B

The principle of duality interchanges ++ with multiplication and 0 with 1. Every valid identity therefore has a valid dual. De Morgan’s laws also show why NAND and NOR are universal:

A‾=AA‾=A+A‾,AB=AB‾ AB‾‾,A+B=A+B‾+A+B‾‾.\overline A=\overline{AA}=\overline{A+A}, \qquad AB=\overline{\overline{AB}\,\overline{AB}}, \qquad A+B=\overline{\overline{A+B}+\overline{A+B}}.

A truth table defines a function row by row. An expression may be written in two canonical forms:

  • sum of minterms: OR the product term for every row where F=1F=1; write F=Σm(⋯ )F=\Sigma m(\cdots);

  • product of maxterms: AND the sum term for every row where F=0F=0; write F=ΠM(⋯ )F=\Pi M(\cdots).

In a minterm, use the uncomplemented variable for a row value 1 and the complemented variable for 0. In a maxterm the convention is reversed.

For example,

F(A,B,C)=Σm(1,2,3,5,7)F(A,B,C)=\Sigma m(1,2,3,5,7)

has a 1 in rows 001, 010, 011, 101 and 111. Its canonical SOP is

A‾ B‾C+A‾BC‾+A‾BC+AB‾C+ABC.\overline A\,\overline B C+\overline A B\overline C+ \overline A BC+A\overline BC+ABC.

Adjacent K-map cells differ in one variable. Group 1s for SOP or 0s for POS in rectangles containing 1,2,4,8,…1,2,4,8,\ldots cells. Groups may wrap across an edge, overlap, and should be as large as possible. A variable disappears from a term when it changes within a group.

A ∖\setminus BC00011110
00111
10110

The four cells with C=1C=1 give CC; the remaining pair at A=0,B=1A=0,B=1 gives A‾B\overline A B. Hence

F=C+A‾B.\boxed{F=C+\overline A B}.

Do not treat diagonally touching cells as adjacent, and keep row/column order Gray-coded: 00, 01, 11, 10.

  1. Define input and output variables, including active-HIGH or active-LOW conventions.

  2. Build the truth table and mark impossible states as don’t-cares only when the hardware guarantees they cannot occur.

  3. Write canonical SOP or POS, then simplify algebraically or by K-map.

  4. Select gates or a universal NAND/NOR realization and draw every inversion explicitly.

  5. Verify all input rows and estimate logic depth, loading and delay.

For a combinational path with gate delays t1,t2,…,tkt_1,t_2,\ldots,t_k, a conservative worst-case estimate is

tpd,path≈∑i=1kti.\boxed{t_{pd,path}\approx\sum_{i=1}^{k}t_i}.

The physical design must also respect fan-out, noise margins, supply limits and unused-input rules of its chosen logic family.