MAVILERA Armv7 Laboratory

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.

Getting started

  1. Open the application. The editor holds a short program that adds the numbers 1 to 10; Templates in the toolbar offers others, each with a note at the top on what to try.
  2. 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.
  3. 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.
  4. Press Step back (Shift+F10) to undo a step, or Run (F5) to run to the end or to a breakpoint.
  5. 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.

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.

FormWhat the assembler accepts
Data processingAND 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
MemoryLDR 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 transfersLDM (IA), STM (IA), STMDB, PUSH, POP
BranchesB, 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 mapThe 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

ViewRuns
InstructionsThe whole subset above
Processor views, Base designThe 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 datapathAlso 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

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 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.

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.

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 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.

  1. Pick an exercise and read its task; Load the starter program puts it in the editor.
  2. Write your program in place of the line done: B done, keeping the data lines the task names: the tests write their inputs there.
  3. 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

ExportContents
.hex, .binThe program's words, one per line for $readmemh, or raw bytes. Import .hex/.bin… loads one.
ListingAddresses, 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

Keyboard reference

KeysAction
Ctrl+EnterAssemble
F5Run or pause
F10 / Shift+F10Step / step back (one clock cycle in a processor view)
F11 / Shift+F11Step over / step out
Ctrl+F10Run to the editor's line
Ctrl+FFind in the editor
Esc, then TabLeave the editor (inside it, Tab indents)
↑ ↓, Enter, BIn the listing: move, show the fields, set or clear a breakpoint
↑ ↓, WIn the registers: move, watch
Arrow keys on a dividerResize panes (Shift for larger steps; Enter restores)
Enter on a drawn elementOpen its details

How the models were checked

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

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.