Tayangan Organisasi Komputer D3 - TK
Tayangan Organisasi Komputer D3 - TK
David Vernon
A Computer ....
Key Concepts
Input: Data Instructions: Software, Programs Output: Information (numbers, words, sounds, images)
Types of Computer
Computer
Watches
Traffic Signals
Personal Computers
Workstations
Engine Management
Televisions
Mainframes
Supercomputers
Telephones
Navigation Devices
Data vs Information
A
2, 4, 23, 30, 31, 36
A
your grade in the exam
Key Concepts
Codes
Data and information can be represented as electrical signals (e.g. Morse code) A code is a set of symbols (such as dots and dashes in Morse code) that represents another set of symbols,
such as the letters of the alphabet, or integers or real numbers, or light in an image, for the tone of a violin
Key Concepts
A circuit is an inter-connected set of electronic components that perform a function Integrated Circuits (ICs)
Combinations of thousands of circuits built on tiny pieces of silicon called chips
Key Concepts
Key Concepts
Bit
Single Binary Digit Can have value 0 or 1, and nothing else A bit is the smallest possible unit of information in a computer
Key Concepts
4 Bits
Key Concepts
Information System
A system that takes data, stores and processes it, and provides information as an output An IS is a computer in use The amount of data can be vast
Key Concepts
Communication System
Communication: the transfer of meaningful information Comprises
a sender (transmitter) a channel over which to send the data a receiver
Key Concepts
Network
Two and usually more communication devices connected together Many connection topologies
Key Concepts
Hardware
The physical (electronic and mechanical) parts of a computer or information system
Software
The programs that control the operation of the computer system
Key Components
More Formally:
Input Output Storage Processor
INPUT
Input Systems
Keyboard
Keyboard
Most common input device QWERTY
INPUT
Input Systems
Keyboard
Mouse
Mouse
Cursor manipulation device Trackball
INPUT
Input Systems
Mouse
Touch Screens
INPUT
Input Systems
Mouse Pen/Stylus
Pens Stylus
INPUT
Input Systems
Mouse Pen/Stylus
INPUT
Input Systems
INPUT
Input Systems
Optical Character Recognition systems Book readers for the blind Automated input of text Can do typewritten text and handwritten block capital Problems with cursive handwriting recognition
Keyboard
Mouse
Touch Screen
Pen/Stylus
Magnetic Ink
Bar Code
INPUT
Input Systems
Sensors
Digital thermometers Accelerometers Strain gauges (weighing scales) ....
Keyboard
Mouse
Touch Screen
Pen/Stylus
Magnetic Ink
Bar Code
Sensors
INPUT
Input Systems
Camera Systems
Surveillance and monitoring Visual inspection Robot guidance Video conferencing
Keyboard
Mouse
Touch Screen
Pen/Stylus
Magnetic Ink
Bar Code
Sensors
INPUT
Input Systems
Voice
Voice recognition Hands-free car-phones Assistance for the disabled
Keyboard
Mouse
Touch Screen
Pen/Stylus
Magnetic Ink
Bar Code
Sensors
Voice
Key Components
Output Systems
OUTPUT
Soft Copy
Modem
Disk or Tape
Hard Copy
OUTPUT
Output Systems
Voice
Soft Copy
Modem
Disk or Tape
Hard Copy
CRT
Flat Panel
Soft Copy
Voice synthesis Music CRT (Cathode Ray Tube) LCD (Liquid Crystal Display)
OUTPUT
Output Systems
Voice
Soft Copy
Modem
Disk or Tape
Hard Copy
CRT
Flat Panel
Modems
Modulator-Demodulator Allows computers to communicate over telephone lines
OUTPUT
Output Systems
Voice
Soft Copy
Modem
Disk or Tape
Hard Copy
CRT
Flat Panel
Disks
Magnetic
Floppy Hard disk
Optical
Storage Devices
Output Systems
OUTPUT
Soft Copy
Modem
Disk or Tape
Hard Copy
Voice
CRT
Flat Panel
Plotters
Microfilm
Non-impact Printers
Impact Printers
Output Systems
OUTPUT
Soft Copy
Modem
Disk or Tape
Hard Copy
Voice
CRT
Flat Panel
Plotters
Microfilm
Non-impact Printers
Impact Printers
Output Systems
OUTPUT
Soft Copy
Modem
Disk or Tape
Hard Copy
Voice
CRT
Flat Panel
Plotters
Microfilm
Non-impact Printers
Impact Printers
Output Systems
Soft Copy Modem
OUTPUT
Disk or Tape
Hard Copy
Voice
CRT
Flat Panel
Plotters
Microfilm
Non-impact Printers
Impact Printers
Dot matrix
Line Printer
Key Components
Storage Systems
STORAGE
Units of Storage
Temporary MEMORY
Storage Systems
STORAGE
Memory
Temporary MEMORY
Stores the bits and bytes (instructions and data) ROM ROM - Read Only Memory
Non-volatile Wont disappear when power is off
RAM
STORAGE
Storage Systems
Temporary MEMORY
Optical Disks
ROM
RAM
Optical
Magnetic
15,000 tracks per inch Digital code read by laser 650 Mbytes in a 4.75 plastic platter CD ROM; WORM; Erasable Disks
STORAGE
Storage Systems
Temporary MEMORY
CD ROM
ROM
RAM
Optical
Magnetic
CD Read Only Memory 12cm optical disk Capable of storing 72 minutes of VHS quality video using MPEG compression
STORAGE
Storage Systems
Temporary MEMORY
ROM
RAM
Optical
Magnetic
Powerful laser burns in the digital code Not erasable Lowe power laser reads the digital pattern
Eraseable CD
Lasers read and write inofrmation Also use a magnetic material To write: a laser beam heats a tiny spot and a magnetic field is applied to reverse the magnetic polarity
STORAGE
Storage Systems
ROM
Temporary MEMORY
RAM
Optical
Magnetic
Disk
Memory Card
Magnetic Disk
A circular platter coated with magnetic material
Tape
Floppy Disk
3.5; 360kbyte to 2.88Mbytes (1.44 is common)
Hard Disk
1.3, 1.8, 2.5, 3.5, 5.25; 120Mbytes to over 6 Gigabyte (6 Gbyte)
STORAGE
Storage Systems
ROM
Temporary MEMORY
RAM
Optical
Magnetic
Disk
Memory Card
Tape
650 Mbyte CD
325,000 pages of text
17 Gbyte DVD
8,500,000 pages of text
STORAGE
Storage Systems
ROM
Temporary MEMORY
RAM
Optical
Magnetic
Disk Tape
Memory Card
Smoke Particle
250 millionths of an inch
Fingerprint
620 millionths of an inch
Dust particle
1500 millionths of an inch
Human hair
3000 millionths of an inch
Key Components
Processing Unit
Hardware
Hardware
Software
Microprocessor
Effects computation Intel 80486, 80586 Motorola 68040 PowerPC, MIPS, Alpha, Sparc Clock speeds 50-600MHz (+)
Microprocessor Memory Interface ICs
Memory
Storage
Interface ICs
communication with other devices
Copyright 2007 David Vernon (www.vernon.eu)
Processing Unit
Hardware
Hardware Software
Software
Software
System Software
Application Software
Operating Systems
Programming Languages
General Purpose
Special Purpose
Software
Operating Systems
System Software
Application Software
Operating Systems
Programming Languages
General Purpose
Special Purpose
User interfaces
Software which is responsible for passing information to and from the person using the program (the user) Communicates with and controls the computer Three types of user interface:
Graphic user interfaces Menu driven interfaces Command driven interfaces
Software
Operating Systems
Graphic User Interfaces (GUIs)
System Software
Application Software
Operating Systems
Programming Languages
General Purpose
Special Purpose
Pictures, graphic symbols (icons), to represent commands Windows: a way of looking in on several applications at once
Software
Operating Systems
System Software
Application Software
Operating Systems
Programming Languages
General Purpose
Special Purpose
Menu-driven interfaces
Menu bar Pull-down menu for choices
Software
Operating Systems
System Software
Application Software
Operating Systems
Programming Languages
General Purpose
Special Purpose
Command-driven interfaces
A (system) prompt User types in single letter, word, line which is translated into an instruction for the computer For example: cp source destination Need to be very familiar with the syntax (grammar) of the command language
Software
Software
System Software
Application Software
Operating Systems
Programming Languages
General Purpose
Special Purpose
Operating Systems
Operating System is the software that manages the overall operation of the computer system Main purpose is to support application programs Hide details of devices from application programs
Software
Operating Systems
Shell Network I/F
System Software
Application Software
Operating Systems
Programming Languages
General Purpose
Special Purpose
Task Scheduler
Kernel
Shell (or user interface) Network interface: coordinate multiple tasks in a single computer Task scheduler coordination of multiple tasks in a single computer Kernel
Software which ties the hardware to the software, and manages the flow of information to and from disks, printers, keyboards, ... all I/O devices
Operating Systems
File Handling
Collection of information (stored on disk) Disks need to be formatted to allow them to store information OS manages location of files on disk OS performs I/O to disk OS checks and corrects errors on disk I/O
Operating Systems
Device Drivers
Programs which handle the various hardware devices, e.g., mouse, keyboard, CD, video, etc. For example, an application wants to print a document
It call the operating system which sends the information to the device driver together with instructions and the printer driver handles all the control of the printer
Operating Systems
Single tasking OS
Runs only one application at a time
Multi-Tasking OS
More than one application can be active at any one time
Operating Systems
Operating Systems
Windows
GUI Can run DOS programs Has network services Has multimedia extensions Requires large amounts of memory, disk space, powerful processor Designed for the Intel 80X86 processors
Operating Systems
Macintosh OS
Multi-tasking GUI called finder Very easy to use Very graphically oriented Has network services Has multimedia extensions Designed for the Motorola and PowerPC processors
Software
Application Software
System Software
Application Software
Operating Systems
Programming Languages
General Purpose
Special Purpose
Special Purpose
Payroll Accounting Book-Keeping Entertainment Statistical Analysis
Software
Application Software
System Software
Application Software
Operating Systems
Programming Languages
General Purpose
Special Purpose
General Purpose
Word Processing (e.g. MS Word) Desktop Publishing (e.g. Quark Xpress) Spreadsheets (e.g. MS Excel) Databases (e.g. MS Access) Graphics (e.g. MS Powerpoint) E-mail (e.g. MS Mail) Internet Browsers (e.g. Firefox, Explorer)
Software
Application Software
System Software
Application Software
Operating Systems
Programming Languages
General Purpose
Special Purpose
Integrated Software
Goal: effective sharing of information between all applications For example: MS Office: Excel, Word, Powerpoint, Access can all use each others data directly
Software
Application Software
System Software
Application Software
Operating Systems
Programming Languages
General Purpose
Special Purpose
Integrated Software
Object Linking & Embedding (OLE) Information is stored in one location only Reference is made to it from another application This reference is known as a link Dont actually make a copy (cf. hypertext, multimedia, WWW)
Application Software
The Processor
The processor is a functional unit that interprets and carries out instructions Also called a Central Processing Unit (CPU) Every processor has a unique set of operations LOAD ADD STORE
The Processor
This set of operation is called the instruction set Also referred to as machine instructions The binary language in which they are written is called machine language
The Processor
An instruction comprises
operator (specifies function) operands - (data to be operated on)
The Processor
If the data (e.g. the number to be added) is in memory, then the operand is called an address ADD num1 num2 num1 could be a number or it could be the address of a number in memory (i.e. where the number is stored)
The Processor
The Processor
This step-by-step operation is repeated over and over at speeds measured in millionths of a second The CLOCK governs the speed: each step must wait until the clock ticks to begin a 300 MHz processor will use a clock which ticks 300 000 000 times a second
Supervises the operation of the processor Makes connections between the various components Invokes the operation of each component Can be interrupted!
An interrupt
is a signal which tells the control unit to suspend execution of its present sequence of instructions (A) and to transfer to another sequence (B) resuming the original sequence (A) when finished with (B)
An Interrupt
Instruction A1 Instruction A2 Instruction A3 Instruction A4 Instruction A5 : : Instruction B1 Instruction B2 : : Instruction Bn
Receives instructions from memory Decodes them (determines their type) Breaks each instruction into a sequence of individual actions (more on this later) And, in so doing, controls the operation of the computer.
ALU Provided the computer with its computational capabilities Data are brought to the ALU by the control unit ALU performs the required operation
Arithmetic operations
addition, subtraction, multiplication, division
Logic operations
make a comparison (CMP a, b) and take action as a result (BEQ same)
Registers
ALU registers:
store data items store results
Copyright 2007 David Vernon (www.vernon.eu)
Registers
16 to 64 bits word lengths are common 32 bit processor ... the operand registers of a processor are 32 bits wide (long!)
Specialized Processors
Math co-processors
Real number arithmetic
Main Components
Main Components
Main Components
Register
Capable of receiving data, holding it, and transferring it as directed by the control unit
Adder
Receives data from two or more sources, performs the arithmetic, and sends the results to a register
Counter
Counts the number of times an operation is performed
Registers
CPU
Copyright 2007 David Vernon (www.vernon.eu)
Instructions are coded as a sequence of binary digits Data are coded as a sequence of binary digits Registers are simply physical devices which allows these codes to be stored Memory is just the same
A := B + C A computer cant evaluate this directly (because its not written in a way which matches the structure of the computers physical architecture) First, this must be translated into a sequence of instructions which the does match the computer architecture
A := B + C So ... we need a detailed processor architecture (i.e. a machine) and a matching language (machine language or assembly language)
machine language when its written as a binary code assembly language when its written symbolically.
Registers
CPU
Copyright 2007 David Vernon (www.vernon.eu)
AR
DR
PC IR
ALU
DR - Data Register AR - Address Register AC - Accumulator PC - Progam Counter IR - Instruction Register ALU - Arithmetic Logic Unit PCU - Program Control Unit
AR
DR
PC IR
ALU
AR
DR
PC IR
ALU
AR
DR
PC IR
ALU
AR
DR
PC IR
ALU
AR
DR
PC IR
ALU
Instruction Format
Instruction Format
Load X
puts contents of memory location X into the accumulator
Add T
Add contents of memory at location T to the contents of the accumulator
Store Y
Put contents of accumulator into memory at location Y
Evaluate an Assignment
Load B
Input CPU
A 11111111
B 01001100
C 00000001 Output
AR
DR ALU
PC IR
AC
01001100
Add C
Input CPU
A 11111111
B 01001100
C 00000001 Output
AR
DR ALU
PC IR
AC
01001101
Store A
Input CPU
A 01001101
B 01001100
C 00000001 Output
AR
DR ALU
PC IR
AC
01001101
But .....
AR
DR ALU
PC IR
So .....
Evaluate an Assignment
Load B
Load B
Input CPU
A 11111111
B 01001100
C 00000001
AR
DR ALU
PC IR Load B
Load B
Load B
Input CPU
A 11111111
B 01001100
C 00000001
AR
DR ALU
PC IR Load B
AC
01001100
Load B
Add C
Input CPU
A 11111111
B 01001100
C 00000001
AR
DR ALU
PC IR Add C
AC
01001100
Load B
Add C
Input CPU
A 11111111
B 01001100
C 00000001
AR
DR ALU
PC IR Add C
AC
01001101
Load B
Store A
Input CPU
A 11111111
B 01001100
C 00000001
AR
DR ALU
PC IR Store A
AC
01001101
Load B
Store A
Input CPU
A 01001101
B 01001100
C 00000001
AR
DR ALU
PC IR Store A
AC
01001101
AR
DR ALU
PC IR
The primary function of a processor is to execute sequences of instructions stored in main memory Instruction Cycle
Fetch Cycle Execute Cycle
Instruction Cycle
Fetch Cycle
Fetch instruction from memory
Execute Cycle
Decode instruction Fetch required operands Perform operation
Instruction Cycle
Instruction cycle comprises a sequence of micro-operations each of which involves a transfer of data to/from registers
Instruction Cycle
In addition to executing instructions the CPU supervises other system component usually via special control lines It controls I/O operations (either directly or indirectly) Since I/O is a relatively infrequent event, I/O devices are usually ignored until they actively request service from the CPU via an interrupt
An Interrupt
Instruction A1 Instruction A2 Instruction A3 Instruction A4 Instruction A5 : : Instruction B1 Instruction B2 : : Instruction Bn Interrupt is activated by an electronic signal EXECUTE instructions BRANCH to new set of instructions
Copyright 2007 David Vernon (www.vernon.eu)
START Instruction Awaiting Execution? NO YES Fetch next instruction Execute next instruction Interrupts requiring servicing? NO YES Transfer control to interrupt handling program
Copyright 2007 David Vernon (www.vernon.eu)
Instruction Cycle
PROGRAM TRANSFER
Main Program
Subroutine A
Interrupt Handler
DR
Data Register; acts as a buffer between CPU and main memory. It is used as an input operand register with accumulator to facilitate operations of the form AC f(AC, DR)
PC
Program Counter Stores address of the next instruction to be executed
IR
Instruction Register Holds the opcode of the current instruction
AR
Address Register Holds the memory address of an operand
AB
transfer contents of storage location B to A (copy operation)
AM(ADR)
transfer contents of memory at location ADR to location A
START CPU Activated? YES AR PC DR M(AR) IR DR(opcode) increment PC decode instruction ADD instruction? NO STORE instruction? NO
FETCH CYCLE
START
EXECUTE CYCLE
NO
Evaluate an Assignment
A := B + C
Load B Add C Store A
A := B + C
Load B
AR PC DR M(AR) IR DR(opcode) Increment PC Decode instruction in IR AR DR(address) DR M(AR) AC DR
FETCH
EXECUTE
A := B + C
Add C
AR PC DR M(AR) IR DR(opcode) Increment PC Decode instruction in IR AR DR(address) DR M(AR) AC AC + DR
FETCH
EXECUTE
A := B + C
Store A
AR PC DR M(AR) IR DR(opcode) Increment PC Decode instruction in IR AR DR(address) DR AC M(AR) DR
FETCH
EXECUTE
Load B
Input CPU
AR PC
A 11111111 B 01001100 C 00000001
AR
DR ALU
PC IR
Load B
Input CPU
DR M(AR)
A 11111111 B 01001100 C 00000001
AR
DR
Load B ALU
PC IR
Load B
Input CPU
IR DR(opcode)
A 11111111 B 01001100 C 00000001
AR
DR
Load B ALU
PC IR Load
Load B
Input CPU
Increment PC
A 11111111 B 01001100 C 00000001
AR
DR
Load B ALU
PC IR Load
Load B
Input CPU
Decode Instruction
A 11111111 B 01001100 C 00000001
AR
DR
Load B ALU
PC IR Load
Load B
Input CPU
AR DR(address)
A 11111111 B 01001100 C 00000001
AR
DR
Load B ALU
PC IR Load
Load B
Input CPU
DR M(AR)
A 11111111 B 01001100 C 00000001
AR
DR
01001100 ALU
PC IR Load
Load B
Input CPU
AC DR
A 11111111 B 01001100 C 00000001
AR
DR
01001100 ALU
PC IR Load
AC
01001100
Extensions
Additional addressable registers for storing operands and addresses If these are multipurpose, we have what is called a General Register Organization Sometimes special additional registers are provided for the purpose of memory address construction (e.g. index register)
Copyright 2007 David Vernon (www.vernon.eu)
Extensions
The capabilities of the ALU circuits can be extended to include multiplication and division The ALU can process floating point (real) numbers as well as integers Additional registers can be provided for storing instructions (instruction buffer)
Extensions
Special circuitry to facilitate temporary transfer to subroutines or interrupt handling programs and recovery of original status of interrupted program on returning from interrup handler e.g. the use of a push-down stack implies that we need only a special-purpose stack pointer register
Extensions
Parallel processing Simultaneous processing of two or more distinct instructions or data streams
Information Representation
Types of data
Text Numbers
Integers Reals (floating point numbers)
Text
ASCII code (American Standard Committee on Information Interchange) A unique 8-bit binary code for each character:
A-Z, a-z, 1-9, .,!$$%^&*()_+ Special unprintable characters such as the ENTER key (CR for carriage return)
Numbers
Binary number representation of integers If we save one bit to signify positive (+) or negative (-), then an n-bit binary word can represent integers in the range -2n-1 -1 .. +2n-1
Numbers
For example, a 16-bit binary number can represent integers in the range -216-1 -1 .. +216-1 = -215 -1 .. +215 -32,767 .. +32,768
Numbers
Numbers
Numbers
If we let the most significant bit (MSB) signify positive or negative numbers (1 for negative; 0 for positive) Then +9 = 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 -9 = 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 +9 + (-9) = 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 Which is NOT zero .... a problem!
Numbers
So we need a different representation for negative numbers Called 2s-complement Take the 1s-complement of the positive number: 0000 0000 0000 1001 becomes 1111 1111 1111 0110
Numbers
Note that the addition of the 1s-complement and the original number is not zero 0000 0000 0000 1001 + 1111 1111 1111 0110 __________________________ 1111 1111 1111 1111
Numbers
To get the 2s-complement, add 1 1111 1111 1111 0110 + 1 __________________________ 1111 1111 1111 0111
Numbers
Now do the addition: 0000 0000 0000 1001 + 1111 1111 1111 0111 __________________________ 0000 0000 0000 0000
Numbers
Another example: +1 + (-1) 0000 0000 0000 0001 + 1111 1111 1111 1111 __________________________ 0000 0000 0000 0000
Numbers
Short-hand for all these 1s and 0s HEX notation Each group of 4 bits represents a number in the range 0 - 15
Numbers
0000= 0001= 0010= 0011= 0100= 0101= 0110= 0111= 0 1 2 3 4 5 6 7 1000= 1001= 1010= 1011= 1100= 1001= 1110= 1111= 8 9 A B C D E F
Numbers
Thus: 0000 0000 0000 1001 1111 1111 1111 0111 __________________________ 0000 0000 0000 0000 0009 FFF7 ____ 0000
Numbers
And: 0000 0000 0000 0001 1111 1111 1111 1111 __________________________ 0000 0000 0000 0000 0001 FFFF ____ 0000
Numbers
Hex is used as a notation for any sequence of bits (e.g. ASCII characters require just two hex digits)
Digital Design
Design Hierarchy
Many digital systems can be divided into three design levels that form a well-defined hierarchy
Design Hierarchy
The Architecture Level High-level concerned with overall system management The Logic Level Intermediate level concerned with the technical details of the system The Physical Level Low level concerned with the details needed to manufacture or assemble the system
Design Hierarchy
We have already studied the architecture level Now we will address the logic level At the logic level, there are two classes of digital system
Combinational - digital systems without memory Sequential - digital systems with memory
An analogue signal can have any value within certain operating limits For example, in a (common emitter) amplifier, the output (O/P) can have any value between 0v and 10v. A digital signal can only have a fixed number of values within certain tolerances
Amplitude
Time
Copyright 2007 David Vernon (www.vernon.eu)
Amplitude
A digital signal It is a sampled version of the analogue signal Only defined at certain discrete times DISCRETE TIME SIGNAL
Time
Copyright 2007 David Vernon (www.vernon.eu)
Amplitude
Time
Copyright 2007 David Vernon (www.vernon.eu)
Amplitude
The amplitude may also be restricted to take on discrete values only In which case it is said to be quantized
Time
Copyright 2007 David Vernon (www.vernon.eu)
Quantization introduces errors which depend on the step size or the resolution
Amplitude
Time
Copyright 2007 David Vernon (www.vernon.eu)
Amplitude
Signals (voltages or currents) which are samples and quantized are said to be DIGITAL They can be represented by a sequence of numbers
Time
Copyright 2007 David Vernon (www.vernon.eu)
Calculation with numbers is usually done in base 10 arithmetic Easier to effect machine computation in base 2 or binary notation We can also use base 2 or binary notation to represent logic values: TRUE and FALSE Manipulation of these (digital) logic values is subject to the laws of logic as set out in the formal rules of Boolean algebra
Copyright 2007 David Vernon (www.vernon.eu)
Boolean Algebra
Definition: a logic variable x can have only one of two possible values or states
x = TRUE x = FALSE
Boolean Algebra
This is called negative logic or low-true logic Usually we use the positive logic convention
Boolean Algebra
Electrically,
1 is represented by a more positive voltage than zero and 0 is represented by zero volts
Logic Gates
Logic gates are switching circuits that perform certain simple operations on binary signals These operations are chosen to facilitate the implementation of useful functions
Logic Gates
Logic Gates
A 0 0 1 1
B 0 1 0 1
f = A AND B 0 0 0 1
Logic Gates
A B
f= A.B
A and B are variables and note the use of the . to denote AND
Copyright 2007 David Vernon (www.vernon.eu)
Logic Gates
The AND Gate - An example Determine the output waveform when the input waveforms A and B are applied to the two inputs of an AND gate
Logic Gates
The AND Gate - An example Determine the output waveform when the input waveforms A and B are applied to the two inputs of an AND gate
Logic Gates
A + _
B Bulb
Logic Gates
A B f = A OR B 0 0 1 1 0 1 0 1 0 1 1 1
Logic Gates
The OR Gate
A B
f= A+B
Logic Gates
A 0 1
f = NOT A 1 0
Logic Gates
f= A
Logic Gates
AA B
f= A
Logic Gates
In fact it is simpler to manufacture the combination NOT AND and NOT OR than it is to deal with AND and OR NOT AND becomes NAND NOT OR becomes NOR
Logic Gates
A 0 0 1 1
B 0 1 0 1
f = A NAND B 1 1 1 0
Logic Gates
A B
f= A.B
Logic Gates
A B f = A NOR B 0 0 1 1 0 1 0 1 1 0 0 0
Logic Gates
A B
f= A+B
Logic Gates
Logic Gates
A B
f= AB
Logic Gates
Logic Gates
A B
f= AB
Operations on Boolean variables are defined by rules and laws, the most important of which are presented here Commutative Law
A.B=B.A A+B=B+A
Associative Law
A . (B . C) = A . (B . C) A + (B + C) = A + (B + C)
Distributive Law
A . (B + C) = A . B + A . C
This states that we can remove the parenthesis by multiplying through The above laws are the same as in ordinary algebra, where + and . are interpreted as addition and multiplication
Basic rules involving one variable: A+0=AA.0=0 A+1=1 A.1=A A+A=A A.A=A A+A=1A+A=0
An informal proof of each of these rules is easily accomplished by taking advantage of the fact that the variable can have only two possible values For example, rule 2: A+1=1 If A = 0 then 0 + 1 = 1 If A = 1 then 1 + 1 = 1
Some useful theorems A + A.B = A A + A.B = A + B A.B + A.B = A A(A + B) = A A(A + B) = A.B (A+B)(A+B) = A These may be proved in a similar manner
Copyright 2007 David Vernon (www.vernon.eu)
A 0 0 1 1
B 0 1 0 1
A 1 1 0 0
Finally, we come to DeMorgans Laws which are particularly useful when dealing with NAND and NOR logic They are stated as follows
Relates NOT, OR, and AND Can be extended to any number of variables A + B + C ... = A . B . C . ....
A+B=A.B
A 0 0 1 1 B 0 1 0 1 A+B A+B A 0 1 1 1 B A.B
A+B=A.B
A 0 0 1 1 B 0 1 0 1 A+B A+B A 0 1 1 1 1 0 0 0 B A.B
A+B=A.B
A 0 0 1 1 B 0 1 0 1 A+B A+B A 0 1 1 1 1 0 0 0 1 1 0 0 B A.B
A+B=A.B
A 0 0 1 1 B 0 1 0 1 A+B A+B A 0 1 1 1 1 0 0 0 1 1 0 0 B 1 0 1 0 A.B
A+B=A.B
A 0 0 1 1 B 0 1 0 1 A+B A+B A 0 1 1 1 1 0 0 0 1 1 0 0 B 1 0 1 0 A.B 1 0 0 0
Relates NOT, OR, and AND Can be extended to any number of variables A . B . C ... = A + B + C . ....
A.B=A+B
A 0 0 1 1 B 0 1 0 1 A.B 0 0 0 1 A.B A B A+B
A.B=A+B
A 0 0 1 1 B 0 1 0 1 A.B 0 0 0 1 A.B 1 1 1 0 A B A+B
A.B=A+B
A 0 0 1 1 B 0 1 0 1 A.B 0 0 0 1 A.B 1 1 1 0 A 1 1 0 0 B A+B
A.B=A+B
A 0 0 1 1 B 0 1 0 1 A.B 0 0 0 1 A.B 1 1 1 0 A 1 1 0 0 B 1 0 1 0 A+B
A.B=A+B
A 0 0 1 1 B 0 1 0 1 A.B 0 0 0 1 A.B 1 1 1 0 A 1 1 0 0 B 1 0 1 0 A+B 1 1 1 0
DeMorgans Laws
A+B=A.B Let A be I won the Lotto Let B be Im happy The the first DeMorgan Law tell us that: NOT (I won the Lotto OR Im happy) is the same as NOT(I won the lotto) AND NOT(Im happy) [or: I didnt win the lotto and Im not happy]
Copyright 2007 David Vernon (www.vernon.eu)
DeMorgans Laws
A . B = A+ B Let A be I won the Lotto Let B be Im happy The the second DeMorgan Law tell us that: NOT (I won the Lotto AND Im happy) is the same as NOT(I won the lotto) OR NOT(Im happy) [or: I didnt win the lotto OR Im not happy]
Copyright 2007 David Vernon (www.vernon.eu)
DeMorgans Laws
A B
A+B
A B
A.B
DeMorgans Laws
A B
A+B
A B
A.B
A B
A.B
A B
A+B
DeMorgans Laws
Taking the NAND gate as an example, we can derive effective AND-OR gating although physically we are using only one type of gate For example f = A.B + C.D
DeMorgans Laws
A B
C D
C.D
A.B
+ C.D
DeMorgans Laws
A B
C D
C.D
A.B
+ C.D
DeMorgans Laws
This is referred to as NAND/NAND gating Any logic equation may be implemented using NAND gates only Thus NAND gates may be regarded as univeral gates The same is true for NOR gates
DeMorgans Laws
Other advantages of using NAND or NOR gating are: Simplest and cheapest to fabricate Fastest operating speed Lowest power dissipation
It is important to minimise Boolean functions as this often brings about a reduction in the number of gates or inputs that are needed For example: consider AB + A(B+C) + B(B+C)
Consider: (AB(C + BD) + AB)C (ABC + ABBD + AB)C {distribution} ABCC + ABBCD + ABC {distribution} ABC + ABBCD + ABC {X.X = X } ABC + A0CD + ABC {X.X = 0 } ABC + ABC {0.X = 0 } BC(A + A) {distribution} BC {X+X = 1 }
Copyright 2007 David Vernon (www.vernon.eu)
In general: Multiply out and collect common terms Exactly as you would do when simplifying ordinary algebraic expressions
Most real problems are defined using a sentential structure. It is therefore necessary to translate such sentences into Boolean equations if we are to derive a digital circuit to give a Boolean result.
Lets give the clauses some labels, just as before The alarm will ring (f)
IF the alarm switch is on (A) AND the door is open (B), or IF it is after 6pm (C) AND the window is open (D)
f = the alarm will ring = 1, if true; 0 if false A = the alarm switch is on = 1, if true; 0 if false B = the door switch is open = 1, if true; 0 if false C = it is after 6 pm = 1, if true; 0 if false D = the window switch is open = 1, if true; 0 if false So f = A.B + C.D If f = 1, then the alarm will ring!
A (alarm switch) B (door open detector) f (activate alarm) C (after 6 detector!) D (window open detector)
For more complicated problems, we define the problem coherently by constructing a truth table Well introduce the idea for this simple example and then go on to use it in a more complicated example
If we have a problem (or a Boolean expression) with four variables, then our truth table will look like this:
Each combination of the logical variables A, B, C, and D make a 4-bit binary number in the range 0-15 lets number each row with the equivalent decimal number
We could also add the equivalent Boolean expression For example: 0010 is equivalent to A.B.C.D
(in the following we will leave out the . for AND and just write ABCD)
We call each of these product terms a MINTERM Note that each minterm contains each input variable in turn We can express any Boolean expression in minterm form If f is expressed this way, we say it is in
sum of products form 1st Canonical Form
For example, in the case of the alarm circuit, we have: A = the alarm switch is on B = the door switch is open C = it is after 6 pm D = the window switch is open f = 1 = if A(=1) . B(=1) + C(=1) . D(=1) If f = 1, then the alarm will ring!
Then f = m3 + m7 + m11 + m12 + m13 + m14 + m15 Why? Because m3, m7, m11, and m15 are the minterm expressions when both C and D are 1 And m12, m13, and m14 are the minterm expressions when both A and B are 1 And the alarm should ring if any of these expressions occur, i.e., if f = AB + CD
Copyright 2007 David Vernon (www.vernon.eu)
The Cast:
Director of Public Health Systems Dr. Logik
The Scenario:
Overcrowded Public Health Clinic with many obviously ailing clients looking for a diagnosis ... Is it the dreaded Boolean virus? Or just Digital Flu? Or maybe just epidemic paranoia ....
Anybody who hasnt got any of these symptoms doesnt have either Boolean Virus or Digital Flu. Anybody who has NO chill but HAS some of the other symptoms is just suffering from Digital Flu, If there is a chill and a rash only, then its Digital Flu again. its a chill by itself or a chill any any other combination of rash, bloodshot eyes, and fever, then theyve got the Boolean Virus
Copyright 2007 David Vernon (www.vernon.eu)
Available Equipment
6 two-input NAND gates 2 three-input NAND gates 1 four-input NAND gate
We will address the problem in three way, just to compare efficiency and effectiveness: Straightforward (naive) implementation of the condition in gates Efficient implementation of the conditions in gates by simplifying the expressions Function minimization procedure using minterms and Karnaugh maps
Anybody who hasnt got any of these symptoms doesnt have either Boolean Virus or Digital Flu. NOT (A OR B OR C OR D) A+B+C+D Anybody who has NO chill but HAS some of the other symptoms is just suffering from Digital Flu f2 = A . (B + C + D)
If there is a chill and a rash only, then its Digital Flu again. f2 = A . B . C . D its a chill by itself or a chill and any other combination of rash, bloodshot eyes, and fever, (But not the Digital Flu combination of chill and rash only - NB) then theyve got the Boolean Virus f1 = A . B . C . D +A. ( B + C + D) . (B . C . D)
Copyright 2007 David Vernon (www.vernon.eu)
f1 = f1 = A . B . C . D +A. ( B + C + D) . (B . C . D) f2 = A . (B + C + D) f2 = A . B . C . D f1 = A . B . C . D +A. ( B + C + D) . (B . C . D) f2 = A . (B + C + D) + A . B . C . D
Our first implementation of this will be a direct gatingof these two Boolean expressions Note that in all of the following implementations, we will assume that both the value of an input variable (e.g. A or chill) and its logical inverse (e.g. A or NOT chill) are available
f1 = A . B . C . D +A. ( B + C + D) . (B . C . D)
f1
f2 = A . (B + C + D) + A . B . C . D
Corresponding
Digital Circuit
(chill) A (NOT chill) A (rash) B (NOT rash) B (bloodshot eyes) C (NOT bloodshot eyes) C (fever) D (NOT fever) D
Copyright 2007 David Vernon (www.vernon.eu)
f2
These two logic circuits are complicated! Can we do any better? Lets try to simplify the expressions.
f1 = A . B . C . D +A. ( B + C + D) . (B . C . D) f1 = A . B . C . D + (A.B + A.C + A.D).(B + C + D) f1 = A . B . C . D + A.B.B + A.C.B + A.D.B + A.B.C + A.C.C + A.D.C + A.B.D + A.C.D + A.D.D f1 = A . B . C . D + A.0 + A.C.B + A.D.B + A.B.C + A.C + A.D.C + A.B.D + A.C.D + A.D
f1 = A . B . C . D + 0 + A.(C.B + D.B + B.C + C + D.C + B.D + C.D + D ) f1 = A . B . C . D + A.(C.B + D.B + B.C + C + D.C + B.D + D ) f1 = A . B . C . D + A.(C.(B + B) + C + D.(B + C + B + 1 )) f1 = A . B . C . D + A.(C.1 + C + D.1 ) f1 = A . B . C . D + A.(C + D) f1 = A . B . C . D + A.C + A.D
Copyright 2007 David Vernon (www.vernon.eu)
f1 = A . B . C . D +A. ( B + C + D) . (B . C . D)
f1
Digital Circuit
(chill) A (NOT chill) A (rash) B (NOT rash) B (bloodshot eyes) C (NOT bloodshot eyes) C (fever) D (NOT fever) D
Copyright 2007 David Vernon (www.vernon.eu)
f1
That simplification was hard work! Is there an easier way? Yes! We use truth-tables, minterms, and a simplification method known as Karnaugh maps
Anybody who hasnt got any of these symptoms doesnt have either Boolean Virus or Digital Flu Chills Rash Bloodshot Eyes Fever Boolean Virus Digital Flu
0 0 0 0 0 0
Anybody who has NO chill but HAS some of the other symptoms is just suffering from Digital Flu Chills Rash Bloodshot Eyes Fever Boolean Virus Digital Flu
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1
If there is a chill and a rash only, then its Digital Flu again. Its a chill by itself or a chill and any other combination of rash, bloodshot eyes, and fever, (But not the Digital Flu combination of chill and rash only - NB) then theyve got the Boolean Virus
If there is a chill and a rash only, then its Digital Flu again ..... chill and other combinations - BV Chills Rash Bloodshot Eyes Fever Boolean Virus Digital Flu
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 0 0 0 1 0 0 0
A Karnaugh Map is simply another form of truth table Entry of each minterm Arranged in a 2-D array Each variable blocks in half of the array Different half for each variable With a 4-variable expression, we know there are 16 possible combinations or minterms
B= 0
B=1
B= 0
C=0
C=1
D=0
D=1
D=0
A=1
11 10
01
D=1
11
C=1
10
B=1
Copyright 2007 David Vernon (www.vernon.eu)
A=1
11 10
m0 m1 m3 m2
m4 m5 m7 m6
01
11
C=1
10
B=1
Copyright 2007 David Vernon (www.vernon.eu)
AB 00 01
A=1
11 10
m0 C=1 m1
m2 m3
m6 m7
m4 m5
B=1
To simplify a Boolean expression Express it as a (conventional) truth table Identify the minterms that are TRUE Identify the minterms that are FALSE Mark them as such in the Karnaugh Map And then ..........
Identify the least number of variables that are required to unambiguously label that group The simplified expression is then the logical OR of all the terms that are needed to identify each (largest as possible) group of 1s Note: groups may overlap and this sometimes helps when identifying large groups
A=1
11 10
m0 m1 m3 m2
m4 m5 m7 m6
01
11
C=1
10
B=1
Copyright 2007 David Vernon (www.vernon.eu)
f1 = A . B . C . D +A. ( B + C + D) . (B . C . D)
Karnaugh
Maps
AB 00 CD 00 01
A=1
11 10
0 0 0 0
0 0 0 0
0 1 1 1 B=1
1 1 D=1 1 1
01
11
C=1
10
f1 = A . B . C . D +A. ( B + C + D) . (B . C . D)
Karnaugh
Maps
AB 00 CD 00 01
A=1
11 10
0 0 0 0
0 0 0 0
0 1 1 1 B=1
1 1 D=1 1 1
01
11
C=1
10
Karnaugh Maps
Note: This simplification is better than we managed with our hand simplification earlier!!
Digital Circuit
(chill) A (NOT chill) A (rash) B (NOT rash) B (bloodshot eyes) C (NOT bloodshot eyes) C (fever) D (NOT fever) D
Copyright 2007 David Vernon (www.vernon.eu)
f1
f1 = A . B . C . D + A.C + A.D
f1
f1 = A . B . C . D + A.C + A.D
f1
X+Y+Z = X.Y.Z
Exercise
Use a truth table, minterms, and a Karnaugh map to simplify the following expression f2 = A . (B + C + D) + A . B . C . D
f2 = A . (B + C + D) + A . B . C . D
Karnaugh Maps
Row 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 A 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 B 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 C 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 f1 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 f2 0 1 1 1 1 1 1 1 0 0 0 0 1 0 0 0 Minterm m0 m1 m2 m3 m4 m5 m6 m7 m8 m9 m10 m11 m12 m13 m14 m15
f2 = A . (B + C + D) + A . B . C . D
Karnaugh Maps
AB 00 CD 00 01
A=1
11 10
m0 m1 m3 m2
m4 m5 m7 m6
01
11
C=1
10
B=1
Copyright 2007 David Vernon (www.vernon.eu)
f2 = A . (B + C + D) + A . B . C . D
Karnaugh Maps
AB 00 CD 00 01
A=1
11 10
0 1 1 1
1 1 1 1
1 0 0 0 B=1
0 0 D=1 0 0
01
11
C=1
10
f2 = A . (B + C + D) + A . B . C . D
Karnaugh Maps
AB 00 CD 00 01
A=1
11 10
0 1 1 1
1 1 1 1
1 0 0 0 B=1
0 0 D=1 0 0
01
11
C=1
10
(rash) B (NOT rash) B (bloodshot eyes) C (NOT bloodshot eyes) C (fever) D (NOT fever) D
f1
f2
Simplification of Expressions
Sometimes, a minterm never occurs in a system, i.e., the condition given by that minterm never arises In this instance, we can use either 1 or 0 in the Karnaugh map when simplifying expressions In fact, we use the convention that such conditions are dont careconditions and are signified by X rather than 0/1 We use the value 0 or 1 depending on which leads to the simplest expression
Copyright 2007 David Vernon (www.vernon.eu)
BINARY ARITHMETIC
Binary Addition
Half Adder
A digital adder will add just two binary numbers When two binary digits (bits) A and B are added, two results are required:
the sum S the carry C0 to the next place
Half Adder
A HA B
C0 S
Half Adder
Truth Table for addition of two binary digits
A 0 0 1 1
B 0 1 0 1
S 0 1 1 0
C0 0 0 0 1
Half-Adder
Half Adder
C0
Half Adder
A C0
S B
Half Adder
Note that the S output is separated from the inputs by 3 levels of gates
referred to as logical depth of 3
Because of propagation delays, this means that the carry out will be produced before the sum
This may cause problems in some circumstances
Full Adder
In order to add together multiple-digit numbers, we need a slightly more complicated circuit
Need to add the two digits and the carry out from the previous or less significant digit Only in the addition of the right-most digits can we ignore this carry
Full Adder
1 0 1 1 0
Full Adder
The circuit to add three binary digits (two operands and a carry bit) is called a Full Adder (FA) It can be implemented using two half adders
A B Ci
Ci+1 FA S
Copyright 2007 David Vernon (www.vernon.eu)
Full Adder
A HA B Ci
Co S
, , HA S Co ,, Co
Full Adder
add partial sum S and input carry Ci from previous stage to produce
final sum and (the second) intermediate output carry Co
We then need to combine the intermediate carry bits (they dont have to be added)
Full Adder
A B Ci S Co Co Co S A B A B Ci 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1
Copyright 2007 David Vernon (www.vernon.eu)
Full Adder
A B Ci S Co Co Co S A B A B Ci 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1
Copyright 2007 David Vernon (www.vernon.eu)
Full Adder
A B Ci S Co Co Co S A B A B Ci 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 1 0 1 0 0 1
Full Adder
A B Ci S Co Co Co S A B A B Ci 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 0 1 0 1 1 1 0 1 1 0 1 0 0 1
Full Adder
A B Ci S Co Co Co S A B A B Ci 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 0 1 0 1 1 1 0 1 1 0 1 0 0 1 0 0 1 1 1 1 0 0
Full Adder
A B Ci S Co Co Co S A B A B Ci 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 0 1 0 1 1 1 0 1 1 0 1 0 0 1 0 0 1 1 1 1 0 0 0 1 1 0 1 0 0 1
Full Adder
A few observations The truth table demonstrates why Co = Co + Co Its clear also that S = A B Ci Also, we could obtain a simplified expression for Co from a Karnaugh Map Co = A.B + B.Ci + A.Ci
Copyright 2007 David Vernon (www.vernon.eu)
A=1
00 0 01 11 10
C=1
B=1
A=1
00 0 01 11 10
0 0
0 1 B=1
1 1
0 1
C=1
Full Adder
So, instead of implementing a full adder as two half adders, we could implement it directly from the gating: S = A B Ci Co = A.B + B.Ci + A.Ci
Full Adder
Irrespective of the implementation of a full adder, we can combine them to add multiple digit binary numbers
S3 Co Full Adder A3 B3 Ci Co
S2 Co
S1 Co
S0
Full Adder A2 B2 Ci
Full Adder A1 B1 Ci
Half Adder A0 B0