C8 Computer organization · Practice
Input and output: polling, interrupts and DMA
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
How many bytes per second does a 19200-baud UART carry (1 start, 8 data, 1 stop bit)?
Check
A 160 MHz processor takes 11520 interrupts a second, each costing 40 cycles. What percentage of its time do they use?
Check
A main loop checks a button once every 5 ms.
(a)
What is the longest the program can take to notice a press?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What is the average delay, for presses at random times?
Check
A converter delivers 48000 samples a second through DMA, in blocks of 64 samples with double buffering.
(a)
How many interrupts a second does the processor take?
(b)
How long does the processor have to finish each block?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A bus moves 16 bits per transfer at 8 million transfers a second. What is its bandwidth?
Check
Read the switches (at 0x20004) and show them on the LEDs (at 0x20000) with the low four bits inverted.
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
A UART at 1000000 baud (10 bits a byte) fills a 16-byte FIFO that interrupts at 12 bytes.
(a)
How long does the handler have before a byte is lost?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
How many interrupts a second?
Check
A 500 ksample/s ADC feeds a 100 MHz core; an interrupt costs 80 cycles.
(a)
What load does an interrupt per sample put on the core?
(b)
And DMA with an interrupt per block of 64?
Check
How long is one bit at 115200 baud?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
How long does a 10-byte message take at 9600 baud, 10 bit times a byte?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
1000 events a second, 50 cycles each, on a 72 MHz clock: what percentage load?
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