CS代考 COMP 273

COMP 273
Unit 3 – Circuits, System Board & CPU ~
Lecture 12: Introduction to Circuits and
the System Board
Prof.
COMP 273 Introduction to Computer Systems

Lecture Outline
The Computer
The System Board
The CPU and it’s fetch cycle Data flow
Gates
Truth tables to circuits
(Soul of a )
Mc (c) 2019 2
COMP 273 Introduction to Computer Systems

The Computer
Readings:
– Notes / System Architecture / 1 The System Board
Mc (c) 2019 3
COMP 273 Introduction to Computer Systems

The Computer System
Two controlling software exist within the System Unit: the BIOS (Basic Input Output System) and OS. Used to simplify interconnection.
Mc (c) 2019
4
The CPU and Control hardware are contained within the System Unit. All other items are external devices (called peripherals).
COMP 273 Introduction to Computer Systems

A port is a physical connection between two devices.
Computer Ports
Mc (c) 2019 5
COMP 273 Introduction to Computer Systems

But what is inside the System Unit?
Mc (c) 2019 6
COMP 273 Introduction to Computer Systems

System Board Parts
• Power Supply: Converts the AC/DC from the home into the steady current needed in the PC.
• CPU: Central Processing Unit (The Brain) – Math, Logic, Data movement, loops.
• ROM: Read Only Memory – Used to store built-in instructions (like the CMOS), additional instructions for the CPU.
• Battery: Used to help keep the CMOS parameters (including the time).
• RAM: Random Access Memory – Volatile main memory bank, large and slow.
• Bus: A common road for data that interconnects all devices on the motherboard
• CLK: Clock – Beats the processing cycle (2 of them)
• Slot – Connects to devices external to the system board through
cards
Mc (c) 2019 7
COMP 273 Introduction to Computer Systems

Battery
The System Board
Mc (c) 2019
8
ROM
COMP 273 Introduction to Computer Systems

Mc (c) 2019 9
COMP 273 Introduction to Computer Systems

About slots

Mc (c) 2019 10
COMP 273 Introduction to Computer Systems

System Board Schematic
Data paths (everything is connected) British Galleon Drum Analogy
Battery
Power Supply
Boot CMOS BIOS
RAM
How do all the parts work together? Its all about the Bus…
Mc (c) 2019 11
Bus
CLK
CPU
ROM
COMP 273 Introduction to Computer Systems
— Slots —-

Timing
• System Board Clock (Bus Clock) – Byte (8 bits) movement timing
– Gated (controlled) access to the bus – Regulates data movement
• CPU Clock
– Word (32 bit) movement within the CPU chip
– Instruction & data movement within the CPU chip – Influence does not reach outside of CPU chip
2GHz advertisement is the CPU clock, not System Clock (which is slower).
Mc (c) 2019 12
COMP 273 Introduction to Computer Systems

Binary Counter
Clock
A crystal that when electricity is applied to it, emits a regular pulse of electrons.
Up Tick:
– Computer is only permitted to function at this moment
Period:
– The time between up ticks
– All circuits must complete their action in this period – This is why your CPU clock speed is important
Mc (c) 2019 13
COMP 273 Introduction to Computer Systems

Addressing
Every component on the system board has a unique integer number that identifies it.
With this number we can interact with any component identified in this way.
Addresses are numbered from 0 to n-1.
Mc (c) 2019 14
COMP 273 Introduction to Computer Systems

Communication Pathways
A physical path from a source device address to a destination device address.
The path can be thought of as a wire connecting two devices.
Example: PrinterCablePortCardSlotBusRAM
Mc (c) 2019 15
COMP 273 Introduction to Computer Systems

Used as the
interconnection
point between an external device and the System Board.
Port
The Card
Interconnected
Each line:
One PIN of data (bit)
To Bus
The card contains chips that form the controller of the external device.
Slot
Mc (c) 2019
16
COMP 273 Introduction to Computer Systems

Only one unit of data can use the bus at a time.
The Bus
Component A Component B Component C
Address 000 Address 001 Address 002 888
Each bit is a wire.
This 8-bit bus forms a communication pathway that permits the three components to interact with each other.
8-bit bus
Clock Tick
Mc (c) 2019 17
COMP 273 Introduction to Computer Systems

Examples
• How would a 10 byte string travel from RAM to a slot, assuming the system board schematic?
• If I have a single byte in RAM and a single CPU instruction in RAM that both needed to exit RAM at the same time (one to go to the CPU the other to go to a slot), what would we do? (assuming system board schematic)
• Given the system board schematic, what would happen if the CPU and a slot would need to save a single byte into RAM at the same time?
Mc (c) 2019 18
COMP 273 Introduction to Computer Systems

