D10 Digital design, Verilog and FPGAs · Practice
Every topic, mixed
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.
Topics: all 13
Check
An FPGA design has 256 operators each finishing one operation per clock at 100 MHz. How many billion operations per second does it perform?
Check
A logic path has 6 levels of gates, each with a delay of 50 ps. Ignoring flip-flop overhead, what's the fastest clock it allows?
Write units the way you normally would: 1.5 GHz, 1500 MHz and 0.0015 THz are the same answer.
Check
A filter needs 25 multiplications per pixel on 1920 × 480 video at 60 frames per second. How many multipliers running at 150 MHz does it need?
Check
In a timing simulation, an output sits 4 gate levels from the inputs, and each gate takes 2 ticks. How many ticks after an input changes does the output settle?
Check
A path passes through 8 levels of gates of 40 ps each.
(a)
How long does it take to settle?
Write units the way you normally would: 1.5 ps and 0.0015 ns are the same answer.
(b)
What clock rate does that allow, ignoring flip-flop overhead?
Check
1024 numbers are summed.
(a)
How many additions in sequence does one adder need?
(b)
How many levels does an adder tree need?
Check
Throughput: 1 operators at 50 MHz?
Check
Fastest clock: 1 levels of 10 ps?
Write units the way you normally would: 1.5 GHz, 1500 MHz and 0.0015 THz are the same answer.
Check
How many configuration bits does a 4-input LUT hold?
Check
How many different functions can a 3-input LUT implement?
Check
About how many 3-input LUTs does a 16-input AND gate need?
Check
A device has 100 thousand 4-input LUTs. How many million configuration bits do the LUTs alone hold?
Check
An n-input AND, n = 24, is built from 4-input LUTs.
(a)
How many LUTs does it need?
(b)
How many configuration bits does each LUT hold?
Check
A 16-bit equality comparator is built from 6-input LUTs, three bit pairs per LUT, then the results are ANDed.
(a)
How many LUTs compare the bit pairs?
(b)
How many LUTs in all, counting those that AND the results (6 inputs each)?
Check
Bits in a 4-LUT?
Check
LUTs for a 13-input AND with 3-LUTs?
Check
A multiplexer chooses among 5 inputs. How many select bits does it need?
Check
A shift-and-add multiplier handles one bit of a 16-bit multiplier per cycle at 50 MHz. How long does a multiplication take?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
A state machine has 9 states. How many flip-flops does binary encoding need?
Check
A register file holds 16 registers of 8 bits. How many bits does it store?
Check
A controller has 9 states.
(a)
How many flip-flops does binary encoding need?
(b)
And one-hot?
Check
A register file has 32 registers of 16 bits and 3 read ports.
(a)
How much does it store?
(b)
How many read-address bits does it need in all?
Check
Select bits for 6 inputs?
Check
Shift-and-add time: 16 bits at 10 MHz?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
A ripple-carry adder has 16 bits, and each full adder adds 2 gate delays to the carry path. How many gate delays does the final carry take?
Check
How many bits wide is the concatenation of an 8-bit, a 1-bit and a 4-bit vector?
Check
A 4-bit adder adds 11 and 3 with no carry in.
(a)
What is the 4-bit sum?
(b)
What is the carry out?
Check
The 4-bit pattern 1011 is extended to 8 bits.
(a)
What unsigned 8-bit value does sign extension give?
(b)
What signed number is it?
Check
Write a half adder's sum using only AND, OR and NOT.
Write AND as · or & (or just AB), OR as +, XOR as ⊕, and NOT as ¬ or a trailing ': A·B + C' works.
Check
Carry delay: 8 bits, 1 delays each?
Check
A bit enters a 16-stage shift register clocked at 25 MHz. How long until it reaches the output?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
Registers a and b start at a = 1, b = 0 and swap with nonblocking assignments at every clock edge. What is a after 4 edges?
Check
A shift register has 16 stages clocked at 25 MHz.
(a)
How long does a bit take to come out the end?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
(b)
How many bits does it hold at once?
Check
always @(posedge clk) begin a <= b; b <= a; end starts with a = 0, b = 1.
(a)
What is a after 3 clocks?
(b)
And b?
Check
Delay through 8 stages at 10 MHz?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
a = 0, b = 1, swapped with nonblocking assignments every edge. What's a after 5 edges?
Check
A state machine must wait 1 s, counting a 1 kHz clock. How many bits does its counter need?
Check
How many states can a binary-encoded state machine with 5 flip-flops have at most?
Check
A debounce timer must wait 50 ms on a 25 MHz clock.
(a)
How many ticks is that?
(b)
How wide must the counter be?
Check
A detector for an overlapping 4-bit sequence with no internal repeats (like 1000…01 patterns) is built as a Mealy machine.
(a)
How many states does it need (one for each prefix seen, from none to 4 − 1 bits)?
(b)
And as a Moore machine, which needs a state for the full match?
Check
Counter bits: 0.01 s at 1 kHz?
Check
Maximum states with 4 binary flip-flops?
Check
A block has 24 input bits in all. How long does exhaustive testing take at 1000000 tests per second?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A testbench toggles its clock with always #4 clk = ~clk; and a timescale unit of 1 ns. What frequency is the clock?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
Check
A two-bit counter starts at 0. What value, in decimal, does it hold after 6 clocks?
Check
A 12-bit × 12-bit multiplier is tested exhaustively at 1 thousand tests per second.
(a)
How many tests are there?
(b)
How long do they take?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A random testbench drives a 12-bit input with 1000 random values.
(a)
What is the chance it hits one particular value at least once?
(b)
On average, how many times does it hit that value?
Check
A testbench checks a 24+24-bit adder exhaustively, every pair of inputs, at 1 million vectors per second.
(a)
How many vectors is that?
(b)
How many days does it take?
Check
Exhaustive time: 16 bits at 1000 tests/s?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
Two-bit counter after 3 clocks?
Check
A path has 0.1 ns clock-to-output, 1.5 ns of logic and 0.2 ns of setup time. What's the fastest clock it allows?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
Check
A 200 MHz design has a path with 0.2 ns clock-to-output, 3.5 ns of logic and 0.15 ns setup. What's its setup slack?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
A synchronizer with τ = 50 ps and = 1 ns allows 2 ns to resolve, on a 100 MHz clock with data changing 10 million times a second. What's its MTBF?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A flip-flop with 0.1 ns clock-to-output feeds another through 0.03 ns of logic, and the second needs 0.25 ns of hold. What's the hold slack?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
A path has 0.2 ns clock-to-output, 2 ns of logic and 0.3 ns of setup, clocked at 200 MHz.
(a)
What is its maximum clock?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
(b)
What is its slack at 200 MHz?
Check
A synchronizer has τ = 50 ps and = 0.1 ns, with 0.5 ns to settle, on a 100 MHz clock sampling data that changes 10 million times a second.
(a)
What is its MTBF?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
(b)
By how many powers of ten does a second flip-flop, adding 10 ns of settling, raise it?
Check
: 0.05 + 0.5 + 0.3 ns?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
Check
MTBF: 0.5 ns to resolve, 50 MHz clock, 50 M changes/s (τ = 50 ps, = 1 ns)?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
Logic taking 10 ns is split into 2 balanced stages with 0.6 ns of register overhead each. What clock rate does it allow?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
Check
For that pipeline (10 ns of logic, 2 stages, 0.6 ns overhead each), how long does one result take from input to output?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
How many cycles does a 5-stage pipeline take to process 10 independent items?
Check
A pipeline's three stages take 2, 4 and 5 ns of logic, each plus 0.5 ns of overhead. What clock period does it need?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
A combinational job of 10 ns is split into 4 equal pipeline stages, each adding 0.5 ns of register overhead.
(a)
What clock rate results?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
(b)
What is the latency?
Check
In a pipelined processor, 20% of instructions stall for 1 cycle(s) each.
(a)
What is the CPI?
(b)
What share of the ideal throughput does it get?
Check
: 1 ns in 1 stages, 1 ns overhead?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
Check
Cycles for 1 items through 3 stages?
Check
How many address bits does a memory of 1024 words need?
Check
A 1000-word burst arrives at 100 M words/s while the reader takes 80 M words/s. How many words must the FIFO hold?
Check
A 4096-word, 8-bit memory is built from 36-kilobit block RAMs. At least how many does it need?
Check
A FIFO of depth 256 detects full and empty with pointers that carry one extra bit. How wide is each pointer?
Check
A memory holds 4096 words of 8 bits.
(a)
How many bits?
(b)
How many 36-kilobit block RAMs at least?
Check
A burst of 100 words is written at 100 MHz while the reader drains at 50 MHz.
(a)
How many words pile up?
(b)
What power-of-two FIFO depth holds them?
Check
Address bits for 16 words?
Check
FIFO depth: burst 10, write 100, read 99?
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
At 115200 baud with 8N1 framing, how many bytes per second can a UART carry?
Check
A 50 MHz clock is divided by the nearest whole number to make 9600 baud. What's the percentage error in the baud rate?
Check
A frame has a start bit, 9 data and parity bits, and a stop bit sampled at its middle. What total clock mismatch, in percent, keeps that last sample within half a bit?
Check
A 50 MHz FPGA makes 9600 baud with a counter.
(a)
What divisor?
(b)
What is the rate's error?
Check
A receiver oversamples 115200 baud by 8.
(a)
How long is a bit?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
How precisely does it locate the middle of each bit (one sample tick)?
Check
Bit time at 115200 baud?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
8N1 bytes per second at 9600 baud?
Check
A video filter processes 1920 × 720 pixels at 60 frames per second, with 25 multiplications per pixel, on a 100 MHz FPGA.
(a)
How many billion multiplications per second does it need?
(b)
How many multipliers working in parallel?
Check
A 16-bit ripple-carry adder passes the carry through each bit in 50 ps, plus 4 levels of gates at each end costing 50 ps each.
(a)
What is its worst-case delay?
Write units the way you normally would: 1.5 ps and 0.0015 ns are the same answer.
(b)
What would a lookahead adder with carry levels take?
Check
A 20-input function that only ANDs its inputs is built from 4-input LUTs; the device has 50,000 LUTs.
(a)
How many LUTs does it take?
(b)
How much LUT configuration memory does the device hold?
Check
A controller has 11 states.
(a)
How many flip-flops does binary encoding need?
(b)
How many codes are unused?
(c)
How many more flip-flops does one-hot use?
Check
A debounce counter must wait 20 ms on a 27 MHz clock, and a shift register of 32 stages runs on the same clock.
(a)
How wide is the debounce counter?
(b)
How long does a bit take to pass through the shift register?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
A 12-bit × 12-bit multiplier can be simulated at 10 thousand tests a second. A random testbench runs 100000 tests.
(a)
How long would exhaustive testing take?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
(b)
What is the chance the random testbench hits one particular input pair?
Check
A path has 0.2 ns clock-to-output, 2.5 ns of logic and 0.3 ns setup. A second, short path has the same 0.2 ns clock-to-output and a 0.05 ns wire into a flip-flop that needs 0.2 ns of hold.
(a)
What is the long path's maximum clock?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
(b)
What is the short path's hold slack (negative for a violation)?
Check
A one-flip-flop synchronizer leaves 1 ns of settling time; τ = 50 ps, = 0.1 ns, the clock is 100 MHz and data changes 10 million times a second.
(a)
What is its MTBF?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
(b)
How many powers of ten does a second flip-flop add (one more clock period of settling)?
Check
A 12 ns job is split into 4 equal stages, each with 0.5 ns of register overhead, and 100 items flow through.
(a)
What is the clock period?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
(b)
How long do all 100 items take?
(c)
What speedup is that over an unpipelined design (period L + 0.5 ns)?
Check
In a five-stage processor, 15% of instructions are loads followed by a dependent use (1 stall), and 10% are taken branches costing 3 cycle(s) each.
(a)
What is the CPI?
(b)
What share of the lost cycles comes from branches?
Check
A memory holds 8192 words of 9 bits.
(a)
How many 36-kilobit block RAMs at least?
(b)
How many address bits?
Check
Bursts of 300 words arrive at 100 MHz into a FIFO of 512 words, drained at 40 MHz.
(a)
How many words pile up?
(b)
Does the FIFO hold them (1 for yes)?
(c)
How wide are its pointers, with the extra wrap bit?
Check
A 27 MHz FPGA runs a UART at 9600 baud with 16× oversampling.
(a)
What divisor for the 16× tick?
(b)
What is the rate's error?
Check
A RISC-V instruction is 00A28293.
(a)
What is its opcode (bits 6 to 0), in decimal?
(b)
What is rd (bits 11 to 7)?
(c)
What is rs1 (bits 19 to 15)?
Check
A loop of 4 instructions runs 5 times between 3 setup and 6 closing instructions, on a single-cycle core at 50 MHz.
(a)
How many instructions run?
(b)
How long does it take?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
Which register does the instruction 00530333 write? (rd is bits 11:7.)
Check
A program spends 2 instructions setting up, runs a 3-instruction loop 10 times and then 6 more instructions. How many instructions does it execute?
Check
A single-cycle core runs 1000 instructions at 25 MHz. How long does it take?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
A single-cycle lw takes 0.2 ns to fetch, 0.2 ns to decode, 0.8 ns for registers and the ALU, 2 ns of data memory, 0.3 ns of multiplexing and 0.2 ns to write back. What's the fastest clock?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
Check
A single-cycle core runs 100 instructions at 25 MHz.
(a)
How long does it take?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
A pipelined version clocks 1.5 times faster but needs a CPI of 1.3. How long does it take?
Check
A loop body of 3 instructions runs 4 times, after 3 setup instructions and before 6 more.
(a)
How many instructions run in all?
(b)
What share is the loop?
Check
Run time: 10 instructions at 10 MHz, CPI 1?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
rs1 (bits 19:15) of 00530333?
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to D10