Computer Architecture and Digital Logic Vocabulary

Combinational Logic Circuits and Programmable Logic Devices

  • Decoders:

    • Definition: A decoder is a combinational circuit that converts binary information from nn input lines to a maximum of 2n2^n unique output lines.

    • Structure: An nn-input to 2n2^n-output decoder expands an nn-bit binary code into up to 2n2^n minterms.

    • 3-to-8 Decoder Example:

    • Inputs: 33 lines (A,B,CA, B, C or I2,I1,I0I_2, I_1, I_0).

    • Outputs: 88 lines (D0D_0 through D7D_7).

    • Operation: For each input combination, exactly one output line is set to 11 (active high), corresponding to a unique minterm (m0m_0 to m7m_7).

    • Truth table mappings for active outputs:

      • 000→D0000 \rightarrow D_0

      • 001→D1001 \rightarrow D_1

      • 010→D2010 \rightarrow D_2

      • 011→D3011 \rightarrow D_3

      • 100→D4100 \rightarrow D_4

      • 101→D5101 \rightarrow D_5

      • 110→D6110 \rightarrow D_6

      • 111→D7111 \rightarrow D_7

    • Applications:

    • Binary-to-octal decoding

    • Code conversion

    • Memory address decoding

    • Seven-segment display driving

    • Generation of Boolean minterms for combinational functions

  • Encoders:

    • Definition: An encoder performs the exact inverse operation of a decoder. It accepts one active input line among many and converts it into an nn-bit output binary code.

    • 8-to-3 Encoder Example:

    • Inputs: 88 lines (D0D_0 to D7D_7).

    • Outputs: 33 lines (x,y,zx, y, z).

    • Operation: Assumes only one input line is active at any given time. If input D5=1D_5 = 1, the output generates the binary value 1012101_2.

  • Priority Encoders:

    • Definition: A priority encoder resolves the limitation of standard encoders where multiple inputs may be asserted simultaneously. It guarantees that if two or more inputs are active concurrently, the input with the highest priority is selected.

    • Operation Rules:

    • Highest-numbered input line is typically assigned the highest priority.

    • An additional valid output flag (VV) indicates whether at least one input line is active (V=1V = 1) or no inputs are active (V=0V = 0).

    • Boolean Equations for Priority Encoder Outputs:

    • Output x=D2+D3x = D_2 + D_3

    • Output y=D3+D1D2′y = D_3 + D_1 D_2'

    • Valid output flag V=D0+D1+D2+D3V = D_0 + D_1 + D_2 + D_3

  • Multiplexers (MUX):

    • Definition: A multiplexer (or data selector) is a combinational circuit that receives binary information from 2n2^n input data lines and directs one selected input line to a single output line based on nn selection variables.

    • 4-to-1 Multiplexer:

    • Data inputs: I0,I1,I2,I3I_0, I_1, I_2, I_3

    • Selection lines: S1,S0S_1, S_0

    • Output: YY     

      4-to-1 Multiplexer Selection Table
    • Boolean Logic Expression:       Y=I0S1′S0′+I1S1′S0+I2S1S0′+I3S1S0Y = I_0 S_1' S_0' + I_1 S_1' S_0 + I_2 S_1 S_0' + I_3 S_1 S_0

    • MUX as a Universal Function Generator:

    • Any Boolean function of nn variables can be implemented using a multiplexer with n−1n-1 selection lines.

    • Boolean variables are assigned to the selection inputs, while data inputs are connected to 00, 11, a remaining variable, or its complement.

    • Applications of Multiplexers:

    • Data selection and routing

    • Communication channels and time-division multiplexing

    • Parallel-to-serial data conversion

    • Arbitrary Boolean function implementation

    • Processor bus and data path selection

  • Read-Only Memory (ROM):

    • Definition: ROM is a non-volatile semiconductor memory device pre-programmed with permanent binary data. Information remains stored indefinitely even when power is removed.

    • ROM Architecture:

    • Inputs: nn address input lines.

    • Outputs: mm data output lines.

    • Size: Specified as 2n×m2^n \times m, containing 2n2^n addressable words of mm bits each.

    • Internal Components: A decoder of size n×2nn \times 2^n generating all 2n2^n minterms, connected to mm OR gates forming a programmable output array.

    • Combinational Function Implementation:

    • Since an n×2nn \times 2^n decoder generates all minterms of nn input variables, connecting selected decoder outputs to OR gates realizes any set of mm Boolean functions.

    • Example: Implementing F(A,B,C)=Σ(1,3,5,6)F(A, B, C) = \Sigma(1, 3, 5, 6).

      • Use A,B,CA, B, C as 3 address lines (n=3→23=8n = 3 \rightarrow 2^3 = 8 addresses).

      • Program the ROM memory array to output F=1F = 1 at memory addresses 1,3,5,61, 3, 5, 6 (0012,0112,1012,1102001_2, 011_2, 101_2, 110_2) and F=0F = 0 at all other addresses.

  • Summary Formulas for Digital Logic Design:

    • Full Adder Sum equation: Si=Ai⊕Bi⊕CiS_i = A_i \oplus B_i \oplus C_i

    • Carry Propagation equation: Ci+1=Gi+PiCiC_{i+1} = G_i + P_i C_i

    • Carry Generate: Gi=AiBiG_i = A_i B_i

    • Carry Propagate: Pi=Ai⊕BiP_i = A_i \oplus B_i

    • 2's Complement Subtraction: A−B=A+B‾+1A - B = A + \overline{B} + 1

    • BCD Addition Correction factor: add binary 011020110_2 (66) when sum exceeds 99 or generates a output carry.

    • Comparator Bit Equality: xi=AiBi+Ai′Bi′x_i = A_i B_i + A_i' B_i'

    • Decoder Outputs count: 2n2^n

    • MUX Inputs count: 2n2^n

    • ROM Addresses count: 2n2^n

