0% found this document useful (0 votes)
20 views36 pages

IT3030E CA Chap2 Computer System and Interconnection

Uploaded by

Thịnh Đặng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views36 pages

IT3030E CA Chap2 Computer System and Interconnection

Uploaded by

Thịnh Đặng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

Computer Architecture

Ngo Lam Trung & Pham Ngoc Hung, Hoang Van Hiep
Department of Computer Engineering
School of Information and Communication Technology (SoICT)
Hanoi University of Science and Technology
E-mail: [trungnl, hungpn, hiephv]@soict.hust.edu.vn

IT3030E Fall 2024 1


Chapter 2: Top-level view of Computer Functions
and Interconnection
1. Computer Components
2. Computer Functions
3. Inter-connection Structures

[with materials from Computer Organization and Architecture, 10th Edition,


William Stallings, ©2016, Pearson]
IT3030E Fall 2024 2
Computer Organization
❑ From Chap.1: classic components of a computer

❑ Computer
❑ Input data
❑ Execute stored programs
❑ Output result

IT3030E Fall 2024 3


1. Computer Components
❑ More detailed computer organization

Memory

Control Input

Processor Link Input/Output

Datapath Output

CPU To/from network I/O


Computer organization with system link

IT3030E Fall 2024 4


Hardware and software approaches
❑ Hardware approach

l For a specific computation:


- Construct the computation function by connecting several basic
logic components: hardwired programming
l New program or new computation → rewiring the hardware
l General computer does not follow this approach

IT3030E Fall 2024 5


Hardware and software approaches
❑ Software approach

l Use a general-purpose hardware taking data and control signals


as input, produce results
l Programing is now much easier, instead of rewiring the
hardware → provide new sequence of codes (instructions)
l Question: where the Data comes from? Where the instructions
come from?
IT3030E Fall 2024 6
Computer components: top-level view

IT3030E Fall 2024 7


CPU (Central Processing Unit)
❑ Control Unit
l Fetch instruction from memory.
l Interpret instruction.
l Control other components to execute instruction.

❑ Datapath: performs arithmetic operations to process data


(i.e., Arithmetic and Logic Unit).
❑ Register file (chapter 3): small and fast data storage for
instruction execution.
❑ Some other dedicated components

IT3030E Fall 2024 8


CPU
❑ Example: Apple A5

IT3030E Fall 2024 9


Memory
❑ Store instructions of the running programs.
❑ Store data that are currently in use.

Further reading: memory technologies


IT3030E Fall 2024 10
Memory
❑ Logical organization
l Array of memory cells
l Each cell holds one byte of data
l Each cell is assigned an unique adress
l Data value can be changed, address is fixed

❑ Data are stored on memory cells


l 8-bit integer requires 1 cell
l 32-bit integer requires 4 cells
l Array requires consecutive cells according to
its size.
l …

IT3030E Fall 2024 11


Input/output
❑ Interfacing computer with physical world/environment.
❑ Types of I/O device
l Input: mouse, keyboard, webcam…
l Output: display, printer, speaker…
l Storage: HDD, SSD, optical, USB drives…
l Communication: WiFi, Ethernet, Bluetooth modules…

IT3030E Fall 2024 12


Link: System interconnection
❑ The fabric to connect all components
❑ Huge number of connection, requires very good design
so that all components function properly

❑ A modern computer motherboard (mainboard) typically


has 4 to 12 layers.
IT3030E Fall 2024 13
2. Computer functions
❑ Executing program
❑ Interrupt
❑ Input/Output

IT3030E Fall 2024 14


2.1 Executing program
❑ ➔ the most basic function of computers.
❑ Program: a set of instructions.
❑ Instruction: a set of binary bits in a predefined format
(usually consist of two main parts: Opcode and
Operands)
❑ Computers execute instructions sequentially.
❑ Instruction cycle: the processing required for a single
instruction execution
l Instruction fetch (fetch cycle): control unit fetches an instruction
from memory
l Instruction execution (execute cycle):
- control unit decodes instruction,
- then “tells” datapath and other components to perform the required
action.
IT3030E Fall 2024 - More details in Chapter 5. 15
Instruction fetch
❑ Questions:
l How does the CPU know which instruction to fetch next?
l Where is the location of the fetched instruction inside CPU?

IT3030E Fall 2024 16


Instruction fetch
❑ Importance
l To get the correct instruction.
l To execute all instructions in a program sequentially.

❑ At the beginning of each instruction cycle the processor


fetches an instruction from memory.
❑ The program counter (PC) holds the address of the
instruction to be fetched.
❑ The processor increases PC after each instruction fetch
so that PC points to the next instruction in sequence.
❑ The fetched instruction is loaded into the instruction
register (IR).

IT3030E Fall 2024 17


