MAVILERA Armv7 Laboratory: documentation
Interactive Microprocessor Architecture Laboratory: Visualize. Execute. Understand.
About the laboratory
The Armv7 Laboratory assembles and runs programs in the 32-bit ARM instruction set (A32) in the browser. It has four views of the same program: an instruction-level model that runs one instruction per step, and the single-cycle, multicycle and pipelined processors of Sarah L. Harris and David Money Harris's textbook, each drawn as it works, one clock cycle per step.
The processors follow the textbook's microarchitecture, with its signal names; the drawings are this application's own layout of them. What every instruction does to the registers, the flags and the memory follows ARM's architecture reference manual.
Why it matters: ARM processors are found in most phones and in many embedded systems, and the textbook's processors are small enough to follow signal by signal. Every ARM instruction is conditional, and R15 is the program counter: the laboratory shows what these two features ask of the hardware.
- Digital Design and Computer Architecture: ARM Edition. S. L. Harris, D. M. Harris. Morgan Kaufmann (Elsevier), 2016. ISBN 978-0-12-800056-4. Chapter 6: architecture; Chapter 7: microarchitecture.
- ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition. ARM Limited, ARM DDI 0406C.d, 2018. Chapter A8: the instructions.
Getting started
- Open the application. The editor holds a short program that adds the numbers 1 to 10; Sample projects in the toolbar offer others, each with a note at the top on what to try.
- Press Assemble (Ctrl+Enter). The listing shows each instruction's 32-bit word with its address; errors are underlined in the editor and explained in the console.
- Press Step (F10) a few times. The current instruction is marked, and the registers and the flags N, Z, C and V change. An instruction whose condition fails is shown as skipped.
- Press Step back (Shift+F10) to undo a step, or Run (F5) to run to the end or to a breakpoint.
- Choose Single-cycle, Multicycle or Pipelined at the top to run the same program on a processor, one clock cycle per step.
The example program of a new session:
MOV R0, #0 ; R0 <- 0, the sum
MOV R1, #1 ; R1 <- 1, the next number
loop: ADD R0, R0, R1 ; sum <- sum + number
ADD R1, R1, #1 ; the next number
CMP R1, #10 ; flags of R1 - 10
BLE loop ; again while R1 <= 10 (signed)
STR R0, [R2, #100] ; M[R2 + 100] <- 55 (R2 is 0)
done: B done ; a branch to itself ends the program
It uses MOV and CMP, which the textbook's processors do not have: in a processor view,
choose Extended datapath in the instruction-set menu, or open the template
Base instructions only: the sum 1 to 10, written with the textbook's instructions.
The workspace
The page is a workspace of panes, as in a code editor.
- Header: the views (Instructions, Single-cycle, Multicycle, Pipelined); the instruction-set menu of a processor view (Base design or Extended datapath); the View menu (show or hide panes, reset the layout, the theme); projector mode; full screen; the keyboard summary; Help.
- Toolbar: Assemble, Run/Pause, Step back, Step, Step over, Step out, Run to cursor, Reset, the speed, Sample projects and the File menu. Each control has a tooltip with its name and key.
- Editor: ARM assembly, with completion of mnemonics and registers, help when you point at a mnemonic (its operands and its operation in register-transfer notation), find, and breakpoints in the line numbers.
- Listing: each instruction with its address and word, in hexadecimal and binary; the tabs Data and Symbols show the data and the labels.
- Instruction inspector: the fields of the selected instruction (Cond, Op, Funct, Rn, Rd and the operand fields) and a scratch line that turns one instruction into its word, or a word into its instruction, without changing the program.
- Registers, call stack and counters: R0 to R15 (with SP, LR and PC), the CPSR flags; one frame
per open
BL; counts of instructions, skipped conditions, loads, stores and branches. - Memory and console: the memory, and the console with the assembler's and the processors' messages.
Drag a divider to resize panes; the sizes are kept in this browser for each view.
Assembly language
One instruction or directive per line, with an optional label (ending in :) and an optional comment
(after ; or //). Mnemonics are not case-sensitive. A condition and S follow the mnemonic:
ADDEQ, SUBS, BNE.
| Form | What the assembler accepts |
|---|---|
| Data processing | AND EOR SUB RSB ADD ADC SBC RSC TST TEQ CMP CMN ORR MOV BIC MVN and the shifts LSL LSR ASR ROR RRX; the second operand an immediate, a register, or a register shifted by a constant or by a register |
| Memory | LDR STR LDRB STRB with [Rn, #offset], a register offset, pre-indexing with ! and post-indexing; LDR Rd, =value from a literal pool after the code; ADR |
| Block transfers | LDM (IA), STM (IA), STMDB, PUSH, POP |
| Branches | B, BL; NOP. A branch to itself, B ., ends the program. |
| Immediates | # then a number: an 8-bit value rotated right by an even amount; a constant that cannot be encoded is refused with a hint |
| Directives | .text .data .word .byte .ascii .asciz .space .align .balign .equ .set .global |
| Memory map | The code starts at address 0, .data at 0x10000; SP starts at 0x100000 |
An instruction that ARM's manual calls UNPREDICTABLE, such as writeback to the base register of a load into the same register, is refused with the rule it breaks. Thumb, the multiply instructions, halfword transfers and the status-register and coprocessor instructions are outside the laboratory's subset.
Instruction sets of the views
| View | Runs |
|---|---|
| Instructions | The whole subset above |
| Processor views, Base design | The textbook's processor: ADD SUB AND ORR with a register or an immediate, with or without S; LDR and STR with a positive offset; B; each with any condition |
| Processor views, Extended datapath | Also CMP CMN TST TEQ, MOV and the shifts LSL LSR ASR ROR, register operands shifted by a constant, ADC SBC RSB EOR BIC, BL, LDRB and negative offsets |
In the processor views an immediate must have rotation 0 (0 to 255), as in the textbook's processor. The assembler of a processor view refuses an instruction outside its set and names the view that runs it.
Running and debugging
- Breakpoints: click a line number in the editor or an address in the listing (B on a row).
- Watchpoints: tick a register's eye to stop when it is written; double-click a memory word, or use Watch, to stop when it is written.
- Step back undoes one step at a time, back to the start of the run, in every view.
- Step over (F11) runs a
BLto its return; Step out (Shift+F11) runs to the return of the present subroutine; Run to cursor (Ctrl+F10) stops at the editor's line. A return is a write of LR to the PC, byMOV PC, LRorPOP {…, PC}. - The processors stop with a message where the hardware would go wrong: an instruction outside their set, an unaligned word access, or an odd address written to the PC.
The single-cycle processor
Each step is one clock cycle and one instruction. The drawing highlights the connections the instruction uses, marks the multiplexer inputs it selects and shows the values of the control signals; Class path shows all the connections of one instruction class.
- The Condition Check compares the instruction's Cond field with the flags and gives CondEx; AND gates let the
decoder's requests PCS, RegW, MemW and FlagW through only when CondEx is 1. An instruction whose condition fails
passes through the datapath but writes nothing; the gates are marked
CondEx = 0. - R15 reads as the instruction's address plus 8 (PCPlus8); a write to R15 goes to the PC.
- The tabs: Cycle (the cycle in register-transfer notation, each line followed by the same line with this cycle's values, and every signal), Control (the Main Decoder and ALU Decoder with the rows in use, the PC Logic and the Conditional Logic), Timing and Waveforms.
The multicycle processor
Each step is one clock cycle, one state of the controller's finite-state machine. One memory holds instructions and data, and one ALU also adds 4 to the PC. The registers IR, Data, A, WriteData and ALUOut carry values from one step to the next.
- Ten states, S0 Fetch to S9 Branch:
Btakes 3 cycles, a data-processing instruction andSTR4,LDR5. - The condition reaches the write gates one clock edge late, as CondExDelayed, so that the flags an instruction writes cannot stop its own write-back.
- Instruction ▶ runs the rest of the instruction, up to the next Fetch; ◀ Instruction steps back to its Fetch. State diagram shows the controller in place of the datapath.
- The tabs: Controller (every state's outputs, the next state, the decoders), Cycle (the state in register-transfer notation, with its values), Registers between steps, States over time, Timing and Waveforms.
The pipelined processor
Five stages, IF, ID, EX, MEM and WB, each work on their own instruction in every cycle; the strip above the drawing names them, and the drawing highlights the connections each uses. Registers held at the next edge are marked stall, cleared ones flush.
- The hazard unit forwards results to EX from MEM (ALUOutM) or WB (ResultW), the newer first; stalls one cycle for an instruction that uses a loaded value at once; removes the two instructions behind a taken branch; and holds the fetch while a write to R15 is on its way to WB.
- Hazard handling switches parts of the hazard unit off (Forwarding only, None) to show what goes wrong; Stop on stops a run at a stall, a flush or a taken branch.
- The tabs: Pipeline diagram (one row per instruction, one column per cycle), Stages (what each stage does this cycle, in register-transfer notation with its values), Hazards (this cycle's forwarding, stalls and flushes in words, and the hazard unit's equations), Lost cycles (by cause, and the cycles per instruction built as the textbook's Example 7.7 builds them), Pipeline registers, Signals, Timing and Waveforms.
One equation of the textbook's hazard unit is changed. As printed, StallF holds the PC while a write to R15 is in ID, EX or MEM, even when a taken branch in EX is loading its target, so a branch followed at once by a write to R15 would lose its target. Here StallF = (LDRstall OR PCWrPendingF) AND NOT BranchTakenE; the view names the cycles where this matters. The textbook's design is otherwise kept as it is, including stalls that no register needs, which the view names.
The Extended datapath
The textbook's Chapter 7 exercises ask for further instructions on its processors. Extended datapath, in the instruction-set menu of each processor view, shows this application's own design for them, drawn over the textbook's processor with the added parts spread in:
- a shifter on the second operand, which also gives the carry of a logical instruction with S;
- a four-bit ALU control taking the instruction's operation directly, with the flags as an input for
ADCandSBC; - NoWrite, which keeps
CMP,CMN,TSTandTEQfrom writing a register; - a link path for
BL(R14 written with the return address), and a byte unit forLDRB; - in the multicycle processor two added states for
BL, Link and BranchL, drawn dashed.
A badge on each Extended drawing says that it is not the textbook's processor.
Timing
The Timing tab of each processor view computes critical paths from a table of illustrative delays chosen for this application (not the textbook's table), which you can edit: the path of the present instruction, state or stage, the clock period the slowest one sets, and, in the multicycle and pipelined views, the time of the program on all three processors. The numbers show how the designs compare; they do not describe any real chip.
Exercises
File ▸ Exercise… lists practice exercises written for MAVILERA, in three groups: the base processor's instructions (they also run in all three processor views), the Chapter 7 extensions (for the Extended datapath) and instruction-level forms (for the Instructions view). Each opens with a starter program.
- Pick an exercise and read its task; Load the starter program puts it in the editor.
- Write your program in place of the line
done: B done, keeping the data lines the task names: the tests write their inputs there. - Press the Exercise button in the toolbar, then Run the tests. Each test writes its
data into memory, runs your program on the instruction-level model until
B ., and shows the expected and actual registers, flags and memory.
No solutions are included. A teacher's exercise file (JSON, with "arch": "armv7") opens with
File ▸ Open; its tests set memory words or bytes and check R0 to R15, the flags and memory.
Files, sharing and exports
- Your work is kept in this browser: after a refresh or a closed tab, the program, its file name, the cursor, breakpoints, watchpoints and the step you had reached come back.
- File ▸ Copy share link puts the program, the view and its settings into a link. They travel in the
part after
#, which the browser never sends to a server. - File ▸ Save program and settings… writes a
.jsonfile; File ▸ Open reads it back, and also.sfiles. - File ▸ Data in and out… loads words into memory before a run, and saves a memory range.
| Export | Contents |
|---|---|
.hex, .bin | The program's words, one per line for $readmemh, or raw bytes. Import .hex/.bin… loads one. |
| Listing | Addresses, words and source lines |
| Trace (JSON lines, CSV) | One record per instruction from reset to the end |
| Drawing (SVG, PNG) | The processor drawing of the present cycle, from the Display menu |
| Waveform, VCD (processor views) | The signals of the processor, one clock per cycle |
The run exports replay the program from reset to its end; the session you are in is not changed.
Offline use and privacy
- After a first visit, the hosted application opens without a network connection.
- The single-file version, offered on the Documentation and Download pages, is one
.htmlfile that opens from the local disk and makes no network request. - No account, no tracking, no upload: programs, data files and exports never leave the browser.
Keyboard reference
| Keys | Action |
|---|---|
| Ctrl+Enter | Assemble |
| F5 | Run or pause |
| F10 / Shift+F10 | Step / step back (one clock cycle in a processor view) |
| F11 / Shift+F11 | Step over / step out |
| Ctrl+F10 | Run to the editor's line |
| Ctrl+F | Find in the editor |
| Esc, then Tab | Leave the editor (inside it, Tab indents) |
| ↑ ↓, Enter, B | In the listing: move, show the fields, set or clear a breakpoint |
| ↑ ↓, W | In the registers: move, watch |
| Arrow keys on a divider | Resize panes (Shift for larger steps; Enter restores) |
| Enter on a drawn element | Open its details |
How the models were checked
- The four models (instruction level, single-cycle, multicycle, pipelined, each processor in both designs) were run on 10 000 generated programs and compared at every completed instruction: no difference.
- The instruction-level model was compared with QEMU's user-mode ARM emulator (8.2.2) on 1 000 of those programs: the registers, flags and memory agreed in all 1 000. The assembler's words were compared with the GNU assembler (binutils 2.42) on 90 948 words: no mismatch; GNU refuses one valid but deprecated form, which the processors stop at run time.
- The single-cycle processor (base design) was compared signal by signal with the textbook's published hardware description, in a Verilog simulator, on 402 programs: no difference in 416 960 values.
The Extended datapaths are this application's own design: no hardware description of them exists to compare with. Agreement between models and tools is evidence about the models, not about any physical chip.
Limits of the model
- The laboratory runs the subset of A32 described above, in user mode, with a flat memory: no Thumb, no exceptions or interrupts, no caches, no devices.
- The processor views are teaching models of the textbook's designs. A simulation shows what the model does; it is not evidence of how a hardware build behaves.
- Timing uses illustrative delays, not those of a real process.
Licence and notices
© 2026 Sajid Muhaimin Choudhury. MAVILERA and its content (drawings, help texts, this documentation, example programs and exercises) are licensed under the Apache License, Version 2.0. The names and the logo are not licensed as trademarks.
The textbook Digital Design and Computer Architecture: ARM Edition is © 2016 Elsevier Inc.; the ARM Architecture Reference Manual is © ARM Limited. MAVILERA reproduces no text or figure of either: its simulator, drawings, help and programs are its own, and its drawings show the textbook's processors in its own layout. It is not affiliated with or endorsed by the authors, the publisher or Arm. Arm is a trademark of Arm Limited or its subsidiaries.