EECS 373 - How to read the ARMv7-M manual
Overview
The lecture teaches EECS 373 students how to use the ARMv7-M Architecture Reference Manual and Thumb-2 quick reference card to look up and encode instructions, using ADD as the main example. It explains ADD's 17 encodings and shows how to interpret its assembly syntax, bit fields, flag updates, shifts, and special-register constraints so the manual can serve as a fast reference rather than a textbook.
Key takeaways
- Thumb-2 ADD has 17 encodings because it supports different immediate, register, and stack-pointer forms, along with varying operand and instruction-width constraints.
- An ADD instruction with the S suffix updates APSR condition flags, enabling subsequent branches to test results such as zero or negative.
- The .N and .W suffixes request narrow 16-bit and wide 32-bit instruction encodings, respectively, and the assembler reports an error if the requested form is not possible.
- For ADD register, the encoding diagram maps Rd, Rn, and Rm to destination and source operands, while shift-type and shift-amount fields configure an optional shift of Rm before addition.
- ARM register numbers have special meanings: R13 is SP, R14 is LR, and R15 is PC, so using them in ADD can trigger restrictions, unpredictable behavior, or a recommendation to use a more suitable instruction.
- The ARMv7-M reference manual is most useful as a structured lookup tool: read the syntax, encoding fields, operand types, and constraints rather than trying to learn the architecture by reading it cover to cover.
Chapters
- Thumb-2 instructions fall into arithmetic and logic, data movement, branching and comparison, and miscellaneous groups.
- The ARMv7-M reference manual and ARM/Thumb-2 quick reference card are complementary resources for looking up unfamiliar instructions.
- Assembly lines can contain a label, mnemonic, operands, and a comment; for ADD, the first operand is typically the destination register.
- ADD has 17 instruction encodings across immediate, register, and stack-pointer-specific forms, reflecting different operand and encoding options.
- The optional S suffix updates the APSR condition flags, which can support later conditional branches based on results such as zero, negative, or overflow.
- The syntax includes optional conditional execution through IT blocks and .N or .W suffixes that request 16-bit narrow or 32-bit wide encodings.
- In ADD register, Rd is the destination, Rn is a source, and Rm can be shifted before addition; shift type and immediate fields determine the operation and amount.
- The encoding diagram specifies operand widths and bit ordering, including how shift fields are concatenated; the ordering is not always a simple linear sequence.
- R13 is the stack pointer, R14 the link register, and R15 the program counter, so ADD forms involving these registers have special restrictions or alternative instructions.
- The lecture assigns a Gradescope exercise to encode MOVS R0, R8 as a hexadecimal value using the manual's instruction entry.
- The reference manual documents the instruction set for lookup; it is not intended to teach the ARM processor like a textbook.
Transcript excerpt
0:00 all right welcome to East 373 uh I'm a lance and Sample and this module is how to read the arm V7 reference manual all right so just to recap we're in section one here we already went through the instruction set architecture which really defined the structure of the cortex uh core later on we're going to go through assembly instructions assembly program and binary interface we don't have a lot of time to spend on say some going through each assembly instruction so I wanted to take maybe 15 minutes or so to really dive into the reference manual so that you all had the skills and the background necessary to look through the reference manual and pull out information quickly so if you see a new instruction you're not that familiar with you can get to it and
0:49 review it quickly um So today we're going to go through a deep dive for the manual we're not going to look at everything we're just going to look at one command we're just going to look at the odd or the add command and that's not because somehow I think uh the ad plan is super important I mean of course it is but it's because by showing you this particular command and we can learn about how to look at the manual so that you can do it on your own later and then we'll end with a process practice problem which we'll review in our discussion sections all right so as we uh reviewed last time the thumb 2 architecture or the um thumb 2 instruction set here defines four basic types of instructions we have arithmetic and logic instructions um we have data movement structure
1:38 instructions that move things in and out of memory or around the registers we
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Interactive Sensing and Computing Lab.