Unit 1 of 4 · B.Sc IT Sem 2

Unit 1: Number systems and logic gates

Digital Circuits & Logic Design notes · PTU syllabus (BSIT204/BSBC303)

3 min read5 topics10 exam questions
On this page
  1. Unit summary
  2. Number systems and conversions
  3. 1's and 2's complement
  4. Logic gates: AND, OR, NOT, NAND, NOR, XOR and XNOR
  5. NAND and NOR as universal gates
  6. Applications of logic gates
  7. Key terms
  8. Quick revision
  9. Important questions

Unit summary

Digital systems represent everything with two states and process it with logic gates. This unit covers decimal, binary, octal and hexadecimal number systems and conversions, 1's and 2's complement, the AND, OR, NOT, NAND, NOR, XOR and XNOR gates, NAND and NOR as universal gates, and applications of logic gates.

After this unit you can

  • Convert between number systems
  • Represent negative numbers with 1's and 2's complement
  • Explain the operation of logic gates with truth tables
  • Realise any gate with NAND or NOR gates

PTU syllabus topics

  • Decimal/binary/octal/hexadecimal number systems
  • conversions
  • 1's and 2's complement
  • AND/OR/NOT/NAND/NOR/XOR/XNOR gates
  • NAND and NOR as universal gates
  • logic gate applications
ComparisonLogic gate truth table (inputs A, B)
A = 1, B = 1
A = 1, B = 0

AND

1

0

OR

1

1

NAND

0

1

NOR

0

0

XOR

0

1

1

Topic 1

Number systems and conversions

SystemBaseDigits
Binary20, 1
Octal80–7
Decimal100–9
Hexadecimal160–9, A–F
Key formulasConversions
  • Decimal to binary

    Divide by 2 repeatedly; read remainders bottom-up

  • Binary to decimal

    Multiply each bit by 2^position and add

  • Binary to octal

    Group bits in threes from the right

  • Binary to hexadecimal

    Group bits in fours from the right

Example

(25)₁₀ = (11001)₂ = (31)₈ = (19)₁₆.

2

Topic 2

1's and 2's complement

Key formulasComplements
  • 1's complement

    Invert every bit

  • 2's complement

    1's complement + 1

  • Subtraction using 2's complement

    A − B = A + (2's complement of B); discard the final carry

Example

9 − 5 in 4 bits: 5 = 0101; 2's complement = 1011; 1001 + 1011 = 1 0100 → discard carry → 0100 = 4.

  • Signed numbers: in 2's complement, an n-bit number ranges from −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1 (−128 to 127 for 8 bits); only one representation of zero.
3

Topic 3

Logic gates: AND, OR, NOT, NAND, NOR, XOR and XNOR

A logic gate is an electronic circuit with one or more binary inputs and one binary output. The output depends only on the current inputs.

GateExpressionOutput is 1 when…
ANDY = A·Ball inputs are 1
ORY = A + Bat least one input is 1
NOTY = A'the input is 0 (it inverts)
NANDY = (A·B)'not all inputs are 1
NORY = (A + B)'all inputs are 0
XORY = A ⊕ B = A'B + AB'the inputs are different
XNORY = (A ⊕ B)' = AB + A'B'the inputs are the same
ComparisonTruth table of 2-input gates
A = 0, B = 1
A = 1, B = 1

AND

0

1

OR

1

1

NAND

1

0

NOR

0

0

XOR

1

0

XNOR

0

1

Exam tip

For any gate question, give three things: the symbol, the Boolean expression and the truth table.

4

Topic 4

NAND and NOR as universal gates

NAND and NOR are called universal gates because any Boolean function — and therefore any digital circuit — can be built using only NAND gates or only NOR gates. This simplifies manufacturing, since one type of gate can be mass-produced.

To buildUsing only NANDUsing only NOR
NOTJoin both inputs: (A·A)' = A'Join both inputs: (A + A)' = A'
ANDNAND followed by a NAND-inverterInvert each input, then NOR: (A' + B')' = AB
ORInvert each input, then NAND: (A'·B')' = A + BNOR followed by a NOR-inverter

Example

Using De Morgan's law, (A'·B')' = A + B, which is why a NAND gate with inverted inputs behaves as an OR gate.

5

Topic 5

Applications of logic gates

  • XOR: parity generators and checkers, adders, comparators, encryption.
  • AND/OR: enabling and combining signals, alarm and control logic (a car alarm sounds if door open AND ignition on).
  • NOT: inverters, clock generation.
  • NAND/NOR: building all digital circuits; memory latches.

Key terms

Bit
Binary digit, 0 or 1
2's complement
Representation of negative binary numbers
Truth table
Table of outputs for all input combinations
Universal gate
Gate that can implement any Boolean function
XOR
Gate giving 1 when inputs differ

Quick revision

  • Binary, octal, decimal, hex conversions.
  • 1's and 2's complement; subtraction; signed range.
  • Seven gates, symbols, truth tables, expressions.
  • NAND and NOR as universal gates.
  • Gate applications.

Important exam questions

Practice questions written to the PTU exam pattern for this unit's syllabus: short answers (Section A style) and long answers (Sections B and C style).

Short-answer questions

  1. Q1.Convert (10110)₂ to decimal and hexadecimal.
  2. Q2.Find the 2's complement of 01101.
  3. Q3.Draw the truth table of XOR.
  4. Q4.Why are NAND and NOR called universal gates?
  5. Q5.Realise an OR gate using NAND gates.
  6. Q6.Give one application of XOR.

Long-answer questions

  1. Q1.Explain number systems and conversions with examples.
  2. Q2.Explain 1's and 2's complement and binary subtraction.
  3. Q3.Explain all logic gates with symbols and truth tables.
  4. Q4.Show how NAND and NOR gates realise basic gates.

Stuck on this unit?

Message SBS on WhatsApp for help with Digital Circuits & Logic Design, or to ask about studying B.Sc IT at Synetic.

WhatsApp us