Basic Assembly
Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.
Basic RISC-V Assembly
Arithmetic operations
For the following questions, assume register x1 is initialized to
0x00000005 and register x2 is initialized to 0x00000003. Note
that these are hexadecimal values so they represent 32-bit wide values
since the registers are all 32-bits wide. Assume that the registers
are reinitialized before each question. You may find the RISC-V ISA handout useful.
x3 after executing the instruction xor x3, x1, x2?
x3 after executing the instruction srli x3, x1, 2?
x4 after executing the instruction addi x4, x0, 7?
x4 after executing the instruction lui x4, 7?
Control flow instructions
Consider the following sequence of instructions:
addi x1, x0, 7
addi x2, x0, 2
bge x1, x2, L1
addi x2, x2, 4
L1: addi x2, x2, 5
x2 after execution of this code segment?
Now consider this slightly modified sequence of instructions:
addi x1, x0, 7
addi x2, x0, 2
blt x1, x2, L1
addi x2, x2, 4
L1: addi x2, x2, 5
x2 after execution of this code segment?