C8 Computer organization · Practice
Overflow, comparisons and big numbers
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
0 solved
0 in a row
0 of 9 kinds solid
Check
a1:a0 and a3:a2 hold two 64-bit numbers (high word first). Put their sum in a5:a4.
RISC-V RV32IM (base integer plus multiply and divide). End your program with ebreak. Tab indents; press Esc and then Tab to move on.
Check
Two unsigned 32-bit numbers, 3 × 10⁹ and 1.5 × 10⁹, are added.
(a)
What does add leave, as an unsigned number?
(b)
What carry does sltu find (1 or 0)?
Check
An n-bit register, n = 12.
(a)
What's the most negative two's-complement value?
(b)
What's the largest unsigned value?
Check
a0 holds a signed number and a1 a positive one. Put their sum in a2, saturated: if the addition overflows, a2 gets the largest signed value, 0x7FFFFFFF, instead.
RISC-V RV32IM (base integer plus multiply and divide). End your program with ebreak. Tab indents; press Esc and then Tab to move on.
Check
a0 holds −100 and t0 holds 10.
(a)
What unsigned value does bgeu see in a0?
(b)
Does bgeu a0, t0, out branch (1 for yes)?
Check
What does mulhu give for 2596069104 × 3?
Check
What does add leave for 4294967295 + 1 (unsigned)?
Check
What unsigned number has the same bits as −16?
Check
Does 9 − 9 borrow in unsigned arithmetic (1 for yes)?
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in C8