Top Banner
LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 1 Copyright © 2007-9 by Leong Hon Wai Hardware (Part A) Reading Materials: Chapter 4 of [SG]: The Building Blocks of HW Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization of Digital Computers 2. Binary Numbers 3. Boolean Logic and Basic Gates 4. Basic Circuit Design Last Revised: 09 October 2016.
84

Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

Jul 23, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 1

Copyright © 2007-9 by Leong Hon Wai

Hardware (Part A)

q  Reading Materials: v  Chapter 4 of [SG]: The Building Blocks of HW v  Optional: Chapter 1 of [Brookshear]

OUTLINE 1.  The Binary Digital Computer

Organization of Digital Computers 2.  Binary Numbers 3.  Boolean Logic and Basic Gates 4.  Basic Circuit Design

Last Revised: 09 October 2016.

Page 2: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 2

Copyright © 2007-9 by Leong Hon Wai

Chapter Objectives

q  In this chapter, you will learn about v The Binary Numbering System v Boolean Logic and Basic Gates v Building Simple Computer Circuits v  Simple Control Circuits

q  This chapter focus on logic design v How to represent / store information v Applying symbolic logic to design gates v Using gates to build circuits for addition, compare,

simple control

Page 3: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 3

Copyright © 2007-9 by Leong Hon Wai

The Binary Digital Computer

q Organization of a Computer

Input Devices CPU Output

Devices

Memory Unit (Storage)

Page 4: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 4

Copyright © 2007-9 by Leong Hon Wai

Analog/Digital Computer

…Up to now, whatever we have discussed could equally well be discussed in the context of either digital or analog computations…

q We shall concentrate on digital computer v  Specifically, binary computers v BINARY = two value (0 and 1) [ON/OFF]

q Why binary computers? v Physical components – transistors, etc v Reliability of hardware components

Page 5: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 5

Copyright © 2007-9 by Leong Hon Wai

Why use Binary Numbers?

1. Reliability v Represent only two values (0 and 1), ON/OFF v High margin of error

2. Nature of Hardware Devices v Many devices are “two-state” devices

3. Persistence of Digital Data v Can store and preserve digital data better

Page 6: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 6

Copyright © 2007-9 by Leong Hon Wai

Why Binary Computers: Reliability

1. Reliability: v  computer store info using electronic devices v  electronic quantities measured by: ◆  voltage, current, charge, etc

v These analog quantities are not always reliable! ◆ esp. for old equipments ◆ Also, the range of voltage changes with advances

in hardware technology

Page 7: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 7

Copyright © 2007-9 by Leong Hon Wai

Why Binary: Nature of Devices

2. Many hw devices are “two-state” devices v magnetized / demagnetized ◆ diskettes (3.5” floppy, Zip disks,…)

v  direction of magnetization (cw / ccw) ◆ CORE memory (main memory)

v  charged / discharged capacitor

Page 8: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 8

Copyright © 2007-9 by Leong Hon Wai

Binary Storage Devices

q  Magnetic Cores v Historic device for computer memory v Tiny magnetized rings: flow of current sets dir. of magnetic field v Binary values 0 and 1 represented by direction of magnetic field

Page 9: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 9

Copyright © 2007-9 by Leong Hon Wai

Binary Storage Devices (continued)

q  Transistors v  Solid-State Switches: permit or block current flow v Control “switch” to change the state v Constructed from semiconductor

A simplified model of a transistor

Page 10: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 10

Copyright © 2007-9 by Leong Hon Wai

Why Digital: More Durable

q  Analog data poses difficulties v  very hard to store real numbers accurately v  or persistently (over time) v  eg: old photographs, movie reels, books

3. Solution: Store them digitally (high persistence) v  CD player uses approximation…

◆  instead of the exact frequency/volume (audio) ◆ But, the approximation is “good enough” ◆ Our ears not sensitive enough to tell difference

v  But… Once we have digital data (reliability) ◆ Can use various algorithms (eg: compression) for easier