Optimized Schematic
Power Supply
ROM
CLK CPU
Battery
PCI
Boot CMOS
Mc (c) 2019 19
Bus
CLK
Cache
Data Bus
ISA
RAM
COMP 273 Introduction to Computer Systems
Slots

Optimized System Board
CACHE – a fast but expensive type of RAM. Strategies exist to auto-load cache with needed data and instructions.
PCI Slots – a faster type of slot
ISA Slot – a slower type of slot
CPU – is primarily connected to the cache and PCI slots to increase performance.
Mc (c) 2019 20
COMP 273 Introduction to Computer Systems

Question
• What effect does the two different clocks have on the execution of 10 sequential instructions?
– Without cache (all instructions stored in RAM) – With cache (all instructions stored in the cache)
Mc (c) 2019 21
COMP 273 Introduction to Computer Systems

The 4 Buses
(Industry Standard Architecture vs. Peripheral Component Interconnect)
Mc (c) 2019 22
COMP 273 Introduction to Computer Systems

How does a computer run?
Mc (c) 2019 23
COMP 273 Introduction to Computer Systems

Computer Boot Sequence
Stop Machine
CMOS
Turn on computer BIOS is activated
(complementary metal oxide semiconductor) (Basic Input Output System)
Escape to BIOS menu
Check RAM for errors
Check important peripherals are connected
Error
Display error code
Load OS
Mc to CPU Vybihal (c) 2019 Fetch cycle 24
COMP 273 Introduction to Computer Systems

CPU Fetch Cycle
CPU receives power (all registers are zero)
Interrupt
Notice, an infinite loop !
Execute
Save

Instruction Fetch
(from RAM or Cache)
(IR stores the instruction in the CPU)
Increment to next instruction
(PC = PC + 1)
(Also known as the IP register)
Parameter Fetch
Execute the instruction (Control Unit receives IR)
Save results (Registers or RAM)
Error
Parameters
Mc (c) 2019 25
COMP 273 Introduction to Computer Systems

