Classroom Public page

Lab Pack 4: Machine Language (Week 4)

249 words

Hand-encoding fluency. Five worksheets in worksheets/ch4/ take you from "I know the instruction-encoding card exists" to "I can hand-encode a working sum-to-N program and reconcile it against riscv32-unknown-elf-as." Plus your first Ghidra encounter.


Anchors the week

Week 4: Machine Language. The voice-template chapter of the course; the lab pack establishes the voice's tactile component. Encoding by hand is slow and error-prone on purpose; the slowness is what makes the encoding stick.

Concept the lab embodies

Structure-through-encoding. The 32-bit word is not a random number; specific bit positions carry specific meanings. The encoding card tells you which bits mean what; the assembler does it automatically; for one week the student does it by hand.

The five worksheets

Worksheet Time Purpose
lab-4.1-hand-encode-ten-instructions.md ~90 min Encode by reading the card
lab-4.2-hand-decode-ten-words.md ~90 min Decode the reverse direction
lab-4.3-sum-to-n-assembly.md ~120 min Write a real program; ~20 instructions
lab-4.4-real-toolchain-reconciliation.md ~60 min Your hand-encoding matches riscv32-unknown-elf-as output byte-for-byte
lab-4.5-ghidra-first-encounter.md ~90 min Ghidra reads your binary; you see what it sees

Grading rubric

Per-worksheet rubrics. Week-level: ten hand-encoded instructions match the toolchain; ten hand-decoded words match the source; sum-to-N runs in simulation; Ghidra opens your binary and shows recognizable structure.

What's next

Lab pack 5: Computer Architecture. The silicon bring-up week.