C8 Computer organization · Practice
Multiplication, division and fixed point
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.
Check
What integer represents 0.25 in Q15?
Check
Two Q15 numbers, 16384 and 6554, are multiplied with mul and the product shifted right by 15 (rounding down). What integer results?
Check
A 12-bit ADC with a 2500 mV reference reads 1534. What does mul by 2500 followed by srli by 12 give, in millivolts?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
Check
What does div give for −23 ÷ 2?
Check
What does rem give for −23 and 2?
Check
Compute the dot product of the three-word vectors p and q (the sum of p[i] × q[i]) and leave it in a0.
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 a 12-bit ADC code; the reference is 3300 mV. Put the reading in millivolts in a1, rounded down.
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
Multiply 0.45 by 0.25 in Q15.
(a)
What integer stores 0.45?
(b)
What Q15 integer does the product, shifted right 15, give?
Check
What is the step between adjacent values of a Q-format number with 15 fraction bits?
Check
What value does the Q15 integer 8192 represent?
Check
How many bits can the product of an unsigned 12-bit number and an unsigned 10-bit number need?
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