Basic Computer Organization and Design

  • Instruction Codes:

    • Definition: An instruction code is a group of bits that instructs the computer to perform a specific operation, data transfer, or control action. Program instructions and data reside in common memory storage.

    • Execution Process: The CPU fetches an instruction from memory into the Instruction Register (IR), where the control unit decodes the operation code and issues the microoperations required for execution.

    • Instruction Code Fields:

    • Opcode (Operation Code): Group of bits defining the specific arithmetic, logical, or control operation (e.g., ADD, SUB, LOAD, STORE, AND, OR).

    • Address Field: Bits specifying the memory location or CPU register containing the operand.

    • Mode Bit (II): Direct/Indirect addressing mode bit.

    • Basic Computer 16-Bit Instruction Format:     

      Basic Computer Instruction Format
    • Bit 1515 (11 bit): Indirect address bit (II).

      • I=0I = 0: Direct address (address field points directly to operand).

      • I=1I = 1: Indirect address (address field points to a memory location holding the effective address of the operand).

    • Bits 12–1412\text{--}14 (33 bits): Opcode field (supports 23=82^3 = 8 operations).

    • Bits 0–110\text{--}11 (1212 bits): Address field (addresses up to 212=40962^{12} = 4096 memory words).

    • Total bit length: 1+3+12=16 bits1 + 3 + 12 = 16\text{ bits}.

    • Instruction Categories:

    • Memory-Reference Instructions (Opcode=000Opcode = 000 through 110110).

    • Register-Reference Instructions (Opcode=111Opcode = 111 with I=0I = 0).

    • Input-Output Instructions (Opcode=111Opcode = 111 with I=1I = 1).

  • Computer Registers:

    • AR (Address Register): 1212\text{ bits}. Holds memory address for read/write operations.

    • PC (Program Counter): 1212\text{ bits}. Holds address of the next instruction to fetch from memory; automatically incremented after instruction fetch.

    • DR (Data Register): 1616\text{ bits}. Holds data read from or written to memory.

    • AC (Accumulator): 1616\text{ bits}. General-purpose processor register used for performing arithmetic and logical operations and storing intermediate results.

    • IR (Instruction Register): 1616\text{ bits}. Holds opcode and operand address of the current instruction during decoding and execution.

    • TR (Temporary Register): 1616\text{ bits}. Stores temporary internal data during complex execution cycles.

    • INPR (Input Register): 88\text{ bits}. Holds an 8-bit input character transferred from an input device.

    • OUTR (Output Register): 88\text{ bits}. Holds an 8-bit output character transferred to an output device.

    • SC (Sequence Counter): Controls execution timing by generating sequence timing signals (T0,T1,T2,…T_0, T_1, T_2, \dots).

  • Computer Instruction Set Architecture:

    • Memory-Reference Instructions:

    • AND: AC←AC∧M[AR]AC \leftarrow AC \land M[AR] (Bitwise Logical AND)

    • ADD: AC←AC+M[AR]AC \leftarrow AC + M[AR] (Binary Addition with Carry)

    • LDA: AC←M[AR]AC \leftarrow M[AR] (Load Memory Word to Accumulator)

    • STA: M[AR]←ACM[AR] \leftarrow AC (Store Accumulator to Memory)

    • BUN: PC←ARPC \leftarrow AR (Branch Unconditionally)

    • BSA: M[AR]←PC,PC←AR+1M[AR] \leftarrow PC, PC \leftarrow AR + 1 (Branch and Save Return Address)

    • ISZ: M[AR]←M[AR]+1M[AR] \leftarrow M[AR] + 1; if M[AR]=0M[AR] = 0 then PC←PC+1PC \leftarrow PC + 1 (Increment and Skip if Zero)

    • Register-Reference Instructions (Executed when I=0I=0 and Opcode=111Opcode=111):

    • CLA: AC←0AC \leftarrow 0 (Clear Accumulator)

    • CLE: E←0E \leftarrow 0 (Clear Extended Bit E)

    • CMA: AC←AC‾AC \leftarrow \overline{AC} (Complement Accumulator / 1's Complement)

    • CME: E←E‾E \leftarrow \overline{E} (Complement Extended Bit E)

    • CIR: Circulate right ACAC and EE

    • CIL: Circulate left ACAC and EE

    • INC: AC←AC+1AC \leftarrow AC + 1 (Increment Accumulator)

    • SPA: Skip next instruction if AC>0AC > 0

    • SNA: Skip next instruction if AC<0AC < 0

    • SZA: Skip next instruction if AC=0AC = 0

    • SZE: Skip next instruction if E=0E = 0

    • HLT: S←0S \leftarrow 0 (Halt Computer Processing)

    • Input-Output Instructions (Executed when I=1I=1 and Opcode=111Opcode=111):

    • INP: AC(0–7)←INPR,FGI←0AC(0\text{--}7) \leftarrow INPR, FGI \leftarrow 0 (Input Character)

    • OUT: OUTR←AC(0–7),FGO←0OUTR \leftarrow AC(0\text{--}7), FGO \leftarrow 0 (Output Character)

    • SKI: Skip if Input Flag FGI=1FGI = 1

    • SKO: Skip if Output Flag FGO=1FGO = 1

    • ION: IEN←1IEN \leftarrow 1 (Interrupt Enable On)

    • IOF: IEN←0IEN \leftarrow 0 (Interrupt Enable Off / Disable)

  • Input-Output Organization and Interrupts:

    • I/O Communication: Peripherals operate independently and asynchronously from CPU speeds. Communication requires I/O interface logic, temporary buffering registers (INPR, OUTR), and status flags (FGI, FGO).

    • Input Operation Sequence:

    1. External device places character data in INPR.

    2. Input flag FGIFGI is set to 11

    3. CPU checks FGIFGI flag.

    4. CPU transfers character from INPR into AC(0–7)AC(0\text{--}7).

    5. Input flag FGIFGI is cleared to 00

    • Output Operation Sequence:

    1. CPU transfers output character from AC(0–7)AC(0\text{--}7) into OUTR.

    2. Output flag FGOFGO is set to 00

    3. External device receives character from OUTR.

    4. Output flag FGOFGO is set back to 11 when device is ready for new data.

    • Interrupt Mechanisms:

    • Purpose: Eliminates programmed I/O status flag polling by allowing peripherals to signal the CPU only when service is needed, enabling continuous CPU instruction execution.

    • Interrupt Cycle Steps:

      1. CPU completes current instruction execution cycle.

      2. CPU inspects interrupt request line condition.

      3. If interrupt flag is enabled (IEN=1IEN = 1) and flag is active (FGI=1FGI = 1 or FGO=1FGO = 1), interrupt sequence triggers.

      4. Current program context and Program Counter return address are saved (stored at memory location 00).

      5. CPU branches to Interrupt Service Routine (ISR) by loading PC←1PC \leftarrow 1

      6. Interrupt Service Routine executes to process device request.

      7. CPU executes indirect branch to return to original program execution point.

Central Processing Unit Architecture

  • CPU Structure:

    • Major Components:

    • Register Set: Stores operands, intermediate results, addresses, and status information.

    • Arithmetic Logic Unit (ALU): Performs execution of arithmetic, logic, and shift operations.

    • Control Unit: Decodes instructions, manages internal control pathways, and issues timing sequence signals.

    • Common CPU Organizations:

    • Single Accumulator Organization

    • General Register Organization

    • Stack-Based Organization

  • General Register Organization:

    • Architecture: Registers are connected through internal buses multiplexed into the inputs of an ALU. Operations select two source registers, pass them through ALU logic, and route results back to a target register.

    • Operation Walkthrough (R1←R2+R3R_1 \leftarrow R_2 + R_3):

    1. Control logic selects register R2R_2 via Bus A multiplexer (MUX A).

    2. Control logic selects register R3R_3 via Bus B multiplexer (MUX B).

    3. Arithmetic Logic Unit performs ADD operation on inputs A and B.

    4. Destination decoder selects register R1R_1

    5. Calculated sum is loaded into register R1R_1

    • Control Word Format:     

      CPU Control Word Format
    • SELA Field: 33\text{ bits} (selects Bus A source register).

    • SELB Field: 33\text{ bits} (selects Bus B source register).

    • SELD Field: 33\text{ bits} (selects destination register).

    • OPR Field: 55\text{ bits} (selects specific ALU operation).

    • Total Control Word Length: 3+3+3+5=14 bits3 + 3 + 3 + 5 = 14\text{ bits}.

  • Stack Organization:

    • Definition: A stack is a Last-In, First-Out (LIFO) memory structure where data elements are added and removed from a single top location.

    • Stack Pointer (SP): A register holding the memory or register address of the current top element of the stack.

    • Fundamental Operations:

    • PUSH: Inserts an item onto the stack.

      • Register Stack PUSH Microoperations:         SP←SP+1SP \leftarrow SP + 1         M[SP]←DRM[SP] \leftarrow DR

    • POP: Removes an item from top of stack.

      • Register Stack POP Microoperations:         DR←M[SP]DR \leftarrow M[SP]         SP←SP−1SP \leftarrow SP - 1

    • Stack Types:

    • Register Stack: Implemented using a dedicated set of internal CPU registers with fixed maximum capacity.

    • Memory Stack: Allocated as a dedicated region inside main memory; variable capacity controlled by Stack Pointer.

    • Reverse Polish Notation (RPN / Postfix):

    • Eliminates requirement for evaluation parentheses in algebraic expressions.

    • Infix: (A+B)×(C+D)(A + B) \times (C + D)

    • Postfix / RPN: AB+CD+×A B + C D + \times

    • Stack CPU execution: Operands are pushed onto stack sequentially; arithmetic operations pop top operands, compute result, and push output back to stack top.

  • Instruction Formats:

    • Fields: Opcode field, Address field(s), and Addressing Mode field.

    • Three-Address Instructions:

    • Format: ADD R1, R2, R3

    • Operation: R1←R2+R3R_1 \leftarrow R_2 + R_3

    • Characteristic: Short program length, requiring more bits per instruction.

    • Two-Address Instructions:

    • Format: ADD R1, R2

    • Operation: R1←R1+R2R_1 \leftarrow R_1 + R_2

    • Characteristic: One register serves as both source operand and destination location.

    • One-Address Instructions:

    • Format: LOAD A, ADD B

    • Operation: AC←M[A]AC \leftarrow M[A], then AC←AC+M[B]AC \leftarrow AC + M[B]

    • Characteristic: Implicating a single Accumulator (AC) register for all arithmetic/logic operations.

    • Zero-Address Instructions:

    • Format: PUSH A, PUSH B, ADD

    • Operation: Operands implicitly popped from and pushed onto top of stack.

Memory Hierarchy and Organization

  • Memory Hierarchy:

    • Rationale: Memory systems balance physical trade-offs where higher speed leads to increased cost per bit and smaller capacities, whereas low-cost, high-capacity memory suffers from slower access rates.

    • Levels of Hierarchy (Fastest/Smallest to Slowest/Largest):

    1. CPU Registers: Located inside the CPU core; sub-nanosecond access time; extremely limited capacity.

    2. Cache Memory: High-speed SRAM located close to CPU; holds active instructions and data to minimize CPU delay.

    3. Main Memory (RAM): Semiconductor memory communicating directly with CPU via system memory buses.

    4. Auxiliary Memory: Secondary non-volatile magnetic or optical storage devices (e.g., HDDs, SSDs, magnetic tapes) providing mass storage.

    • Principle of Locality of Reference:

    • Temporal Locality: Programs tend to execute recently accessed data or instruction memory locations repeatedly in short time spans.

    • Spatial Locality: Programs tend to access memory locations physically adjacent to recently referenced addresses.

  • Main Memory:

    • Definition: Primary memory unit directly addressed by the CPU during instruction execution cycles.

    • Random Access Memory (RAM):

    • Operates read and write functions.

    • Volatile storage (loses stored content when system power turns off).

    • SRAM (Static RAM): Constructed using internal flip-flop latches; does not require refresh cycles; provides higher speed; higher cost and lower density; used in Cache memory.

    • DRAM (Dynamic RAM): Stores bits as electrical charges inside MOS capacitors; requires periodic refresh; high storage density; lower cost per bit; used for main memory.

    • Read-Only Memory (ROM):

    • Non-volatile (retains stored data when system power turns off).

    • Primarily read operations; used for pre-stored system software, firmware bootstrap loaders, and static tables.

    • RAM vs. ROM Comparison:     

      RAM vs ROM Comparison
    • Memory Capacity Calculation:

    • An nn-bit address bus yields 2n2^n addressable memory locations.

    • Example: An address bus with 1212 address lines produces:       212=4096 addressable memory locations2^{12} = 4096\text{ addressable memory locations}