processing of the data….

Page 11: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 11

Copyright © 2007-9 by Leong Hon Wai

Hardware: The Basic Building Blocks

v  The Digital Computer v  Binary Numbers

Binary number System From Decimal to Binary Binary Rep. of Numeric and Textual Information Rep. of Sound, Image Information Reliability of Binary Encoding READ: Sect. 4.2 of [SG]

v  Boolean Logic and Basic Gates v  Basic Circuit Design

Page 12: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 12

Copyright © 2007-9 by Leong Hon Wai

2. The Binary Numbering System

q Human represent and process information using a decimal system (base 10), -- digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

q ALL information inside a digital computer is stored as binary data (base 2) -- digits are 0, 1

Page 13: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 13

Copyright © 2007-9 by Leong Hon Wai

Binary Numbers (vs Decimal Numbers)

q Humans use Decimal number system v  7809 = 7×103 + 8×102 + 0×101 + 9×100 v Each digit is from {0,1,2,3,4,5,6,7,8,9} – Base 10 v  (we happen to have 10 fingers.)

q Computers use Binary number system v  (1101)2 = 1×23 + 1×22 + 0×21 + 1×20 = 13 v Each binary digit (bit) is {0,1} – Base 2 v  (IT people have 2 fingers (1 per hand))

q Readings: Section 4.2 of [SG]

Page 14: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 14

Copyright © 2007-9 by Leong Hon Wai

Figure 4.2 Binary-to-Decimal Conversion Table

BINARY COUNTING: One, Ten Eleven One Hundred One Hundred and One One Hundred and Ten One Hundred and Eleven One Thousand

Page 15: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 15

Copyright © 2007-9 by Leong Hon Wai

Converting from Decimal to Binary

Example: 43

q Method: (repeated divide by 2) 43 / 2 ----> Quotient: 21 Remainder: 1 21 / 2 ----> Quotient: 10 Remainder: 1 10 / 2 ----> Quotient: 5 Remainder: 0 5 / 2 ----> Quotient: 2 Remainder: 1 2 / 2 ----> Quotient: 1 Remainder: 0 1 / 2 ----> Quotient: 0 Remainder: 1

q (43)10 = (101011)2

Page 16: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 16

Copyright © 2007-9 by Leong Hon Wai

In general, to represent decimal n, we need k = lg (n +1) binary bits

Number of Bits Needed

q  Have seen that (43)10 = (101011)2

q  To represent decimal (43)10 in binary, we need 6 binary bits

This is EXACTLY the process “Repeated-Divide-by-2 until we reach 0”

lg(n +1)" #

Page 17: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 17

Copyright © 2007-9 by Leong Hon Wai

Self-Test Exercise:

1.  In the previous worked example on converting decimal numbers to binary, at the end of all the dividing-by-two, we collect the digits by going backwards! Why?

Hint: Try working this out yourself. Try going forward instead. What is the binary number you get.

Convert it back to decimal and see what you will get. Use 6 and 4 as examples.

2.  Exercise Algorithm Decimal-to-Binary on the following inputs. For each input, what is the output binary number and the value of k?

(a) 8 (b) 13

Page 18: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 18

Copyright © 2007-9 by Leong Hon Wai

Decimal to Binary (2) -- Algorithm Algorithm: Decimal-to-Binary(n) Input: Decimal number (n)10 Output: Binary representation (n)10 = (bk-1 … bj … b0)2 begin let j ß 0; let num ß n; while (num > 0) do b[j] ß num mod 2; // remainder num ß num div 2; // divide by 2 j ß j + 1; endwhile while (j < k) do // pad preceding b[j] ß 0; // bits with 0’s j ß j + 1; endwhile Output B = (b[k-1] b[k-2] … b[1] b[0]) end.

Page 19: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 19

Copyright © 2007-9 by Leong Hon Wai

q Representing integers

v Decimal integers converted to binary integers

v Given k bits, (bit = binary digit) the largest unsigned integer is (2k – 1)

