CACS155 Microprocessor and Computer Architecture

Microprocessor and Computer ArchitectureUnit 1010 min read

RISC vs. CISC: Architectures, Design Trade-offs, and Real-World Impact

Unit 10 of Microprocessor and Computer Architecture explores the fundamental differences between Reduced Instruction Set Computer (RISC) and Complex Instruction Set Computer (CISC) architectures, their design philosophies, performance trade-offs, and real-world applications in modern computing systems, including mobile

TAKEAWAYS:

  • RISC prioritizes simplicity with a small, fixed-length instruction set, while CISC uses complex, variable-length instructions to reduce software overhead.
  • RISC achieves speed via hardware pipelining and parallelism, whereas CISC relies on microcode and fewer but powerful instructions.
  • Modern processors (e.g., ARM in smartphones, x86 in PCs) blend RISC and CISC principles, often using RISC-like cores with CISC compatibility layers.
  • Memory access patterns differ: RISC loads/stores data explicitly, while CISC often embeds memory operations within instructions.
  • Performance vs. complexity is the core trade-off: RISC favors speed and efficiency, while CISC optimizes for code density and legacy support.
  • Real-world examples show how ARM (RISC) dominates mobile devices (e.g., smartphones) while x86 (CISC) powers desktops and servers (e.g., Intel/AMD CPUs).


Core Concepts: RISC and CISC Defined

1. What is RISC?

Reduced Instruction Set Computer (RISC) is a processor design philosophy that emphasizes simplicity, efficiency, and speed by:

  • Using a small, fixed-length instruction set (typically 32-bit).
  • Relying on hardware pipelining to execute multiple instructions simultaneously.
  • Offloading complex tasks (e.g., floating-point math) to dedicated coprocessors.
  • Using load/store architecture: Only LOAD and STORE instructions access memory; all other operations work on registers.

Why? Fewer, simpler instructions mean: ✔ Faster decoding (no complex microcode). ✔ Better pipelining (overlapping instruction execution). ✔ Lower power consumption (critical for mobile devices).

2. What is CISC?

Complex Instruction Set Computer (CISC) consolidates multiple low-level operations into single, complex instructions (e.g., MUL for multiplication, REP MOVSB for block memory copy). Key traits:

  • Variable-length instructions (1–15 bytes in x86).
  • Memory operations embedded in instructions (e.g., ADD [mem], reg).
  • Microcode implementation: Complex instructions are broken into micro-ops by firmware.
  • Backward compatibility: Supports legacy software (e.g., DOS, 16-bit apps).

Why? Fewer instructions mean: ✔ Smaller program size (important for early systems with limited memory). ✔ Easier high-level language compilation (e.g., C → x86 assembly).


Visual: Instruction Set Comparison

classDiagram
    class RISC {
        + Fixed-length instructions (32/64-bit)
        + Load/Store architecture
        + Pipelining support
        + Simple addressing modes
        + Examples: ARM, MIPS, RISC-V
    }
    class CISC {
        + Variable-length instructions (1-15 bytes)
        + Memory operations in instructions
        + Microcode implementation
        + Complex addressing modes
        + Examples: x86 (Intel/AMD), VAX
    }
    RISC --> "Optimized for" Speed
    CISC --> "Optimized for" Code Density

