16-Bit Instruction Format
16-Bit Instruction Format
Bit 15 (I)
Addressing Mode Bit
0 = Direct, 1 = Indirect
0 = Direct, 1 = Indirect
Bits 12–14 (Opcode)
Operation Code (3 bits)
Tells what action to do (ADD, SUB, AND)
Tells what action to do (ADD, SUB, AND)
Bits 0–11 (Address)
Memory Address (12 bits)
Points to one of 4,096 memory words
Points to one of 4,096 memory words
Explanation
- Read the fields separately to find the addressing information and operation code.
- The remaining address bits identify an operand location in this instruction format.
Common Bus Multiplexer Selection
Common Bus Multiplexer Selection
Registers (AR, PC, DR, AC, IR, TR, Memory)
→ Multiplexer Selection (S₂, S₁, S₀)
→ 16-Bit Shared Bus Highway → Destination Register
Explanation
- The select lines choose which register drives the bus.
- A destination register loads the selected value when enabled.
The Four Phases of Instruction Cycle
The Four Phases of Instruction Cycle
T0: Address Fetch
Address from Program Counter moves to Address Register: AR ← PC
T1: Memory Read
Instruction copied to IR and PC advances: IR ← M[AR], PC ← PC + 1
T2: Decode Phase
Opcode decoded (D₀-D₇), address moved to AR, mode bit I loaded
T3: Effective Address
If I = 1 (Indirect), load pointer: AR ← M[AR]; if I = 0, do nothing
Explanation
- Fetch brings in the instruction and decode identifies the requested operation.
- Execution changes the machine state and interrupt handling may follow.
Input-Output Handshaking Architecture
Input-Output Handshaking Architecture
Input Device (Keyboard)
Sends 8-bit ASCII character to INPR.
Sets flag FGI = 1. When CPU reads data, FGI = 0.
Sets flag FGI = 1. When CPU reads data, FGI = 0.
Output Device (Monitor)
Displays 8-bit ASCII from OUTR.
When screen is ready, FGO = 1. When CPU sends data, FGO = 0.
When screen is ready, FGO = 1. When CPU sends data, FGO = 0.
Explanation
- One side signals that data is ready and the other acknowledges receipt.
- These signals let devices with different speeds exchange data reliably.
Common Addressing Modes and Effective Address (EA)
Common Addressing Modes and Effective Address (EA)
Immediate Mode
Operand = Value inside instruction
Data is right there (e.g.
Data is right there (e.g.
ADD #25)Direct Mode
EA = Address
Instruction gives the exact RAM address (e.g.
Instruction gives the exact RAM address (e.g.
LDA 2000)Indirect Mode
EA = M[Address]
Instruction points to a memory pointer that holds the real address
Instruction points to a memory pointer that holds the real address
Register Mode
Operand = Register
Data is stored inside a fast CPU register (R₁)
Data is stored inside a fast CPU register (R₁)
Explanation
- Immediate addressing carries the operand inside the instruction.
- Other modes calculate or look up an effective address before reading the operand.
Conditional Transfer Hardware Implementation
Conditional Transfer Hardware Implementation
Control Condition P → Load (LD) Input
Master Clock → Clock (CLK) Input
Output of R₁ → Inputs of R₂
Explanation
- A control condition enables the transfer between the selected registers.
- On the clock edge the destination copies the source value.
Three-State Buffer States
Three-State Buffer States
Logic 0
Normal low-voltage output (0V)
Logic 1
Normal high-voltage output (+5V)
High-Impedance (Hi-Z)
Acts like a disconnected open switch! Electrically invisible to the bus.
Explanation
- An enabled buffer drives either zero or one onto the line.
- A disabled buffer presents high impedance so another source can use the bus.
The Four Classes of Micro-operations
The Four Classes of Micro-operations
1. Register Transfer
Copies binary data from one register to another (`R₂ ← R₁`)
2. Arithmetic
Performs math: addition, subtraction, increment, decrement
3. Logic
Performs bitwise Boolean tests: AND, OR, XOR, NOT
4. Shift
Slides data bits left or right for quick multiplication or division
Explanation
- Register transfers copy values and arithmetic operations calculate with them.
- Logic operations work on bits and shifts move bits between positions.
Shift Operation Comparison
Shift Operation Comparison
Logical Shift
Slides all bits. Puts a fresh 0 into the empty end.
shl (Shift Left) and shr (Shift Right).Circular Shift (Rotate)
The bit pushed out of one end loops right back into the opposite end. No bit is lost!
Arithmetic Shift
Used for signed numbers.
Right Shift: Keeps the sign bit (MSB) unchanged.
Left Shift: Multiplies the number by 2.
Right Shift: Keeps the sign bit (MSB) unchanged.
Left Shift: Multiplies the number by 2.
Explanation
- A logical shift fills a vacant position with zero.
- An arithmetic right shift copies the sign bit, while a rotation wraps a bit around.