◆  Given 5 bits, the largest is 25–1 = 31

◆  Store 0, 1, 2, …, 31 = (25–1), namely ( 0 .. 31)

◆  Question: What about 10 bits? ( 0 .. ????)

v  Signed integers must also include the sign-bit (to indicate positive or negative)

Binary Representation of Numeric Data

Page 20: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 20

Copyright © 2007-9 by Leong Hon Wai

How many bits are needed?

Binary number representation – # of bits v  1 bit, can represent 2 numbers; [0,1] v  2 bits à 4 numbers, [0..3];

(00, 01, 10, 11)

v  3 bits à 8 numbers, [0..7]; (000, 001, 010, 011, …, 110, 111)

v  4 bits à 16 numbers, [0..15]; (0000, 0001, 0010, …, 1110, 1111)

v …

With k bits à 2k numbers, [0 .. (2k–1)]

Typical computer today 32 bit words

Or 64 bit words

Page 21: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 21

Copyright © 2007-9 by Leong Hon Wai

q Representing real numbers v Real numbers may be put into binary scientific

notation: a x 2b ◆ Example: 101.11 x 20

v Number then normalized so that first significant digit is immediately to the right of the binary point ◆ Example: .10111 x 23

v Mantissa and exponent then stored ◆  they both need a sign-bit (positive/negative)

Binary Representation of Numeric Data…

Page 22: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 22

Copyright © 2007-9 by Leong Hon Wai

Number Representations

q Read up on v Signed magnitude numbers v “floating point” representation of real numbers ◆ Mantissa, exponent

q Readings: Section 4.? of [SG]

Page 23: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 23

Copyright © 2007-9 by Leong Hon Wai

Representation of Textual Information (1)

Computers process numbers, but also textual information