## In the Real World

  1. Smartphones (ARM RISC vs. x86 CISC)

    • Apple A-series (ARM RISC): Used in iPhones, prioritizes power efficiency and pipelining for smooth multitasking.
    • Qualcomm Snapdragon (ARM RISC): Optimized for mobile gaming (e.g., PUBG Mobile) via parallel execution units.
    • Windows on ARM (e.g., Surface Pro): Runs x86 apps via emulation layer (CISC compatibility), but native ARM apps use RISC efficiency.
  2. eSewa and Khalti (Mobile Payments)

    • ARM Cortex-A series (RISC): Powers Android phones handling Khalti transactions. Pipelining ensures fast cryptographic operations (e.g., RSA encryption) during payments.
    • Security chips (e.g., TrustZone): Use RISC-like designs to isolate payment data, preventing memory leaks.
  3. Nepal Stock Exchange (NEPSE) Servers

    • x86 CISC (Intel Xeon): Powers trading servers. Complex instructions (e.g., REP MOVSB for bulk data transfers) handle high-frequency stock data efficiently.
    • Hybrid approach: Modern x86 CPUs (e.g., Intel Skylake) use RISC-like micro-architectures internally (e.g., out-of-order execution) while exposing CISC to software.
  4. Pathao’s Ride-Hailing Algorithm

    • RISC cores (e.g., AWS Graviton): Used in cloud servers to match drivers/riders in real-time. Pipelining processes thousands of GPS updates per second.
    • CISC fallback: Legacy systems (e.g., old Pathao servers) might use x86 for batch processing (e.g., nightly reports).

Key Differences: RISC vs. CISC

Feature RISC CISC
Instruction Set Small, fixed-length Large, variable-length
Memory Access Explicit (LOAD/STORE) Implicit (e.g., ADD [mem])
Pipelining Full support Limited (complex instructions)
Hardware Complexity Simple (fewer transistors) Complex (microcode, decoders)
Power Efficiency High (mobile devices) Lower (desktops/servers)
Code Size Larger (more instructions) Smaller (fewer instructions)
Examples ARM, MIPS, RISC-V x86 (Intel/AMD), VAX

How They Work: Instruction Execution

1. RISC Execution (ARM Example)

Worked Example: Multiply two numbers and store the result.

; ARM (RISC) - Fixed 32-bit instructions
LDR  R1, [R0]    ; Load value from memory (explicit)
MUL  R2, R1, R3  ; Multiply (register-only)
STR  R2, [R4]    ; Store result (explicit)

Steps:

  1. Fetch: CPU reads LDR (4 bytes).
  2. Decode: Simple opcode → load from memory.
  3. Execute: Data moves from [R0] to R1.
  4. Pipeline: Next instruction (MUL) starts while LDR completes.

Why efficient?

  • No microcode overhead.
  • Pipelining overlaps steps (e.g., MUL decodes while LDR executes).

2. CISC Execution (x86 Example)

Worked Example: Same task in x86 (CISC).

; x86 (CISC) - Variable-length instructions
MOV  EAX, [mem] ; 2 bytes (load)
IMUL EAX, EBX   ; 2 bytes (multiply)
MOV  [result], EAX ; 3 bytes (store)

Steps:

  1. Fetch: CPU reads MOV (2 bytes), then IMUL (2 bytes), etc.
  2. Microcode: IMUL is broken into micro-ops (e.g., fetch operands, perform multiplication).
  3. Memory Access: MOV [mem] handles memory directly (no separate LOAD).

Why complex?

  • Single instruction does multiple tasks (e.g., IMUL includes operand fetch).
  • Microcode adds latency but reduces software size.

## Visual: Pipeline in RISC vs. CISC

sequenceDiagram
    participant CPU as RISC CPU
    participant Mem as Memory
    CPU->>Mem: Fetch LDR (4 bytes)
    CPU->>CPU: Decode LDR
    CPU->>Mem: Execute LDR (load data)
    CPU->>Mem: Fetch MUL (4 bytes)
    CPU->>CPU: Decode MUL (parallel to LDR execution)
    CPU->>CPU: Execute MUL (register-only)
    CPU->>Mem: Fetch STR (4 bytes)
    CPU->>Mem: Execute STR (store result)

    participant CPU2 as CISC CPU
    CPU2->>Mem: Fetch MOV (2 bytes)
    CPU2->>Mem: Microcode: Fetch [mem]
    CPU2->>CPU2: Microcode: Decode MOV
    CPU2->>Mem: Microcode: Load data
    CPU2->>Mem: Fetch IMUL (2 bytes)
    CPU2->>CPU2: Microcode: Break into sub-ops
    CPU2->>Mem: Microcode: Fetch EBX
    CPU2->>CPU2: Microcode: Multiply

