Computational Architecture (Computer Architecture)
Computational Architecture (Computer Architecture)
Definition:
Computer architecture refers to the conceptual design and fundamental operational structure of a
computer system. It focuses on the structure and behavior of the computer as seen by the
programmer — including the instruction set, data types, addressing modes, registers, and
input/output mechanisms.
Key Components:
● I/O operations
Examples:
● x86 Architecture: A complex instruction set computer (CISC) used in most PCs.
● ARM Architecture: A reduced instruction set computer (RISC) used in mobile devices.
Definition:
Computer organization refers to the operational units and their interconnections that realize the
architecture's specifications. It deals with the implementation details — how hardware components
such as the CPU, memory, and I/O devices work together to execute programs.
Key Components:
● Control Unit
● Registers
1
● Cache memory
Examples:
Concerned with Instruction sets, data types, Control signals, buses, hardware
memory addressing implementation
Control Signals
Control signals are electrical signals used in a computer system to coordinate and manage the
actions of its components (like CPU, memory, and I/O devices). They are generated by the control
unit of the processor and are essential for executing instructions correctly.
2
🔧 Purpose of Control Signals
● Direct data flow between components (e.g., memory to register)
A computer system is made up of several functional units, each responsible for performing specific
tasks during data processing. These units work together to fetch, process, store, and output data.
🔹 1. Input Unit
Function: Accepts data and instructions from the user and converts them into a form the computer
can understand (binary).
3
🔹 2. Memory Unit
Function: Stores data, instructions, and results.
Types:
● Primary Memory:
○ ROM (Read-Only Memory): Permanent storage for startup programs (e.g., BIOS).
● Secondary Memory:
🔹 5. Output Unit
Function: Converts binary results from the computer into human-readable form.
4
● Examples: Monitor, printer, speaker
🧠 Definition:
A System Bus is a communication pathway that connects the major components of a computer
system, such as the CPU, memory, and input/output devices. It allows data and control signals to
be transmitted between them.
5
Think of it as the "nervous system" of a computer that carries information back and forth.
1. Data Bus Transfers actual data between CPU, memory, and I/O.
3. Control Carries control signals from the control unit (e.g., Read, Write, Interrupt,
Bus Clock).
2. Control signals (like Read/Write) are sent on the control bus.
● Width (e.g., 8-bit, 16-bit, 32-bit, 64-bit) determines how much data can be transferred at once.
2. Address Bus
6
3. Control Bus
○ READ / WRITE
○ Memory Enable
○ I/O Enable
○ Clock
○ Interrupt requests
🖥️ Example in Action:
CPU wants to read data from memory:
7
● Reduces hardware complexity
⚠️ Limitations:
● Bus contention: Multiple devices may want to use the bus simultaneously
Definition:
In synchronous bus data transfer, all devices on the bus share a common clock signal. Data
transfer between devices (like CPU and memory) happens in fixed time intervals (clock cycles), and
all actions are coordinated based on this clock.
🧠 Key Features:
● Uses a clock line to synchronize all operations
3. After a fixed delay (based on the clock), data is placed or read
8
📊 Diagram: Synchronous Bus Data Transfer
Definition:
In asynchronous bus data transfer, data is transmitted without a common clock signal. Instead,
devices use control signals (handshaking) to manage when data is sent and received. Each device
communicates at its own speed.
9
5. The sender removes data and resets the control lines.
🧠 Key Features:
● No global clock required
📊 Advantages:
● More flexible, supports devices of varying speeds
⚠️ Disadvantages:
● More complex than synchronous transfers
10
Clock Signal Uses a common clock signal to No global clock; uses handshaking
coordinate transfer (REQ/ACK) signals
Speed All devices must operate in sync Devices operate at their own speed
Coordination with the clock
Implementation Simpler but less flexible More complex but more flexible
Device Slower devices may cause Better suited for devices with
Compatibility bottlenecks variable speeds
📌 Definition:
An Instruction Cycle is the complete process by which a computer fetches, decodes, and
executes a single instruction from memory. It is repeated continuously by the CPU for every
instruction in a program.
1. Fetch CPU fetches the instruction from memory (address in Program Counter
- PC)
🖥️ Example:
11
Let’s consider the instruction:
assembly
CopyEdit
ADD R1, R2, R3 ; R1 ← R2 + R3
1. Data Transfer Move data between memory and MOV R1, 1000 (move value at
registers 1000 to R1)
📊 Explanation of Each:
1. Data Transfer – Moves data without processing.
12
3. Logical – Performs bitwise operations.
Definition:
An Instruction Set is a group of binary-coded commands (instructions) that a computer’s CPU
can execute directly. These instructions tell the CPU what operations to perform, such as arithmetic,
data movement, logic, control flow, etc.
🔹 Examples of Instructions:
● ADD R1, R2 – Add contents of R1 and R2
● MOV R1, 1000 – Move the value at address 1000 into register R1
Every processor has its own specific instruction set. For example:
Think of ISA as the blueprint that tells how software interacts with the processor.
13
🔹 Example of ISA:
Let’s consider the MIPS ISA:
🔄 In short:
Term Description
Instruction Set The actual set of binary commands the CPU understands
An Instruction Set Architecture (ISA) is the blueprint that defines how a computer's hardware and
software interact. It provides all the essential details required to write and execute machine-level
programs.
Below are the main components of ISA, along with their explanations and examples:
🔹 1. Instruction Format
Definition: Specifies how an instruction is encoded in binary — i.e., how the bits of an instruction are
divided into meaningful fields.
🔧 Typical Fields:
● Opcode: Operation code (e.g., ADD, LOAD)
14
● Immediate values: Constants encoded directly
🔹 2. Instruction Types
Definition: Categories of operations supported by the ISA.
🔹 3. Addressing Modes
Definition: Methods used to specify the location of an operand.
🔹 4. Data Types 15
Definition: Specifies the kinds and sizes of data supported by the ISA.
🔹 5. Registers
Definition: ISA defines a set of registers accessible to programmers.
📌 Example: MIPS has 32 general-purpose registers: $t0 – $t9, $s0 – $s7, etc.
🔹 6. Memory Architecture
Definition: Describes how memory is structured and accessed in the system.
● Byte vs Word Addressable: Whether each memory address refers to a byte or word.
🔹 7. I/O Mechanism
Definition: Specifies how the CPU communicates with external devices.
Type Description
16
Memory-Mapped I/O Devices use memory address space
Data Types Types and sizes of data (int, float, char, etc.)
Instruction Set Architectures are categorized based on how instructions are formatted and how
operands are specified. The main types are:
🔹 1. Stack-Based ISA
Definition: Operands are implicitly taken from the top of the stack, and results are pushed back.
📌 Example:
asm
CopyEdit
PUSH 5 ; Push 5 onto stack
PUSH 7 ; Push 7 onto stack
ADD ; Add top two values → result pushed
17
✅ Used In:
● JVM (Java Virtual Machine)
● Forth language
🔹 2. Accumulator-Based ISA
Definition: One operand is in a special register called the accumulator, and the other is from
memory.
📌 Example:
asm
CopyEdit
LOAD A ; Load value from memory A into accumulator
ADD B ; Add value from memory B to accumulator
STORE C ; Store result in memory C
✅ Used In:
● Early computers (e.g., Intel 8080)
🔹 3. Register-Memory ISA
Definition: One operand is in a register and the other in memory.
📌 Example:
asm
CopyEdit
ADD R1, M1 ; Add value at memory M1 to register R1
18
✅ Used In:
● Intel x86 architecture
● Uniform performance
📌 Example (MIPS):
asm
CopyEdit
LOAD R1, A ; Load value from memory A into R1
LOAD R2, B ; Load value from memory B into R2
ADD R3, R1, R2 ; Add R1 and R2, store result in R3
STORE R3, C ; Store result to memory C
✅ Used In:
● MIPS, RISC-V, ARM (modern RISC processors)
🔹 5. Hybrid ISA
Definition: Combines features of register-memory and load/store architectures.
● More flexible
● Complex implementation
✅ Used In:
● x86-64 (combines register-register, register-memory, and accumulator types)
19
📊 Summary Table
ISA Type Operand Location Example Instruction Example System
The Instruction Cycle (also called Fetch-Decode-Execute cycle) is the basic operation cycle of a
computer, where the CPU fetches an instruction from memory, decodes it to understand what to do,
and then executes it.
○ How:
■ The Program Counter (PC) holds the address of the next instruction.
■ The address is sent to memory and the instruction is fetched into the
Instruction Register (IR).
■ PC is incremented.
2. Decode
20
○ How:
3. 🧠 Example: Instruction ADD R1, R2 is decoded to perform addition of R1 and R2.
3. Execute
○ How:
4. 🧠 Example: ALU adds contents of R1 and R2 and stores result in R1.
○ Some instructions require reading or writing from memory (e.g., LOAD, STORE).
🔁 Cycle Repeats
Once one instruction completes, the next instruction is fetched using the updated PC.
21
📘 Example:
For the instruction:
asm
CopyEdit
ADD R1, R2
📊 Summary Table
Phase Description Key Elements Used
An interrupt is a signal sent to the processor that temporarily stops the current program
execution, so the CPU can respond to an urgent task or event. Once the interrupt is handled, the
CPU resumes the original program.
🔹 Purpose of Interrupts
Interrupts are used to:
22
● Respond quickly to real-time events (like input/output)
📘 Real-World Analogy
Imagine you're writing notes, and your phone rings:
23
✅ Instruction Cycle with Interrupt in Computer Organization
The Instruction Cycle describes how the CPU fetches, decodes, and executes instructions. When
interrupts are introduced, the cycle is enhanced to allow the CPU to respond to external or internal
events.
● This instruction is fetched from memory and stored in the Instruction Register (IR).
● PC is incremented.
🔹 2. Decode
● The Control Unit (CU) decodes the instruction to determine the operation and the operands.
🔹 3. Execute
● The Arithmetic Logic Unit (ALU) or other parts of the CPU execute the decoded instruction.
🚨 Interrupt Cycle
If an interrupt is detected:
24
1. Save the current program state (PC, flags, registers) onto the stack.
2. Load the address of the appropriate Interrupt Service Routine (ISR) into the PC.
📘 Example Scenario
Let's say the CPU is executing:
asm
CopyEdit
ADD R1, R2
25
v
+----------+----------+
| Fetch Instruction |
+----------+----------+
|
v
+----------+----------+
| Decode Instruction |
+----------+----------+
|
v
+----------+----------+
| Execute Instruction |
+----------+----------+
|
v
+---------------+----------------+
| Check for Interrupt? (Yes/No) |
+---------------+----------------+
| |
| No | Yes
v v
+---------+--------+ +--------+----------+
| Fetch Next | | Save PC, Flags, |
| Instruction | | and Registers |
+-------------------+ +--------+----------+
|
v
+-----------+-----------+
| Execute ISR |
+-----------+-----------+
|
v
+-----------+-----------+
| Restore PC and Flags |
+-----------+-----------+
|
v
+-----------+-----------+
| Resume Normal Program |
+-----------------------+
26
✅ Summary
Phase Description
Interrupt Cycle Handle interrupt by saving state, executing ISR, and restoring
state
The instruction cycle refers to the steps the CPU performs to execute a single machine-level
instruction. Each instruction goes through several stages from fetching to executing and storing the
result.
6. Interrupt Check Check and respond to any interrupts before the next cycle.
(optional)
🔍 1. Fetch Stage
● The Program Counter (PC) holds the address of the next instruction.
27
● This address is sent to memory via the Memory Address Register (MAR).
● The Memory Data Register (MDR) receives the instruction from memory.
🔍 2. Decode Stage
● The Control Unit (CU) decodes the instruction in IR.
● Identifies:
○ Addressing mode
🔍 3. Execute Stage
● The Arithmetic Logic Unit (ALU) or other components carry out the operation:
28
○ Sends address to MAR
🔍 5. Write-back Stage
● The result from ALU or memory is stored into the appropriate register or memory location.
● If found:
📘 Example Instruction:
asm
CopyEdit
ADD R1, R2
Stages:
29
● Execute: ALU performs R1 = R1 + R2.
📊 Summary Table
Stage Component Used Action
30