Courses & Projects by Rob Marano

Notes for Week 2

← back to syllabus ← back to notes

🗂️ Download Week 02 Slides (PDF)

Slides for Class 02

Topics

  1. Recap Computer Architecture and the Stored Program Concept
  2. Introducing the instructions of a computer delivered by the architecture
    1. Operations of the computer hardware
    2. Operands of the computer hardware
    3. Signed and unsigned numbers
    4. Representing instructions in the computer
    5. Logical operations

Topics Deep Dive

Recap: What is Computer Architecture?

Computer architects define the fundamental organization and behavior of a computer system, enabling both hardware implementation and software execution.

Recap:The Five Classic Components of a Computer

These five components are interconnected by data, address, and control buses, which are sets of wires that carry data and control signals.

Five Parts of a Computer

Recap:The Stored Program Concept

The stored program concept is the idea of storing both the instructions (the program) and the data in the computer’s memory. This allows for:

This concept is fundamental to how all modern computers operate.

Recap: von Neumann vs. Harvard Architectures

Von Neumann vs. Harvard Architectures

Remember, the von Neumann bottleneck arises because both instructions and data must travel over the same bus to and from memory. This can limit performance, especially when the CPU needs to fetch instructions and data frequently. The Harvard architecture mitigates this by allowing parallel access to instruction and data memories.

Recap: Performance of a Computer

Here’s a breakdown of key aspects of computer performance:

1. Execution Time: 2. Throughput: 3. Latency: 4. Resource Utilization: 5. Power Consumption: 6. Cost:

and don’t forget the Power Wall in computer architecture fabrication.

The “Power Wall” refers to the increasing difficulty and impracticality of continuing to increase processor clock speeds to achieve performance gains. For many years, increasing clock speed was the primary driver of improved CPU performance. However, this approach has run into fundamental physical limitations, leading to the “power wall.”

Instructions: The Language of the Computer (Instruction Set Architecture (ISA))

Today, we’ve laid the foundation for understanding the basic components and principles of computer architecture. Our next lecture will delve into the Instruction Set Architecture (ISA).

The ISA defines the set of instructions that a particular processor can understand and execute. It’s the interface between the hardware and the software. We’ll explore:

Understanding the ISA is crucial for writing efficient code, optimizing compiler design, and designing new processors. It’s the bridge between the high-level world of programming and the low-level world of hardware.

Read Textbook Chapter 2 notes by professor

Introduction (Textbook §2.1)

Operations of the Computer Hardware (Textbook §2.2)

Every computer must be able to perform arithmetic. The MIPS instruction set includes:

The arithmetic instructions of the MIPS32 architecture are a cornerstone of understanding how CPUs actually do math. Remember, we’re building up from the ground floor, so understanding these fundamentals is crucial for your future work in computer architecture and embedded systems.

Here’s the high-level overview of MIPS32 arithmetic instructions, focusing on the key concepts relevant to you as budding engineers and computer scientists:

  1. Register-Based Operations: MIPS32 is a load-store architecture. This means arithmetic operations are performed only on data held in registers. You can’t directly manipulate values in memory with arithmetic instructions. This is a crucial design decision that impacts performance and instruction complexity. Think of registers as the CPU’s scratchpad – quick access, limited space.
  2. Three-Operand Instructions: Most MIPS32 arithmetic instructions are three-operand instructions. This means they take two source registers and one destination register. The general format is operation $rd, $rs, $rt, where $rd is the destination, $rs is the first source, and $rt is the second source. For example, add $t0, $t1, $t2 means $t0 = $t1 + $t2. This consistent format simplifies instruction decoding and execution.
  3. Instruction Types and Functionality: MIPS32 provides a variety of arithmetic instructions, covering the basic operations:
    1. Addition: add, addu (unsigned), addi (immediate), addiu (unsigned immediate).
      Pay close attention to the signed vs. unsigned versions. Overflow handling is different!
    2. Subtraction: sub, subu (unsigned).
      Again, mind the signed/unsigned distinction.
    3. Multiplication: mul, mult, multu. mult and multu produce a 64-bit result, stored in the special HI and LO registers. You then use mfhi and mflo to move these parts into general-purpose registers. mul provides the lower 32-bit result.
    4. Division: div, divu. Similar to multiplication, div and divu produce a quotient and a remainder. The quotient is stored in LO, and the remainder in HI.
    5. Logical Operations: and, or, xor, nor. These perform bitwise logical operations. Crucial for manipulating data at the bit level. We’ll delve into their uses later when we discuss control flow and data manipulation.
    6. Shift Operations: sll (shift left logical), srl (shift right logical), sra (shift right arithmetic). These are essential for bit manipulation and are often used in implementing multiplication and division by powers of 2.
  4. Immediate Operands: Many instructions have an “immediate” version (e.g., addi). This allows you to use a constant value directly in the instruction, without needing to load it into a register first. This is a significant optimization for frequently used constants. Preparation is handled by the assembler and encoded into the machine code of the program.
  5. Overflow and Underflow: It’s your responsibility as the programmer to handle overflow and underflow conditions. MIPS32 provides some instructions that detect overflow (the signed versions), but it doesn’t automatically throw exceptions in all cases. Understanding the implications of signed and unsigned arithmetic is crucial to the success of your CPU design!
  6. No Condition Codes: Unlike some other architectures, MIPS32 does not use condition codes (flags) set by arithmetic operations. This has implications for how you implement branching and comparisons, which we’ll discuss when we cover control flow.

Exploration of Operands of the Computer Hardware (Textbook §2.3)

Signed and Unsigned Numbers (Textbook §2.4)

Representing Instructions in the Computer (Textbook §2.5)

Instructions are represented as binary numbers. MIPS uses a 32-bit fixed-length format.

Logical Operations (Textbook §2.6)


← back to syllabus ← back to notes