v  non numeric data and text v  0 1 … 9 a b …z . | + * ( & v  special control characters eg: CR, tabs

ASCII (American Standard Code for Information Interchange) “as-kee” Standard

v  uses 7 bit code for each character v Usually, a 0 is added in front ◆ “A” is 01000001 ◆ “a” is 01100001

Page 24: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 24

Copyright © 2007-9 by Leong Hon Wai

ASCII Code Table

Page 25: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 25

Copyright © 2007-9 by Leong Hon Wai

Representation of Textual Information…

q Characters are mapped into binary codes v ASCII code set

(8 bits per character; 256 character codes) v UNICODE code set -- http://unicode-table.com/en/

(16 bits, 65,536 character codes)

q Using ASCII codes, we can represent v  numbers, letters (as characters) v Names of people, sentences ◆ as sequences of characters

“Hello World!” The above contains 12 characters

(without the quotes “”)

Page 26: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 26

Copyright © 2007-9 by Leong Hon Wai

Representation Basic Operations

q  Basic elementary computer operations… v Also represented in binary

Eg: Represent instructions (eg: ADD, SUB) v we first assign them codes

ADD 00 (* code for adding *) SUB 01 (* code for subtracting *) … …

v and then use the code to activate them

Page 27: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 27

Copyright © 2007-9 by Leong Hon Wai

How about sound, image, video?

Page 28: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 28

Copyright © 2007-9 by Leong Hon Wai

First, representation of sound...

q Analog data (eg: video, audio data) v  can be represented as digital data v  using approximation…

q via a digitization process…

q Accuracy depends on number of bits! v  the more bits, the more accurate…

audio, video signals

digitization process

digital data

Page 29: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 29

Copyright © 2007-9 by Leong Hon Wai

Figure 4.5

Digitization of an Analog Signal

(a) Sampling the Original

Signal

(b) Recreating the signal from the Sampled Values

Page 30: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 30

Copyright © 2007-9 by Leong Hon Wai

Data Representation – Analog Data?

Analog data is problematic? Eg: How to represent (2.1)10 in binary?

v  (10.1)2 = (2.5)10 [too big] v  (10.01)2 = (2.25)10 [still too big] v  (10.001)2 = (2.125)10 [still too big] v  (10.0001)2 = (2.0625)10 [now too small] v  (10.00011)2 = (2.09375)10 [still too small] v  (10.000111)2 = (2.109375)10 [too big] v  …… [error keeps getting smaller]

(2.1)10 cannot be represented exactly in binary! v We can only give an approximation. v Accuracy depends on the number of bits ◆  More bits à Higher Accuracy

Page 31: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 31

Copyright © 2007-9 by Leong Hon Wai

Representation of sound...

Approximating original sound from samples

How to improve this approximation

Sample more frequently Use more bits for each sample point

Page 32: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 32

Copyright © 2007-9 by Leong Hon Wai

Next -- Representing image…

q What is an image? v N x M array of colour pixels (picture elements) v Each pixel has colour+intensity value v  Image quality depends on #bits to store each pixel

Picture by iPhone-6S

2448 x 3264 pixels (34" x 45")

(at 72 pixels per inch)

~ 22.9MB data ~2MB (compressed)

Page 33: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 33

Copyright © 2007-9 by Leong Hon Wai

Next -- Representing image…

How to represent colour+intensity value? RGB [8 bits each, total 24], CMYK, Colour Wheel, etc

Page 34: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 34

Copyright © 2007-9 by Leong Hon Wai

The making of UIT220Swan

UIT2201

Page 35: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 35

Copyright © 2007-9 by Leong Hon Wai

Representing image…

q Camera takes a picture, you get an image… v  (3D world projected onto 2D paper)

q Images create HUGE files v We compress these images (reduce space) v Lossless and lossy compression methods

Page 36: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 36

Copyright © 2007-9 by Leong Hon Wai

Representing video…

q More complicated…

q Not covered here.

Page 37: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 37

Copyright © 2007-9 by Leong Hon Wai

Hardware: The Basic Building Blocks

v  The Digital Computer v  Binary Numbers

v  Boolean Logic and Basic Gates READING: Sect. 4.3 to 4.5 of [SG] & Notes 1.  Boolean Logic 2.  Basic Gates, Truth Tables 3.  Simple Combinatorial Circuits 4.  Simplification with Boolean Logic

v  Basic Circuit Design

Page 38: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 38

Copyright © 2007-9 by Leong Hon Wai

Using 0 and 1 to Do Logic,

Build Gates, Build Circults…

Page 39: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 39

Copyright © 2007-9 by Leong Hon Wai

Boolean Logic

q Boolean logic describes operations on true/false values

q True/false maps easily onto bi-stable environment

q Boolean logic operations on electronic signals may be built out of transistors and other electronic devices

Page 40: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 40

Copyright © 2007-9 by Leong Hon Wai

Boolean Circuits

q  Computer operations based on logic circuits v  Logic based on Boolean Algebra

q  Logic circuits have v  inputs (each with value 0 or 1) T/F v  outputs v  state

q  Type of Logic Circuits: v  Combinational circuits: output depends only on input v  Sequential circuits: output depends also on past history (get

sequence of output…)

q  GATES: Basic Building Blocks for Circuits

Page 41: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 41

Copyright © 2007-9 by Leong Hon Wai

Figure 4.15

The Three Basic Gates and Their Symbols

3 Basic Logic Gates (and Truth Tables)

Magic number 3 again…

Page 42: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 42

Copyright © 2007-9 by Leong Hon Wai

Gates

q  Gates are hardware devices built from transistors to “implement” Boolean logic

q  AND gate v  Two input lines, one output line v  Outputs a 1 when both inputs are 1

q  OR gate v  Two input lines, one output line v  Outputs a 1 when either input is 1

q  NOT gate v  One input lines, one output line v  Outputs a 1 when input is 0, and vice versa

Page 43: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 43

Copyright © 2007-9 by Leong Hon Wai

What’s inside a Gate?

q Gate made of physical components v  called transistors v A transistor is formed by sandwiching a p-type

silicon between two n-type silicon or vice versa.

q In this course, we do not need to deal with the details of what’s inside a Gate.

Page 44: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 44

Copyright © 2007-9 by Leong Hon Wai

q Abstraction in hardware design

v Map hardware devices to Boolean logic

v Design more complex devices in terms of logic, not electronics

v Conversion from logic to hardware design may be automated

Gates (continued)

Page 45: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 45

Copyright © 2007-9 by Leong Hon Wai

Simple Combinational Circuits

q Built using a combination of logic gates v  output depends only on the input v  can also be represented by its truth table

q Examples: v C = ~(A • B) v D = (A•B) + (~A • ~B) v G = A + (B • ~C)

AA•B B

C

A

AB D

B

Page 46: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 46

Copyright © 2007-9 by Leong Hon Wai

Combinational Circuits

BB • ~C

A G = A + (B • ~C)

C ~C

G

A B C ~C B • ~C G = A + B•~C 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 1 1 1 0 1 1 0 0 0 1 0 0 1 0 1 1 0 1 0 0 1 1 1 0 1 1 1 1 1 1 0 0 1

Truth Table

Logic Circuit

Page 47: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 47

Copyright © 2007-9 by Leong Hon Wai

Logic Circuits: An aside…

q Possible Interpretation of G “Sound the buzzer if

1.  temperature of engine exceeds 200°F, or 2.  car is in gear and driver’s seat-belt is not buckled”

v We define… ◆  G: “Sound buzzer” ◆  A: “Temperature of engine exceeds 200°F” ◆  B: “Car is in gear” ◆  C: “driver’s seat-belt is buckled”

v G = A + (B • ~C)

q HW: Give other interpretations…

Page 48: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 48

Copyright © 2007-9 by Leong Hon Wai

Manipulation with Logical Expressions

q  Can manipulate / simplify logical expression v  subject to Algebraic Laws (Boolean algebra)

q Examples: v Commutative Laws

◆  (A + B) = (B + A) ◆  A • B = B • A (Note: shorthand A • B as AB)

v Associative Laws ◆ A + (B + C) = (A + B) + C ◆ A • (B • C) = (A • B) • C

v Distributive Laws ◆ A • (B + C) = (A • B) + (A • C) ◆ A + (B • C) = (A+B) • (A+C)

Complementary Law: Given any boolean law, change all “+” to “•”, and change all “•” to “+”, and change all “1” to “0” and change all “0” to “1” to get the complementary law.

Page 49: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 49

Copyright © 2007-9 by Leong Hon Wai

Prove Laws by using Truth Tables

q Can use truth tables to prove laws v  ~(A+B) = (~A) • (~B) [DeMorgan’s Law]

A B A+B ~(A+B) 0 0 0 1 0 1 1 0 1 0 1 0 1 1 1 0

A B ~A ~B ~A • ~B 0 0 1 1 1 0 1 1 0 0 1 0 0 1 0 1 1 0 0 0

Page 50: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 50

Copyright © 2007-9 by Leong Hon Wai

HW: Prove the following laws…

q Using Truth tables or otherwise, prove v  ~(A • B) = ~A + ~B [DeMorgan’s Law] v  ~(A + B) = ~A • ~B [DeMorgan’s Law] v A • (B + C) = (A • B) + (A • C) [Distributive Law] v A + (B • C) = (A+B) • (A+C) [Distributive Law] v A + (A • B) = A [Absorption Law] v A • (A + B) = A [Absorption Law] v A + ~A = 1; A • ~A = 0; v A • 1 = A; A + 0 = A; v A • 0 = 0; A + 1 = 1; v A • A = A; A + A = A;

Use these laws to simplify your circuits.

Page 51: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 51

Copyright © 2007-9 by Leong Hon Wai

More Basic Logic Gates

q XOR Gate

q NAND Gate

A B XOR 0 0 0 0 1 1 1 0 1 1 1 0

A B NAND 0 0 1 0 1 1 1 0 1 1 1 0

A B A NAND B

A B A ⊕ B

Question: How many types of basic logic gates do we really need?

Page 52: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 52

Copyright © 2007-9 by Leong Hon Wai

Logical Completeness

{ +, •, ~ } is logically complete

{ •, ~ } is logically complete (p + q) = ~( (~p) • (~q) )

{ +, ~ } is logically complete

{ +, • } is NOT logically complete

{ NAND } is logically complete (p NAND p) = (~p) (~p NAND ~q) = (p + q)

Page 53: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 53

Copyright © 2007-9 by Leong Hon Wai

Building Computer Circuits: Introduction

q Read [SG3]-Ch. 4.4.2 CAREFULLY.

q A circuit is a collection of logic gates: v Transforms a set of binary inputs into a set of

binary outputs v Values of the outputs depend only on the current

values of the inputs

q Combinational circuits have no cycles in them (no outputs feed back into their own inputs)

Page 54: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 54

Copyright © 2007-9 by Leong Hon Wai

Figure 4.19

Diagram of a Typical Computer Circuit

Page 55: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 55

Copyright © 2007-9 by Leong Hon Wai

q  Truth Table à Boolean Expression à Logic Circuits

A Circuit Construction Algorithm

Fig. 4.21: The Sum-of-Products Circuit Construction Algorithm

Page 56: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 56

Copyright © 2007-9 by Leong Hon Wai

q The “Sum-of-products" algorithm v Truth table captures every input/output possible for

circuit

v Repeat process for each output line ◆ Build a Boolean expression using AND and NOT for

each 1 of the output line ◆ Combine all the expressions with ORs ◆ Build circuit from whole Boolean expression

A Circuit Construction Algorithm (cont…)

Page 57: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 57

Copyright © 2007-9 by Leong Hon Wai

From Truth Table à Logic Circuits

q Each row in the table is a logical term v X = A(~B)C + AB(~C) + ABC

= A(~B)C + AB(~C + C) = A(~B)C + AB

A B C Output X 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 1 A(~B)C 1 1 0 1 AB(~C) 1 1 1 1 ABC

Output function:

X = A(~B)C +

AB(~C) +

ABC

Boolean Simplification

Page 58: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 58

Copyright © 2007-9 by Leong Hon Wai

Circuit Design & Construction

q Two examples: v Compare-for-equality circuit (comparator) v Addition circuit (adder)

REMARKS: Both circuits can be built using the “sum-of-products” algorithm and top-down decomposition.

Page 59: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 59

Copyright © 2007-9 by Leong Hon Wai

Comparator Circuit

(checking A = B)

Page 60: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 60

Copyright © 2007-9 by Leong Hon Wai

Comparator Circuit q  Given two n-bit strings, A and B

v  A = (an-1, …,a1, a0) and B = (bn-1, …,b1, b0) q  Is A = B ?

v  All the corresponding bits must be equal v  Namely, a0= b0, a1= b1,…, an-2= bn-2, an-1= bn-1,

q  First, look at some small examples

a0 1-CE b0

a1 1-CE b1

2-bit comparator

a0 1-CE b0

1-bit comparator

Recurring Principle: The Use of Top-Down Design

Page 61: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 61

Copyright © 2007-9 by Leong Hon Wai

A 4-bit Comparator Circuit

a1 1-CE b1

a0 1-CE b0

a2 1-CE b2

a3 1-CE b3

4-input AND

4-bit comparator

Recurring Principle: The Use of Top-Down Design

Constructed by suitably combining simpler circuits

4-CE is made-from 1-CE’s

Page 62: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 62

Copyright © 2007-9 by Leong Hon Wai

q  1-CE circuit truth table

a b Output

0 0 1

0 1 0

1 0 0

1 1 1

A Compare-for-Equality Circuit (cont.)

Output = (~a * ~b) + (a*b)

Page 63: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 63

Copyright © 2007-9 by Leong Hon Wai

Figure 4.22 One-Bit Compare for Equality Circuit

The 1-CE Circuit

Page 64: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 64

Copyright © 2007-9 by Leong Hon Wai

Addition Circuit

(C = A + B)

A and B are n-bits long, C is also n-bits long

Page 65: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 65

Copyright © 2007-9 by Leong Hon Wai

Adding two Binary Numbers…

q  Similar to those for decimal # (simpler) v  Actually, use the same algorithm!

q  First, how to add two 1-bit numbers, v  0 + 0 = 0 v  0 + 1 = 1 v  1 + 0 = 1 v  1 + 1 = 0 (with carry 1)

q  Then, what about adding three bits?

q  Adding two 8-bit numbers: (DIY first) 101101100 110101010

Page 66: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 66

Copyright © 2007-9 by Leong Hon Wai

An Addition Circuit (simple one)

What is an Addition circuit? v Adds two unsigned n-bits binary integers A, B, v Produce unsigned n-bit binary integer S,

and an overflow bit (indicate if overflow occurred)

Built with top-down design v Based on 1-bit adder circuit (1-ADD) v  Start from right-most bits, each 1-ADD produces ◆  A value for the sum-bit ◆  A carry bit for next position to the left

Page 67: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 67

Copyright © 2007-9 by Leong Hon Wai

Figure 4.24: The 1-ADD Circuit and Truth Table

Design of the 1-ADD circuit

The 1-ADD Circuit: 3 input lines (ai, bi, ci) 2 output lines (si and ci+1) DESIGN: DIY (HW)

Page 68: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 68

Copyright © 2007-9 by Leong Hon Wai

Design of the 1-ADD circuit

q The 1-ADD circuit: v  Input: Ai Bi Ci v Output: Si Ci+1 v Design: DIY HW problem

Ai Ci

Ci+1 Si

Bi

Ai Bi Ci Si (sum) Ci+1 (carry) 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1

Page 69: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 69

Copyright © 2007-9 by Leong Hon Wai

q Building the full adder

v Put rightmost bits into 1-ADD, with zero for the input carry

v  Send 1-ADD’s output value to output, and put its carry value as input to 1-ADD for next bits to left

v Repeat process for all bits

An Addition Circuit (continued)

Page 70: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 70

Copyright © 2007-9 by Leong Hon Wai

Design of an n-bit Full-Adder

q A full n-bit Adder consists of v  consists of n 1-ADD circuits in stages v  eg: A 4-bit Full-Adder ◆ consists of 4 “1-ADD” circuits

v  (An example of design decomposition)

A3 C3

C4 S3

B3 A2 C2

C3 S2

B2 A1 C1

C2 S1

B1 A0 C0

C1 S0

B0

Page 71: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 71

Copyright © 2007-9 by Leong Hon Wai

Next, Control Circuits

Page 72: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 72

Copyright © 2007-9 by Leong Hon Wai

Control Circuits

q Do not perform computations q Choose some operation or select data line q Major types of controls circuits

v Multiplexors ◆ Select one of inputs to send to output

v Decoders ◆ Sends a 1 on one output line, based on what input line

indicates

Page 73: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 73

Copyright © 2007-9 by Leong Hon Wai

Figure 4.28 A Two-Input Multiplexor Circuit

Output = ~S0*D0 + S0*D1

D0

D1

S0

S0 (Selector) Output 0 D0 1 D1

Two-Input Multiplexor Circuit (MUX)

Page 74: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 74

Copyright © 2007-9 by Leong Hon Wai

q Multiplexor form v  2N regular input lines (D0, D1, … , Dmax) v N selector input lines (S0, …, SN-1) v  1 output line

q Multiplexor purpose v Given a code number for some input, v  Selects that input to pass along to its output

Multiplexor Circuit (general)

Page 75: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 75

Copyright © 2007-9 by Leong Hon Wai

q Decoder

v Form

◆ N input lines

◆ 2N output lines

v N input lines indicate a binary number, which is used to select one of the output lines

v  Selected output sends a 1, all others send 0

Next: A Decoder Circuit

Page 76: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 76

Copyright © 2007-9 by Leong Hon Wai

Figure 4.29

A 2-to-4 Decoder Circuit

S1 S0 A0 A1 A2 A3

0 0 1 0 0 0

0 1 0 1 0 0

1 0 0 0 1 0

1 1 0 0 0 1

S0 S1

A1

A2

A3

A0 2-to-4 Decoder Circuit

Page 77: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 77

Copyright © 2007-9 by Leong Hon Wai

q Decoder purpose

v Given a number code for different operations, trigger just that operation to take place

v Numbers might be codes for arithmetic: eg: add, subtract, etc.

v Decoder signals which operation to perform

Control Circuits (continued)

Page 78: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 78

Copyright © 2007-9 by Leong Hon Wai

Sequential Circuits

q Circuits that can “store” information

q Built using a combination of logic gates v  output depends on the input, and v  the history (state of the circuit). v Can also be represented by its truth table

q Example: v  Initially, Set = Reset = 0 v  Set = 1 à State = 1 v Reset = 1 à State = 0

Set

Reset

Output

Page 79: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 79

Copyright © 2007-9 by Leong Hon Wai

Flip-Flop: When Reset is pressed…

q  The basic S-R flip-flop v  Initially t0, Set = 0; Reset = 0 v  Press Reset=1 momentarily;

for short time duration [t1,t2)

Set

Reset

Out

X

Y Out

Time Status Set Reset X Y Out

t0 Initial 0 0 1 ?? ??

t1 dynamic 0 1 0 0* 0*

t2 dynamic 0 0 1 0* 0*

t3 stable 0 0 1 0 0 When Reset is pressed,

flip-flop internally stores stable value 0

(stores it in Y) Value of Y is stable even after Reset goes back to 0 at t2.

Page 80: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 80

Copyright © 2007-9 by Leong Hon Wai

Flip-Flop: When Set is pressed…

q  The basic S-R flip-flop v  Initially, Set = 0; Reset = 0 v  Press Set=1 momentarily;

for short time duration [t1,t2)

Set

Reset

Out

X

Y Out

Time Status Set Reset X Y Out

t0 Initial 0 0 1 ?? ??

t1 dynamic 1 0 1 1* 1*

t2 dynamic 0 0 1 1* 1*

t3 stable 0 0 1 1 1 When Set is pressed,

flip-flop internally stores stable value 1

(stores it in Y) Value of Y is stable even after Set goes back to 0 at t2.

Page 81: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 81

Copyright © 2007-9 by Leong Hon Wai

Basic Sequential Circuit (A Memory Unit)

Flip Flop (Circuit View) v Two input signals (Set,Reset) v One Output State: 0 or 1 v  3 Gates, 1 internal State Y

Flip Flop (Logical View)

v  1-bit Memory Unit v Press Reset à store value 0 v Press Set à store value 1

Set Flip Flop Reset

1-bit Memory Unit

Set

Reset

Out

X

Y Out

Page 82: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 82

Copyright © 2007-9 by Leong Hon Wai

Chapter Summary

q Digital computers use binary representations of data: numbers, text, multimedia

q Binary values create a bistable environment, making computers reliable

q Boolean logic maps easily onto electronic hardware

q Circuits are constructed using Boolean expressions as an abstraction

q Computational and control circuits may be built from Boolean gates

Page 83: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 83

Copyright © 2007-9 by Leong Hon Wai

q If you are new to all these v  read the textbook [SG]-Chapter 4 v  do the exercises in the book

… The End …

Page 84: Hardware (Part A)leonghw/uit2201/Fa... · " Chapter 4 of [SG]: The Building Blocks of HW " Optional: Chapter 1 of [Brookshear] OUTLINE 1. The Binary Digital Computer Organization

LeongHW, SOC, NUS (UIT2201: Digital Circuits) Page 84

Copyright © 2007-9 by Leong Hon Wai

Thank you!