Oak 1 2 2011
Oak 1 2 2011
Interconnection of
Processor, Memory, I/O
through system Bus
3. System Bus
MAR 0 ...
1 Instruction
MBR 2 Instruction
Cache Instruction
I/O AR Memory
...
I/O BR
Data
I/O Module Data
Data
n
Buffers
3.2. The Computer Function
START
Fetch
Next
Fetch Cycle
Instruction
Execute
Instruction Execute Cycle
HALT
3.2 Function - Fetch and Execute Cycles
• An instruction is fetched to CPU using the address in PC
(Program Counter)
• Unless told otherwise, CPU always increment PC by one
after fetching an instruction. PC points to next instruction.
• Example : For instance PC is set to 300. After a fetch
cycle, the PC is incremented by 1. PC points to location
301. This activity happens at PC unless CPU execute a
jump instruction.
• The fetched instruction is loaded into IR (Instruction
Register) in the CPU. The instruction is in the form of
binary code.
3.2. Function - Fetch and Execute Cycle, continued
0 1 15
S Magnitude
b. Integer Format
Program Counter (PC) = Address of Instruction
Instruction Register (IR) = Instruction being Executed
Accumulator (AC) = Temporary Storage
c. Inter CPU Registers
0001 = Load AC from Memory
0010 = Store AC to Memory
0101 = Add to AC from Memory
d. Partial List of Opcodes
3.2 Function - Example of program execution
Word length = 16 bit, divided into 4 bit op-code (24
different op-codes) and 12 bit address (212 memory
locations).
1. Assume PC contains 300. This content of location 300 is loaded
into IR (First PC to MAR, READ, Memory xfer to MBR and
finally MBR to IR).
2. The first 4 bit in IR indicate that AC is to to be loaded. The next
12 bits (940) specify operand address.
3. PC is incremented, next instruction is fetched
4. Old content of AC & content of location 940 are added, stored
in AC.
5. PC is incremented, next instruction is fetched.
6. The content of AC are stored in location 941.
3.2 Function - execution in hypothetical machine
R2
ALU1 ALU2
R3
ALU
MAR : Memory Addres Register
ALU3 MBR : Memory Buffer Register
IR : Instruction Register
PC : Program Counter
BUS
Instruction Format
IR
R1
MBR
R2
ALU1 ALU2
R3
ALU
MAR : Memory Addres Register
ALU3 MBR : Memory Buffer Register
IR : Instruction Register
PC : Program Counter
BUS
Wait for Memory (3)
Read (2) Control
Unit
PC
MAR
IR
R1
MBR
R2
ALU1 ALU2
R3
ALU
MAR : Memory Addres Register
ALU3 MBR : Memory Buffer Register
IR : Instruction Register
PC : Program Counter
BUS
Control
Unit
PC
MAR
IR
R1
MBR
(4)
R2
ALU1 ALU2
R3
ALU
MAR : Memory Addres Register
ALU3 MBR : Memory Buffer Register
IR : Instruction Register
PC : Program Counter
BUS
Control
Unit
PC
MAR
IR
Addr-op1 Addr2-op2 (5)
R1
MBR
R2
ALU1 ALU2
R3
ALU
MAR : Memory Addres Register
ALU3 MBR : Memory Buffer Register
IR : Instruction Register
PC : Program Counter
BUS
Wait for Memory (7)
Read (6)
Control
Unit
PC
MAR
IR
R1
MBR
R2
ALU1 ALU2
R3
ALU
MAR : Memory Addres Register
ALU3 MBR : Memory Buffer Register
IR : Instruction Register
PC : Program Counter
BUS
Control
Unit
PC
MAR
IR
R1
MBR
(8)
R2
ALU1 ALU2
R3
ALU
MAR : Memory Addres Register
ALU3 MBR : Memory Buffer Register
IR : Instruction Register
PC : Program Counter
BUS
Control
Unit
PC
MAR
Addr1-op1 Addr2-op2
(9) R1
MBR
R2
ALU1 ALU2
R3
ALU
MAR : Memory Addres Register
ALU3 MBR : Memory Buffer Register
IR : Instruction Register
PC : Program Counter
BUS
Read (10) Wait for Memory (11)
Control
Unit
PC
MAR
IR
R1
MBR
R2
ALU1 ALU2
R3
ALU
MAR : Memory Addres Register
ALU3 MBR : Memory Buffer Register
IR : Instruction Register
PC : Program Counter
BUS
Control
Unit
PC
MAR
IR
R1
MBR
(12)
R2
ALU1 ALU2
R3
ALU
MAR : Memory Addres Register
ALU3 MBR : Memory Buffer Register
IR : Instruction Register
PC : Program Counter
BUS
Control
Unit
PC
MAR
IR
R1
MBR
R2
ALU1 ALU2
R3
R2
R3
ALU
MAR : Memory Addres Register
ALU3 MBR : Memory Buffer Register
IR : Instruction Register
PC : Program Counter
BUS
Control
Unit
PC
MAR
R1
MBR
(15)
R2
ALU1 ALU2
R3
ALU
MAR : Memory Addres Register
ALU3 MBR : Memory Buffer Register
IR : Instruction Register
PC : Program Counter
BUS
Write (16) Control
Unit
PC
MAR
IR
R1
MBR
R2
ALU1 ALU2
R3
ALU
MAR : Memory Addres Register
ALU3 MBR : Memory Buffer Register
IR : Instruction Register
PC : Program Counter
BUS
3.2. Interrupt
• Interrupt is a mechanism whereby a
particular computer system component (I/O
devices, Real Time Clock, Memory Unit,
etc) could ask for CPU attention due to
some very important condition occuring
3.2 Interrupts
Table 3.1 : Classes of Interrupts
--------------------------------------------------------------------------
Program Generated by some condition that occurs as a result
of an instruction execution, such as arithmetic
overflow, division by zero, attempt to execute illegal
instruction, reference outside user’s allowed memory
space.
Timer Generated by timer within the processor. This
allows the O/S to perform certain function on regular
basis.
I/O Generated by an I/O controller, to signal normal
completion of an operation or to signal a variety of
error conditions
Hardware Failure Generated by failure, such as power or memory
parity.
-----------------------------------------------------------------------------------------
Interrupts - continued :
0 1 2 3 Interrupt register
I0
To CPU
I1 VAD
Priority x
I2 Encoder y
0
I3
0 Bus
0 Buffers
0
0
Mask
0 1 2 3 register 0
Bus Buffer
Enable line
Mask Register could be set to 0, which disable the possibility of accepting interrupt signal from devices (0 through 3)
IEN is a latch, that may be set by the CPU to enable/disable the acceptance of any interrupt form all devices
Example of Interrupt chain
Disk Printer Floppy Keyboard
0 1 2 3 Interrupt register
1 1
I0
1
0 I1 VAD
1 Priority 1
0
I2 Encoder 1
1
0
0 I3
0 Bus
1
0 Buffers
0
0
Mask
0 1 2 3 register 0
IST IEN
Interrupt to CPU
Device 0 interrupt, mask-bit is 1.
Interrupt signal reach Priority Encoder, going out with device code 11 (in VAD)
Interrupt signal goes further to CPU, using the bottom side of the circuit (red lines)
Example of Interrupt chain
Disk Printer Floppy Keyboard
IE
IST IEN INTACK from CPU
Read
2
Memory
Write N words
3
0
1 Data
Address
Data N-1
Memory Operation - Write
Read Memory
Write 3 N words
0
1
Address
Data N-1
2
3.3. Interconnection Structures - Diagram
3.4 Bus Interconnection
• A bus is a communication pathway connecting two devices
or more.
• Each line in a bus, carries one bit of information
• In the case of single bus, at one one instant, only one
device may transmit information. The information is
available at the bus to be accepted by other devices
(connected to the bus).
• Computer systems contain a number of different buses,
that provide pathways between various components.
• A bus connects CPU, Memory and I/O is called the system
bus.
3.4 Bus Interconnection : Bus Structure
• A system bus, typically consists of 50 - 100 lines. Each
line is assigned a particular meaning or function.
• The lines can be classified into three functions : data,
address and control
• The data line, which carries data in it, may consists of 8,
16, 32 bit or even more (bus width).
• The address lines are used to designate the source or
destination of the data on the bus (also 8, 16 or 32 bits).
• The address width determines the maximum possible
locations in memory can be reached.
• Typically, high-order bit is used to select memory module
3.4 Bus interconnection : Bus Structure, continued
• Example in 8 bit address : 01111111, meaning that it
chooses memory module 0 and address 127 within that
module.
• The control lines, are used to control the access and the use
of data and address lines.
• Typical control lines include : memory read and write, I/O
read and write, transfer ACK,bus request, bus grant,
interrupt, interrupt ACK, clock and reset.
• The operation of the bus : If one module wishes to send
data to another, then (1) obtain the use of bus then (2)
transfer data. If one module to request, then it must (1)
obtain the bus, (2) request the other module to send
3.4 Bus interconnection : Multiple Bus Hierarchy