Loading…
Loading…
advanced · riscv · 220 XP
Sign in to write your solution, run it in the simulator and submit it for grading.
Sign in or create a free account →Input: op=ADD, a=5, b=7
Output: y=12, zero=0
Plain addition
Input: op=SUB, a=5, b=7
Output: y=0xFFFFFFFE
-2 in two's complement
Input: op=SLT, a=0xFFFFFFFF, b=1
Output: y=1
-1 < 1 when signed
Input: op=SLTU, a=0xFFFFFFFF, b=1
Output: y=0
4294967295 is not < 1 unsigned
Input: op=SRA, a=0x80000000, b=4
Output: y=0xF8000000
The sign bit is copied in
Input: op=SRL, a=0x80000000, b=4
Output: y=0x08000000
Zeros are shifted in