Lecture-6
Lecture-6
Computer Organization:
Top Level View of Computer Function and
Interconnection
• A sequence of steps
• We have a computer!
Components
• The Control Unit and the Arithmetic and Logic Unit constitute the
Central Processing Unit.
• Data and instructions need to get into the system and results out
• Input/output
• How shall control signals be supplied? The answer is simple but subtle
(not easily grasped).
• This module contains basic components for accepting data and instructions in
some form and converting them into an internal form of signals usable by the
system.
• Similarly, operations on data may require access to more than just one element
at a time in a predetermined sequence. Thus, there must be a place to store
temporarily both instructions and data.
• PC (Program Counter)
• IR (Instruction Register)
• AC (Accumulator-Temporary Register)
• The CPU exchanges data with memory. For this purpose, it typically makes
use of two internal (to the CPU) registers:
• Memory address register (MAR), which specifies the address in memory
for the next read or write
• Memory buffer register (MBR), which contains the data to be written into
memory or receives the data read from memory.
I/O Address and Buffer Registers
• An I/O buffer (I/O BR) register is used for the exchange of data
between an I/O module and the CPU.
Memory Locations and I/O
• A memory module consists of a set of locations, defined by sequentially
numbered addresses.
• An I/O module transfers data from external devices to CPU and memory, and
vice versa. It contains internal buffers for temporarily holding these data until
they can be sent on.
Computer Function
• The basic function performed by a computer is execution of a program,
which consists of a set of instructions stored in memory.
• The instruction execution may involve several operations and depends on the
nature of the instruction. The processing required for a single instruction is
called an instruction cycle.
• The instruction cycle involves two steps which are referred to as the fetch
cycle and the execute cycle.
Program Execution Stop
• Unless told otherwise, the processor always increments the PC after each
instruction fetch so that it will fetch the next instruction in sequence (i.e., the
instruction located at the next higher memory address).
Fetch Cycle
• Program Counter (PC) holds address of next instruction to fetch
• Increment PC
• Unless told otherwise
3. The first 4 bits (first hexadecimal digit) in the IR indicate that the AC is to be
loaded. The remaining 12 bits (three hexadecimal digits) specify the address
(940) from which data are to be loaded.
Example of Program Execution B
4. The next instruction (5941) is fetched from location 301, and the PC is
incremented.
5. The old contents of the AC and the contents of location 941 are added, and
the result is stored in the AC.
6. The next instruction (2941) is fetched from location 302, and the PC is
incremented.
• Operand fetch (of): Fetch the operand from memory or read it in from I/O.
• Operand store (os): Write the result into memory or out to I/O.
Interrupts
• Mechanism by which other modules (e.g. I/O) may interrupt normal
sequence of processing
• Program
• e.g. overflow, division by zero
• Timer
• Generated by internal processor timer
• Used in pre-emptive multitasking
• I/O
• from I/O controller
• Hardware failure
• e.g. memory parity error
Program Flow Control
Interrupt Cycle
• Added to instruction cycle
• Processor checks for interrupt
• Indicated by an interrupt signal
• If no interrupt, fetch next instruction
• If interrupt pending:
• Suspend execution of current program
• Save context
• Set PC to start address of interrupt handler routine
• Process interrupt
• Restore context and continue interrupted program
Transfer of Control via Interrupts
Instruction Cycle with Interrupts
Program Timing
Short I/O Wait
Program Timing
Long I/O Wait
Instruction Cycle (with Interrupts) - State Diagram
Multiple Interrupts
• Disable interrupts
• Processor will ignore further interrupts whilst processing one interrupt
• Interrupts remain pending and are checked after first interrupt has been
processed
• Define priorities
• Low priority interrupts can be interrupted by higher priority interrupts
• Input/Output
• CPU
Computer Modules
Memory Connection
• Write
• Timing
Input/Output Connection(1)
• Similar to memory from computer’s viewpoint
• Output
• Receive data from computer
• Input
• Receive data from peripheral
• Usually broadcast
• Often grouped
• A number of channels in one bus
• Carries data
• Remember that there is no difference between “data” and “instruction”
at this level
• Interrupt request
• Clock signals
Bus Interconnection Scheme
Big and Yellow?
• Ribbon cables
• Sets of wires
Physical Realization of Bus Architecture
Single Bus Problems
• Multiplexed
• Shared lines
• Disadvantages
• More complex control
• Ultimate performance
Bus Arbitration
• Arbiter
• Distributed
• Each module may claim the bus
• Synchronous
• Events determined by clock signals