Skip to content

CS 631-01 Systems Foundations — Meeting Summary

  • Date: Mar 03, 2026
  • Time: 08:24 AM Pacific Time (US and Canada)
  • Meeting ID: 870 0988 0761

Quick Recap

  • Focus: Assembly language programming—memory instructions, stack operations, and calling conventions.
  • Memory addressing: Byte addressing, word alignment, and load/store for different data sizes.
  • Arrays: How to compute element addresses and implement array-based functions (e.g., array addition).
  • Stack usage: Allocate in multiples of 16 bytes; distinction between T-registers (temporary/caller-saved, modifiable) and S-registers (saved/callee-saved, must be preserved).
  • Tools: Minimal Cloud Code implementation (“PICO code”) for the Beagle board to run Rust and assembly locally.
  • Control flow: Overview of branch instructions; preview of recursion and more complex function protocols.

Next Steps

  • [ ] Greg: Make the new Debian-based VM image available for students to use with QEMU.
  • [ ] Greg: Post the PICO code (mini Cloud Code) to the class/campus wire for interested students.
  • [ ] Greg: Update Thursday’s lecture notes earlier than usual and publish them.

Detailed Summary

1) Assembly Language and VM Setup

  • A new Debian-based QEMU VM image was introduced; it is faster than the previous image.
  • Assembly syntax was reviewed, emphasizing its relative simplicity compared to C, Rust, or Java.
  • Topics included:
  • Use of labels for functions and control flow.
  • The role of comments for organization.
  • Instruction-size limits and the need for label offsets in certain cases.

2) Assembly Language and Memory Basics

  • Labels can be freely named within valid identifier rules.
  • Memory fundamentals:
  • How data is stored and accessed by the processor.
  • Upcoming focus areas: control flow, function calls, arrays.
  • Next week: string handling in assembly and initial code generation for the NPLANG project.

3) Byte Addressing and Memory Instructions

  • Memory is an array of bytes; all instructions use byte addresses.
  • Load/store instructions for various data widths were covered.
  • Alignment: Word-aligned access is important for correctness and performance.
  • Extension rules:
  • Sign extension vs. zero extension for narrower loads.
  • Syntax reviewed for load/store using base address + offset.

4) C Memory and Pointer Fundamentals

  • Demonstrations linked C pointer operations to underlying memory access.
  • Topics included:
  • Loading/storing values from specific addresses.
  • Using offsets to access struct fields and stack-based locals.
  • Computing addresses for array elements.
  • An assembly function equivalent to a Rust array-sum function was shown.
  • Emphasis on adhering to calling conventions and approaching assembly as a “fill-in-the-parts” puzzle.

5) Array Access and Code Editors

  • Address computation for arrays was reinforced, followed by a brief break.
  • Tooling notes:
  • Frustrations with notebook environments due to dependency management.
  • Introduction of PICO code, a minimal Cloud Code variant with:
    • Plan mode.
    • Multi-line input via Alt+Enter.
    • Installable on RISC-V machines; requires an API key.

6) Memory Layout and Array Addition

  • Implementations of array addition in Rust, C, and assembly were discussed.
  • Typical memory layout reviewed: code, static data, heap, stack.
  • Preview: More on memory instructions and stack usage in subsequent sessions.

7) Stack Memory and Calling Conventions

  • Stack allocation via the stack pointer, using 16-byte multiples to follow ABI conventions.
  • Efficiency of stack allocation and its use in languages like Rust.
  • Recursion in assembly is just function calling with proper saving/restoring of state.
  • Upcoming content:
  • Calling conventions in detail.
  • Writing recursive functions in assembly.
  • Branch instructions were briefly reviewed, along with rules for using T (caller-saved) and S (callee-saved) registers.