Instruction execution
❑ Instruction (fetched and stored in IR) is decoded to get
l The operation that the processor needs to do
l The location to get input data (source operands)
l The location to store output data (destination operand)

❑ Operand address calculation: calculate the address of


operands
❑ Operand fetch: fetch source operands
❑ Data operation: perform the action on source operands
and get result
❑ Operand store: store result into destination operand

IT3030E Fall 2024 18


Types of operation
• Data transferred • Data transferred to
from processor to or from a peripheral
memory or from device by
memory to transferring between
processor the processor and
an I/O module

Processor- Processor-
memory I/O

Data
Control
processing

• An instruction may • The processor may


specify that the perform some
sequence of arithmetic or logic
execution be altered operation on data

IT3030E Fall 2024 19


Example
❑ Consider following hypothetical computer
l The computer contains a single register named AC (16 bits)
l Instruction format: 16 bits, 4 bits for the Opcode (representing 16
different opcodes/instructions)

IT3030E Fall 2024 20


Example
❑ What is the value of AC register in step 2, 3, 4, 5, 6?

Elaboration: How to support branching?


IT3030E Fall 2024 21
Example
❑ Solution

IT3030E Fall 2024 22


2.2 Interrupt
❑ What if CPU operates without interrupt?

❑ Fact: most external devices are much slower than CPU


❑ Suppose that CPU is transferring data with a printer
using above instruction cycle scheme
l After each write operator, CPU must wait until the printer
catches up

IT3030E Fall 2024 23


2.2 Interrupt
❑ The mechanism to allow other components (memory,
I/O) interrupt the normal processing of processor.
❑ Servicing interrupt: processor temporarily switch from the
current program to execute a different (rather short)
program, before continuing the original program.

Elaboration: what is the difference


between servicing interrupt and
calling sub-routines?
IT3030E Fall 2024 24
Example

IT3030E Fall 2024 25


Example

IT3030E Fall 2024 26


CPU time consume when I/O operation time is short
❑ Assume the
I/O operation
time is shorter
than
execution time
of instructions
between two
“WRITE”
instructions in
user program

IT3030E Fall 2024 27


CPU time consume when I/O operation time is long
❑ Assume the I/O
operation time is
longer than
execution time of
instructions between
two “WRITE”
instructions in user
program

IT3030E Fall 2024 28


Sources of interrupt
❑ Typical sources of interrupt:
l Software/program: occurs during instruction execution upon
some special condition such as division by 0, arithmetic
overflow… Can also be called exception.
l Timer: generated by system timer inside processor, to provide
timing service, such as for operating system task scheduler
service.
l I/O: generated by I/O modules, to request service from
processor or acknowledge the completion of an operation.
l Hardware failure: generated when error happens with hardware.

❑ Example: detecting keyboard events (key up/key down)


l Method 1: CPU checks keyboard status frequently
l Method 2: keyboard issue interrupt to notify CPU upon key
up/down
l Which is better regarding CPU usage?

IT3030E Fall 2024 29


Interrupt handler/Interrupt service routine (ISR)
❑ Special programs to be executed to service interrupts.
❑ Usually a part of operating system or system software.
❑ Typical operation:
l Determine the nature of interrupt: source and reason of interrupt.
l Perform corresponding operation.
l Return control to the interrupted program.

❑ Structure:
l Interrupt handler ends with a special instruction, to restore
context and value of PC, so that CPU can continue the
interrupted program properly.

IT3030E Fall 2024 30


Servicing interrupts: instruction and interrupt cycle
❑ Interrupt is checked at the end of each instruction cycle
❑ Interrupt cycle if interrupt occurred:
l CPU saves context of current program (current value of PC).
l Address of interrupt handler is loaded to PC.
l CPU continues with new instruction cycles, with new PC.
Interrupt handler will be executed instead of original program.
l At the end of interrupt handler, context will be restored including
PC value. CPU return to the interrupted program.

IT3030E Fall 2024 31


Multiple interrupt procesing
❑ Number of interrupt sources is (always) high.
❑ Interrupts can occur at the same time or overlap.
❑ Sequential vs nested interrupt processing
l Usually priority-based.
l More details in chapter 7.

IT3030E Fall 2024 32


2.3 Input/output
❑ The operation when data is transferred between I/O
modules and CPU/memory.
❑ CPU-controlled data transfer: data is transferred between
CPU and I/O, under the control of CPU.
❑ Direct memory access: data is transferred between
memory and I/O, under the control of special controllers
called DMAC.

IT3030E Fall 2024 33


3. System interconnection
❑ Interconnection model of each component
➔ Need to connect these components

❑ Theoretical bus interconnection scheme

IT3030E Fall 2024 34


System interconnection
❑ Interconnection system for high performance computers:
hierarchical bus

IT3030E Fall 2024 35


End of chapter 2

IT3030E Fall 2024 36

You might also like