Key Takeaway:

  • RISC pipelines overlap simple instructions.
  • CISC stalls for microcode translation.

## Real-World Trace: Daraz Order Processing

Scenario: A user places an order on Daraz (Nepal’s Amazon). How does the CPU handle it?

  1. Mobile App (ARM RISC):

    • Pipelining: While the user taps "Buy Now," the ARM core processes:
      • LDR (load product ID from memory).
      • ADD (calculate total price).
      • STR (store order in a buffer).
    • Parallelism: Another pipeline handles GPS data for delivery routing.
  2. Daraz Server (x86 CISC):

    • Complex Instructions: The server’s Intel Xeon uses:
      • REP MOVSB to copy bulk order data to a database.
      • SCAS (scan string) to validate user credentials.
    • Microcode: Legacy payment processing (e.g., credit card checks) uses CISC’s compact instructions.

Why Both?

  • Mobile: ARM’s RISC efficiency saves battery.
  • Server: x86’s CISC reduces code size for legacy systems.

## Advanced: Hybrid Architectures

Modern CPUs blend RISC and CISC:

  1. Intel/AMD x86 (CISC Frontend + RISC Backend)

    • CISC Layer: Software sees complex instructions (e.g., LOOP).
    • RISC Core: Internally, instructions are split into micro-ops (e.g., LOAD, ADD, STORE) for pipelining.
    • Example: Intel’s "uops" (micro-operations) resemble RISC.
    flowchart TD
      A["x86 CISC Instruction\n(e.g., REP MOVSB)"] --> B["Microcode\nDecoder"]
      B --> C["RISC-like\nMicro-ops\n(LOAD, ADD, STORE)"]
      C --> D["Pipeline\nExecution"]
  2. ARM (RISC with CISC Extensions)

    • Pure RISC core but adds Thumb mode (16-bit instructions) to reduce code size for mobile apps.

## Exam Tip

How to Score Full Marks:

  1. Define Clearly:

    • Start with: "RISC stands for Reduced Instruction Set Computer, emphasizing simplicity and pipelining, while CISC (Complex Instruction Set Computer) consolidates operations into fewer, complex instructions."
    • Use the comparison table in your answer (students love visuals!).
  2. Link to Real Systems:

    • Mention ARM in smartphones (RISC) and x86 in PCs/servers (CISC). Add: "Modern CPUs like Intel’s Core i7 use a CISC interface but internally operate like RISC for efficiency."
  3. Trace an Example:

    • Show a 2–3 instruction sequence in both RISC (ARM) and CISC (x86), highlighting:
      • Fixed vs. variable length.
      • Explicit vs. implicit memory access.
      • Pipeline stages.
  4. Avoid Common Mistakes:

    • ❌ "RISC is always faster than CISC." → Context matters: RISC excels in single-threaded tasks; CISC can outperform in legacy workloads.
    • ❌ "CISC doesn’t use pipelining." → Modern CISC CPUs do, but complex instructions limit it.
  5. Diagram Magic:

    • Draw a pipeline diagram (like above) or a layered model of a hybrid CPU (CISC frontend + RISC backend). Label stages clearly.

## Summary Checklist

Before the exam, verify you can: ✅ Differentiate RISC/CISC on 5 key dimensions (instruction set, memory access, pipelining, hardware, power). ✅ Explain why ARM dominates mobile (power efficiency) and x86 dominates desktops (legacy support). ✅ Trace 3 instructions in both architectures, noting length and memory operations. ✅ Describe one hybrid architecture (e.g., x86’s micro-op translation). ✅ Relate to Nepali examples (e.g., Khalti’s ARM chips, NEPSE’s x86 servers).


Based on the TU BCA syllabus for Microprocessor and Computer Architecture (CACS155), unit 10.

Discussion

Loading…