COSC 211 - Lecture 1

COSC 211 Machine Architecture Winter 2025


What Is Computer Architecture?

  • Definition: A specialized field of computer science and engineering focusing on the structure and layout of computer systems.

  • Focus Areas: Registers, control units, memory caches, and their interconnectivity and functionality.


Software vs. Hardware vs. Architecture

  • Architecture's Role: Serves as a bridge between hardware and software.

  • Hardware Engineers: Responsible for the design and implementation of the physical silicon of processors.

  • Architects' Responsibilities: Design efficient interactions between physical components and create low-level code for interfacing.


Areas of Computer Architecture

  • Major Areas:

    • Machine Organization (Systems Design): Describes the logical structure of a machine.

    • Instruction Set Architecture (ISA): Defines communication with the processor including the native language.


Machine Organization – Flowcharts for Days

  • Interest: Understanding how the components of the CPU are interconnected.

  • Visual Aids: Diagrams illustrate major components and their linkages in an AVR CPU.


Breaking Down Processing

  • Processor Structure: Defined by functions of major subunits, including:

    • Input: Handles data and instruction input.

    • Control Unit: Interprets commands and synchronizes activities.

    • ALU (Arithmetic Logic Unit): Manages arithmetic and logic operations.

    • Memory Handling: Involves cache and RAM management.

    • Output: Manages the results outputs.


Instruction Set Architecture

  • Focus: Communication with processors via instruction sets and assembly languages.

  • Components: Discussion includes opcodes, registers, and instruction formats.

  • Example: AVR assembly showcasing opcodes and registers.


Design of ISAs

  • Considerations for Effective Design:

    • Width of memory and communication bus (32-bit vs. 64-bit).

    • Necessity of specific instructions.

    • Variety of instruction formats and operand passing methods.

  • Complexity: ISA design is multifaceted involving both hardware and software concerns.


By Our Powers Combined

  • Insights from machine organization and ISA enable detailed predictions of processor actions (per-instruction and per-bit).


Assembly Language – What is it?

  • Definition: A human-interpretable version of machine language (binary).

  • Low-Level Language: It is the last abstraction before machine code.


How Assembly is Used

  • Current Trends: Most code is written in higher-level languages (C, C++), and compilers optimize it into assembly.

  • Porting Software: Involves translating software to different assembly languages via re-compilation.

  • Optimization Trade-offs: Optimizing compilers perform better than manual assembly coding.


Assembly vs. Machine Language

  • Difference: Assembly is human-readable with mnemonic codes; machine language is binary.

  • Functionality of Assemblers: Converts assembly instructions into binary format that the processor understands.


An Illustrative Example of Compilation

  • Compilation Process: Higher-level code transforms into assembly, then to machine language.

  • Readability Shift: Code becomes less human-readable through compilation stages.


Examples of Instruction Set Architectures

  • Common ISAs:

    • Intel x86: Widely used in PCs (x86_64 for 64-bit).

    • ARM: Functions well for low-power devices.

    • AVR: Used in microcontrollers, also a RISC architecture.


Why Not Learn x86?

  • Complexity of x86: Approximately 900 instructions with 3600 variations, leading to high complexity in understanding.

  • Modern CPU Complexity: Significant architecture includes intricate pipelining and caching mechanisms not easily understood.


RISC to the Rescue!

  • Definition of RISC: Stands for Reduced Instruction Set Computing.

  • Benefits: Simplified set of instructions (e.g., AVR with ~120 opcodes), improving ease of learning and implementation.

  • Usage: RISC instruction sets are preferred for cheaper manufacturing in embedded and microcontroller environments.


AVR in the Real World - Microcontrollers

  • Reason for AVR Choice: AVR microcontrollers are used in Arduino platforms.

  • Comparison: Embedded processors (like ATMega328P) are simpler and cheaper than desktop CPUs with limited resources (32KB storage, 2KB RAM).


AVR in the Real World - Toolchains

  • AVR Toolchain: The open-source avr-gcc toolchain is comprehensive and user-friendly for compiling C/C++ to machine language.

  • Advantages: Saves costs associated with proprietary compilers, accessible for beginners.


Next Week

  • Lab Introduction: Setting up the toolchain and compiling C/C++ code.

  • Lecture Focus: Refresher on binary and hexadecimal, along with the start of computer organization discussions (subunit responsibilities in AVR processors).


Any Questions?