The CPU
Basic Contents:
ALU
(Arithmetic Logic Unit) (+ – > < ==, etc.) Registers (Fast Live Memory Locations) IP (Instruction Pointer) (or IC, Instruction Counter) (or PC, Program Counter) (points to the next instruction) IR (Instruction Register) (stores the current instruction) On-board Cache (specially constructed for speed) Mc (c) 2019 26 COMP 273 Introduction to Computer Systems We will look at the insides of the CPU in a later lecture. But first, gates and circuits. Readings: • 2 Intro to Circuits Mc (c) 2019 27 COMP 273 Introduction to Computer Systems In C: if (!a && b || c) In Math: a . b +c ~a ^ b v c Logic Mc (c) 2019 28 COMP 273 Introduction to Computer Systems Logic Gate A simple machine with inputs and outputs. This machine follows some basic rules to convert an electrical input into a predefined electrical output. Mc (c) 2019 29 COMP 273 Introduction to Computer Systems Basic Logic Gates Means invert input output Uni-directional (in this case left to right) Mc (c) 2019 30 COMP 273 Introduction to Computer Systems High-level Construction Mc (c) 2019 31 COMP 273 Introduction to Computer Systems Low-level Construction NOT: OR: OR: Output Connector C DL Circuit for OR (Diode-Logic) Mc (c) 2019 32 COMP 273 Introduction to Computer Systems Circuits Gates can be combined together to form more complex systems that have inputs and outputs. These combined gates are “circuits” and convert the inputs into predefined outputs. Circuits are like programming. Mc (c) 2019 33 COMP 273 Introduction to Computer Systems The Water Flow Analogy voltage Water Reservoir Gate (valve) High amps (finger on hose) Low amps X Storage space A circuit is a full circle. Mc passes Vybihal (c) 2019 34 COMP 273 Introduction to Computer Systems Simple Example Circuits NAND How to make a NOR? Executing a circuit a) Set your input wires b) Use water analogy to move bit c) Do gate default behaviour d) repeat until output wire stable Mc (c) 2019 35 COMP 273 Introduction to Computer Systems Example Convert Truth Table into a Circuit ----------------------- INPUTS ---------------------|-- OUTPUT --- A B C D 1 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 1 1 0 0 1 1 What pattern in the output? Mc (c) 2019 36 COMP 273 Introduction to Computer Systems Example Convert Truth Table into a Circuit ----------------------- INPUTS ---------------------|-- OUTPUT --- A B C D 1 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 1 1 0 0 1 1 NAND with C turning it on/off Mc (c) 2019 37 COMP 273 Introduction to Computer Systems Example Convert Truth Table into a Circuit A B C NAND D Mc (c) 2019 38 COMP 273 Introduction to Computer Systems Basic Combinatorial Circuits The following are examples of circuits that are commonly used when building more complicated circuitry. Mc (c) 2019 39 COMP 273 Introduction to Computer Systems Multiplexer Purpose: ● Used as a doorway that permits only the chosen input (x0 or x1) to pass through the output (z). The y bit does the choosing. ● These can be built using more than two inputs but always only one output. x0 x1 Circuit View z Mc (c) 2019 40 x0 x1 z y Switch View x0 x1 z y Symbolic View y Sharing / Merging COMP 273 Introduction to Computer Systems Decoder Purpose: ● Use an integer number to select a single output wire. ● The input: binary integer number represented by y0 and y1 (2-bit). ● Output: One wire from x0 or x1 or x2 or x3. ● Decoderscomeinmanysizes:2-4,3-8,4-16,etc. y0 0 x0 1 x1 2 x2 3 x3 y0 y1 y1 2-4 Decoder Binary number triggers 1 output line x0 x1 x2 x3 Mc (c) 2019 41 Selecting (addressing) COMP 273 Introduction to Computer Systems Encoder Purpose: ● Assume each input wire has a unique ID number. ● This circuit outputs the ID number of the active input wire as a binary number. ● Input:onlyonecanbeactive- x0 orx1 orx2 orx3 ● Output: the ID number for the wire or an inactivity signal. ● Manyencodersizesexist–4-pin,8-pin,16-pin,etc. x0 x1 x2 x3 x0 x1 x2 x3 Inactive? Active? y1 y0 4-pin encoder y1 y0 Mc (c) 2019 42 Generate code COMP 273 Introduction to Computer Systems Binary Code Decimal Example Assume we have a 4-bit binary number as input. How can we convert that to a single digit display? Mc (c) 2019 43 COMP 273 Introduction to Computer Systems DIGIT INPUT: abcd 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 OUTPUT: 0123456 1111110 0110000 etc All machines have a power in plug. A bit when set to 1 can turn on a machine. Inputs and Outputs Mc (c) 2019 44 COMP 273 Introduction to Computer Systems Splitting and Merging Step 1 – Use a decoder Use a decoder to convert the 4-bit integer number into a single wire that represents the input number. Step 2 – Split using water-flow analogy Split that wire into multiple wires to activate the digital screen. Step 3 – Merge using the or-gate Since many wires may want to activate a segment of the display, use an or-gate to merge those lines to a single line. Mc (c) 2019 45 COMP 273 Introduction to Computer Systems Now Construct the Circuit A more optimal organization of the solution depicted here. Mc (c) 2019 46 COMP 273 Introduction to Computer Systems ROM Mc (c) 2019 47 COMP 273 Introduction to Computer Systems ROM Read Only Memory It stores information, like the ASCII table, which can be quickly accessed by the machine. It can also store logic, which can be executed by the machine at a later time. Mc (c) 2019 48 COMP 273 Introduction to Computer Systems Programmable Combinatorial Parts (PLA, PROM, ROM) Type 1: VIA fuses that can be “blown” given sufficient current. Type 2: VIA anti-fuse that “set” given sufficient current. not connected connected fused (not connected) We program by blowing up fuses in a desired arrangement. Or We program by setting a connection in a desired arrangement. Mc (c) 2019 49 COMP 273 Introduction to Computer Systems Connection Representations Shown as a single line but actually multiple. Fuses blown in a pattern Shown as multiple lines. Mc (c) 2019 50 COMP 273 Introduction to Computer Systems PLA & PAL Mc (c) 2019 51 COMP 273 Introduction to Computer Systems PLA Question Given a 2-bit binary number, use a PLA that sends out a single bit signal for each binary value: 00, 01, 10, 11. (Like a decoder) Mc (c) 2019 52 COMP 273 Introduction to Computer Systems More Questions... • Assume a temperature is stored in a register as a binary number, assume an alarm is on when it receives an input signal. Set the alarm when the temperature is at or above 500. • Numeric key-pad operation with num-lock feature (home, up, pg-up, left, nothing, right, end, down, pg-dn, ins, del, / * - + and enter). Save as num. • Robot obstacle avoidance circuit: motor on/off, left on/off, right on/off, forward sensor, left sensor, and right sensor. Write a circuit that will cause the robot to follow the wall on its left. – What do we need? (equipment, input, output) Mc (c) 2019 53 COMP 273 Introduction to Computer Systems