1. Conditional Logic (`if` statement)
Problem: Translate the C code for an OR condition into assembly. `x` is in R1, `y` in R2, `z` in R3, and `a` in R8.
Initial Register Values
CPU State
High-Level Code
Assembly Code
Explanation
2. Memory and Endianness
Problem: A processor uses big-endian representation. If a 32-bit integer `int x = 127;` is stored starting at memory address `100`, what is in memory location `103`? And how is `12345678H` stored?
Input Value
For `int x = 127`, the 32-bit hex value is `0000007F`.
Memory Layout (starting at address 100)
Big-Endian
Little-Endian
Explanation
3. The `while` Loop
Problem: Translate a `while` loop into assembly. `a` is in R1 and `i` is in R2.
Initial Register Values
CPU State
High-Level Code
Assembly Code
Explanation
4. The `for` Loop
Problem: Translate a `for` loop that sums numbers into assembly. `i` is in R1 and the sum `a` is in R8.
Initial Register Values
CPU State
High-Level Code
Assembly Code
Explanation
5. Instruction Format Design
Problem: A computer has a 32-bit instruction format. Given the memory size, number of registers, and addressing modes, calculate the bits required for each field.
System Parameters
Calculated Field Sizes (Total 32 bits)
Explanation
6. Bitwise & Arithmetic Operations
Problem: Execute a sequence of arithmetic and bitwise instructions. Initial values: R0 = 77H, R1 = 80H.
Initial Register Values (8-bit Hex)
CPU State (Hex)
C Equivalents
Assembly Code
Explanation
7. Array Copy Loop
Problem: Implement `for (i=0; i<10; i++) {a[i] = b[i];}` in assembly. R1 points to array `a`, R2 points to array `b`, and R3 is the counter `i`.