Computer Architecture Overview and Modules
Computer Architecture Overview and Modules
Presented By,
[Link] Kumar
ASP / SENSE
VIT University – Chennai Campus
[Link]
organization-and-architecture/
3
MODULES
6 MODULE Subsystems
4
Reference Books:
[Link] A. Patterson, John L. Hennessy, Computer Organization and
Design-The hardware/software interface, 2013, 5th edition, Morgan
Kaufmann Publishers, USA.
6
Key Focus Area of Module 1:
S1 Focus Area Overview of Organization and Architecture –Functional
components of a computer
8
COMPUTER ARCHITECTURE
The term Architecture can be defined as an art and science of designing an object.
(What it has do)
9
What is computer architecture?
• Computer architecture deals with the functionality of every hardware unit of a CPU. i.e.
what a specific hardware unit works in a computer
• It refers to the system attributes visible to a user and what is the direct impact of these
attributes on the program execution. i.e: 32 bit or 64 bit
10
11
What is computer Organization?
The computer organization describe the details of the various hardware components related
to the various functional units present in the system.
The computer organization deals with the arrangement of various system hardware
components and the function performed by the components.
The computer organization defines the existence of various functional units and its
components .It also defines the interaction between various functional component.
The computer organization defines the structure and behavior of the digital computers. The
main objective of the computer organization is to understand the various computer
hardware components and the interaction between these components.
12
computer Organization
13
What is computer organization?
• Computer organization deals with the
implementation of every hardware unit of a
CPU. i.e. how a specific hardware unit works in
a computer
15
COMPUTER ARCHITECTURE COMPUTER ORGANISATION
1 Computer Architecture is concerned with the way Computer Organization is concerned with the structure and
hardware components are connected together to behavior of a computer system as seen by the user.(how it has
form a computer system (what it has do) do)
2 It acts as the interface between hardware and It deals with the components of a connection in a system.
software.
3 Computer Architecture helps us to understand the Computer Organization tells us how exactly all the units in
functionalities of a system. the system are arranged and interconnected
4 A programmer can view architecture in terms of Whereas Organization expresses the realization of
instructions, addressing modes and registers. architecture.
5 While designing a computer system architecture is An organization is done on the basis of architecture
considered first.
6 Computer Architecture deals with high-level design Computer Organization deals with low-level design issues.
issues
7 Architecture involves Logic (Instruction sets, Organization involves Physical Components (Circuit design,
Addressing modes, Data types, Cache optimization) Adders, Signals, Peripherals)
16
Functional components of a computer
21
Arithmetic and Logic Unit (ALU)
Control unit:
Coordinates the tasks between the computer
components.
It takes the data from input devices
29
Access Time
Storage
Memory registers
Temporary unit of storage in CPU
Data stored here are directly used by the processor
Different sizes – 16, 32,64
Functions of register
Storing data
Storing address
Instruction locations
User registers can be used to store data and address by the user
Accumulator is the main register – it always has an operand that would be used by
the ALU
What is RAM?
The information stored in this type of memory is lost when the power
supply to the PC or laptop is switched off.
SRAM DRAM
SRAM DRAM
37
ROM (Read Only Memory)
Read-only memory is a type of non-volatile memory used in computers and other
electronic devices.
Data stored in ROM cannot be electronically modified after the manufacture of the
memory device.
Data stored in ROM is retained even after the computer is turned off ie, non-
volatile. Types of ROM:
Programmable ROM, where the data is written after the memory chip has been
created. It is non-volatile.
Erasable Programmable ROM, where the data on this non-volatile memory
chip can be erased by exposing it to high-intensity UV light.
Electrically Erasable Programmable ROM, where the data on this non-
volatile memory chip can be electrically erased using field electron emission.
Difference
Random Access Memory (RAM) Read Only Memory (ROM)
RAM is a volatile memory that could ROM is a non-volatile memory that the
Data-
store the could retain the
Retention
data as long as the power is supplied. data even when the power is turned off.
Read and write operations are
Read/Write Only read operations are supported.
supported.
It is typically used to store firmware or
Used to store the data that has to be
microcode, which is used
Use currently processed by CPU
to initialize and control hardware
temporarily.
components of the computer.
Speed It is a high-speed memory. It is much slower than the RAM.
CPU CPU can easily access data stored in CPU cannot easily access data stored in
39Interaction RAM. ROM.
Difference Random Access Memory
Read Only Memory (ROM)
(RAM)
Size and Large size with higher capacity, Small size with less capacity, concerning
Capacity concerning ROM. RAM.
Used as/in CPU Cache, Primary memory. Firmware, Micro-controllers.
The data stored is easily The data stored is not as easily accessible as
Accessibility
accessible. in the concerning RAM.
Cost RAM is more costlier than ROM. ROM is cheaper than RAM.
A RAM chip can store only a few A ROM chip can store multiple megabytes
Chip Size
gigabytes (GB) of data. (MB) of data.
Used for the temporary storage
Used to store firmware, BIOS, and other
Function of data currently being processed
data that needs to be retained.
40 by the CPU.
Interconnection of components – simple
bus interconnect
Interconnection of components – Bus system
43
Bus interconnect
The I/O devices, the ALU and the Control Unit are connected together by buses
Shared transmission medium - busses carry address and data
Signal transmitted by one device can be received by all the devices connected to
the bus
Simultaneous transmission of data by two or more devices is not possible since the
data might overlap
Bus consists of multiple communication pathways or lines
Each line in the bus can carry single binary bit either 0 or 1.
8 bus lines are required to transmit 8 bit unit of data
Continued…
System bus Connects major computer components like I/O devices,
processor, memory etc.
Power lines are also available that transmit power to the attached module
Data lines – path for moving data among the system modules – collectively called
data bus
Address lines – used to define the source and destination of the data on the data bus
Control lines – Controls the access for data and address lines
Transmits both command and timing information between modules
Timing signals – how long the data is valid
Command signals – operations to be performed
Continued…
Control lines
Memory Write – data on the bus is written to the memory location
Memory read – data from the memory location is moved to the bus
I/O write – data on the bus is written to the I/O port
I/O read – data from the I/O device is moved to the bus
Transfer ack – acknowledges transfer of data from and to I/O ports
Bus request – indicates that a module needs to take control of the bus
Continued…
Bus grant – indicates that the requesting module has been given permission
Interrupt request – Indicates that an interrupt is pending
Interrupt ack - Acknowledges that the pending interrupt is recognized
Clock – Used to synchronize operations
Reset – Initializes every module
Operation of a bus
If a module wants to send data
Obtain the use of the bus
Transfer the data
When a module wants to receive data
Obtain the use of the bus
Send a request to the other module over appropriate control and address lines
Wait for the second module to send the data.
Read-modify-
write
Read-after-
write
Block
1. Bus type
Dedicated – bus lines are dedicated to a specific function or subset of
components
Physical dedication – use of a single bus for a single module
Disadvantage is increased size and cost
Multiplexed – Address and data can be transmitted over the same bus lines
Uses fewer lines, less space and low cost
Disadvantage – complex circuitry for each module
2. Mode of Arbitration
Arbitration is used to set either the I/O devices or the processer as master
Master then transfers data to the appropriate slave
Source: [Link]
module-must-place-data-bus-sufficiently-ahead-q15969579 as on 17 July 2020
Asynchronous timing and data transfer
4. Bus width
Wider the data bus, large data is transferred at a time
Wider the address bus, more number of locations can be addressed
Registers and register files
Registers
Register is a very fast computer memory, used to store data/instruction in-
execution.
A Register consists of a group of flip-flops and gates that effect their transition.
A Register constructed with four D-type flip-flops and a common clock pulse
output.
Registers
Registers have 3 specific roles:
In assembly language mnemonic form an opcode is a command such as MOV or ADD or JMP.
MOV AL, 34h
In this ex., the operands are the register named AL and the value 34 hex.
Commonly used Registers
Accumulator: This is the most common register, used to store data taken out from the
memory.
General Purpose Registers: This is used to store data intermediate results during
program execution. It can be accessed via assembly programming.
• Data Register : These registers only holds the data. The restriction of these registers
is, these can not be used for operand address calculation
Control / Status - Special Purpose Registers:
Users do not access these registers. These registers are for Computer
system,
MAR: Memory Address Register are those registers that holds the address for
memory unit.
MBR: Memory Buffer Register stores instruction and data received from the
memory and sent from the memory.
PC: Program Counter holds the address of the next instruction to be read from
memory after the current instruction is executed.
IR: Instruction Register holds the instruction to be executed.
Control / Status registers
Parity Flag (PF) − It indicates the total number of 1-bits in the result obtained from an arithmetic
operation.
Sign Flag (SF) − It shows the sign of the result of an arithmetic operation. This flag is set
according to the sign of a data item following the arithmetic operation.
Zero Flag (ZF) − It indicates the result of an arithmetic or comparison operation. A nonzero
result clears the zero flag to 0, and a zero result sets it to 1.
Auxiliary Carry Flag (AF) − It contains the carry from bit 3 to bit 4 following an arithmetic
operation;
Carry Flag (CF) − It contains the carry of 0 or 1 from a high-order bit (leftmost) after an
arithmetic operation. It also stores the contents of last bit of a shift or rotate operation.
Control /Status registers
Program status word (PSW): This register contains status information. This also contains
condition codes as well as some status information.
Overflow Flag (OF) − It indicates the overflow of a high-order bit (leftmost bit) of data after
a signed arithmetic operation.
Direction Flag (DF) − It determines left or right direction for moving or comparing string
data.
Interrupt Flag (IF) − It determines whether the external interrupts like keyboard entry, etc.,
are to be ignored or processed.
Trap Flag (TF) − It allows setting the operation of the processor in single-step mode. The
DEBUG program we used sets the trap flag, so we could step through the execution one
instruction at a time.
Processor Registers – Intel Architecture
There are ten 32-bit and six 16-bit processor registers in IA-32 architecture. The
registers are grouped into three categories −
General registers,
Control registers,
Segment registers.
The general registers are further divided into the following groups −
Data registers,
Pointer registers,
Index registers.
Data Registers
Data Registers
Some of these data registers have specific use in arithmetical operations.
AX is the primary accumulator; it is used in input/output and most arithmetic instructions. For
CX is known as the count register, as the ECX, CX registers store the loop count in iterative
operations.
DX is known as the data register. It is also used in input/output operations. It is also used with AX
register along with DX for multiply and divide operations involving large values.
Pointer Registers
The pointer registers are 32-bit EIP, ESP, and EBP registers and corresponding 16-bit right portions
IP, SP, and [Link] are three categories of pointer registers −
Instruction Pointer (IP) − The 16-bit IP register stores the offset address of the next instruction
to be executed.
Stack Pointer (SP) − The 16-bit SP register provides the offset value within the program stack.
Base Pointer (BP) − The 16-bit BP register mainly helps in referencing the parameter variables
passed to a subroutine. The address in SS register is combined with the offset in BP to get the
location of the parameter.
Index Registers
The 32-bit index registers, ESI and EDI, and their 16-bit rightmost portions.
SI and DI, are used for indexed addressing and sometimes used in addition and
subtraction.
There are two sets of index pointers −
Source Index (SI) − It is used as source index for string operations.
Destination Index (DI) − It is used as destination index for string operations.
8086 Microprocessor Register Organization
Von-Neumann vs. Harvard architectures.
76
Two Types of Computers
Fixed Program Computers
They cannot reprogram
Limited number of specific function
Designed for accomplish the specific tasks
Eg., Calculators, TV remote, etc..
•Both instruction and data can be stored in dedicated storage units called
memory
How to implement the Stored-Program
Concept in reality?
SOLUTION:
• Harvard architecture
Von Neumann architecture
• Von Neumann architecture has common
to read at a time
Basic Von Neumann Architecture
CPU made with three components – Control unit, ALU and Registers
Source: [Link] as on 19 July 2020
Components of Von Neumann Architecture
Control Unit
Handles all processor control signals
Controls the directions of all input and output flow
Fetches code for instructions
Controls how data travels inside the system
Principles
In Harvard architecture concept, Memory for data was separated from the memory
for instruction
This concept is known as the Parallel access of data and instructions are possible
Features of Harvard Architecture
Separate data path and instruction path is available
An instruction is executed in a single cycle
Fetching of data and instructions can be done simultaneously
There is less chance of corruption since data and instructions are
transferred via different buses
Modern processors uses Harvard architecture
90
Difference between Von Neumann and Harvard
Architectures
S. No Von Neumann Architecture Harvard Architecture
1. Common bus for transfer of data Separate buses for data and
and instruction instruction
2. Two clock cycles are required for Single clock cycle for single
a single instruction instruction
3. CPU cannot access instruction CPU can simultaneously fetch
and read/write simultaneously instructions and perform
read/write operations
4. It is used in personal computers It is used in micro controllers and
and small computers signal processing.
RISC Vs CISC
92
RISC architecture
Instruction set contains limited and simple instructions
If data in memory is to be referenced, only LOAD and STORE instructions are
used.
Instructions use very few addressing modes
Instructions are short and have a fixed format
Number of registers available are more
Simple and small execution hardware is necessary
A hard-wired controller is needed rather than a microprogram
CPU takes only less silicon area and runs faster
Per clock cycle only one machine instruction is executed
Register to register operations are possible
Continued – One instruction per clock
cycle
Machine cycle – time taken to fetch two operands from registers, perform ALU
operation and store the result in another register
RISC instruction pipeline is more efficient due to simple instructions
In RISC architecture, complex instructions are executed as a set of simple instructions
Register to register operation
Since the instruction set is large, it requires complex hardware steps for decoding and
executing instructions
This instruction set may not match high level language statements
The instruction sets designed for executing instructions of many high level languages
might not efficiently execute instructions of a single language
Design tasks are complex
comparisons
How should new high level programs be compiled and executed efficiently on a
processor architecture?
1. CISC: design very complex architectures using a large instruction set and complex
addressing modes. Include instructions that are close to those in HLL
2. RISC: simplify the instruction set and adapt it to the requirements of the user’s
program
CISC Example:
Consider the following CISC-style instruction:
MOV AX, [BX+SI+10]
In this instruction, the value at the memory address calculated by adding the contents of
registers BX, SI, and 10 is loaded into register AX. CISC instructions often involve complex
addressing modes and can perform multiple operations in a single instruction.
RISC Example:
Now let's consider the same example using RISC-style instructions:
LOAD R1, [R2+R3]
ADD R1, R1, #10
In this RISC example, two separate instructions are used. The first instruction loads the value
at the memory address calculated by adding the contents of registers R2 and R3 into register
R1. The second instruction adds an immediate value of 10 to the contents of register R1.
RISC instructions are simpler and typically perform a single operation per instruction.
Which one is better? RISC or CISC?
1. Many comparisons show that benchmark programs are run really faster in RISC
then CISC
2. But, the fastness is not attributed completely to the RISC architecture. Some
would say that the speed is due to better technology and compilers
3. CISC requires lesser memory to store the program since it consists of lesser
number of instructions.
4. Most current processors are not dedicatedly made of RISC or CISC, they have a
combination of both the architectures.
Consider that a program has 60 % simple instruction and 40 % complex instruction. The
cycle time is 100 ns. The total number of instruction is 7,00,000. Following table gives you
the number of machine cycles for simple and complex instructions. Calculate the time
taken to execute the whole program in both RISC and CISC architecture and compare the
both. Conclude which architecture is best.
Total machine cycles for complex instructions = Number of machine cycles for complex instructions *
Percentage of complex instructions * Total number of instructions
= 12 * 0.4 * 700,000
= 3,360,000
Total time for simple instructions = Total machine cycles for simple instructions * Cycle time
= 420,000 * 100 ns
= 42,000,000 ns
= 42 ms
Total time for complex instructions = Total machine cycles for complex instructions * Cycle
time
= 3,360,000 * 100 ns
= 336,000,000 ns
= 336 ms
Total time taken to execute the whole program in RISC architecture = Total time for simple
instructions + Total time for complex instructions
= 42 ms + 336 ms
= 378 ms
CISC Architecture:
- Number of machine cycles for simple instructions: 4
- Number of machine cycles for complex instructions: 8
Total machine cycles for simple instructions = Number of machine cycles for simple instructions *
Percentage of simple instructions * Total number of instructions
= 4 * 0.6 * 700,000
= 1,680,000
Total machine cycles for complex instructions = Number of machine cycles for complex
instructions * Percentage of complex instructions * Total number of instructions
= 8 * 0.4 * 700,000
= 2,240,000
Total time for simple instructions = Total machine cycles for simple instructions * Cycle time
= 1,680,000 * 100 ns
= 168,000,000 ns
= 168 ms
Total time for complex instructions = Total machine cycles for complex instructions * Cycle time
= 2,240,000 * 100 ns
= 224,000,000 ns
= 224 ms
Total time taken to execute the whole program in CISC architecture = Total time for simple
instructions + Total time for complex instructions
= 168 ms + 224 ms
= 392 ms
After recalculating with the correct number of machine cycles, we can see that the time taken to
execute the whole program is 378 ms for RISC architecture and 392 ms for CISC architecture.
In this case, the RISC architecture appears to be slightly faster than the CISC architecture for
executing the given program. However, it's important to consider other factors such as the specific
requirements of the program, the available hardware, and the ease of programming before
determining which architecture is the best choice.