Concept 1 of 71 min
Binary arithmetic: two's complement, fixed point, bits and ECC
Reading a negative byte
| Bits | 11111011 |
|---|
- Invert: 00000100, which is 4
- Add 1: 4 + 1 = 5
- So 11111011 is −5
Two's complement reads a negative by inverting and adding 1.
An 8-bit overflow
| Range | −128 to 127 |
|---|---|
| Values | 100 and 100 |
| Values in 8 bits | 256 |
- True sum = 100 + 100 = 200
- Wraps to 200 − 256 = −56
Without saturation, the sum silently changes sign.
A fixed-point product
| Format | Q8.8 |
|---|---|
| Fractional bits | 8 |
- Product bits = 8 + 8 = 16 fractional
- Shift right by 8 to return
After a fixed-point product, shift back by the fractional bits.
An overflow wraps by 2ⁿ. A fixed-point number with f fractional bits steps by 1/2f and a product's fractional bits add, a left shift drops the top bit of a fixed-width register, and ECC (error-correcting code) memory corrects single-bit errors.
Two's complement has one zero, so 8 bits give 128 negative values, zero and 127 positive ones; sign-and-magnitude wastes a pattern on −0. Wrapping is the default; saturating at the limit is common in signal processors but must be asked for.
After multiplying 2 fixed-point numbers, shift right by the fractional bits to return to the format, watching the integer part for overflow.
AND keeps bits set in both, OR in either, XOR (exclusive OR) in exactly one. ECC adds check bits that correct single-bit errors and detect double ones, which matters at scale and for long-running jobs. 8 bits cover −128 to 127 and 16 bits −32,768 to 32,767.
- Reading a negative pattern as unsigned.
- Expecting overflow to stop at the maximum.
- Forgetting that fractional bits add in a product.
A hardware team wants to process prices in fixed point instead of floating point. What would you ask before agreeing?
A complete answer covers
- What range and precision prices need: the integer and fractional bits.
- How products and sums are rescaled and rounded.
- What happens on overflow: wrap, saturate or flag.
- How results are checked against a floating-point reference.
Also in our technical interviews, on camera, with a score.
Concept 2 of 71 min
Boolean logic and state machines
The why, the charts, the worked example and the interview questions are in Essentials, with every quiz.
See the plansSign inConcept 3 of 71 min
Registers in Verilog: assignments, latches and loops
The why, the charts, the worked example and the interview questions are in Essentials, with every quiz.
See the plansSign inConcept 4 of 71 min
Clock limits, pipelining, power and bandwidth
The why, the charts, the worked example and the interview questions are in Essentials, with every quiz.
See the plansSign inConcept 5 of 71 min
Crossing clock domains and releasing resets
The why, the charts, the worked example and the interview questions are in Essentials, with every quiz.
See the plansSign inConcept 6 of 71 min
FPGAs: look-up tables, ASICs and trading
The why, the charts, the worked example and the interview questions are in Essentials, with every quiz.
See the plansSign inConcept 7 of 71 min
AdvancedHow wide an accumulator must be
The why, the charts, the worked example and the interview questions are in Essentials, with every quiz.
See the plansSign inRecap
- Two's complement: invert and add 1; n bits cover −2n−1 to 2n−1 − 1 and overflow wraps by 2ⁿ.
- Fixed point Qm.n steps by 1/2ⁿ; fractional bits add when you multiply.
- Maximum clock = 1/(longest path + register overheads); pipelining raises the clock and adds latency.
- A signal from another clock domain needs a 2-flop synchroniser; a multi-bit value needs Gray code or a FIFO (first in, first out).
- In clocked Verilog use <=; cover every branch or get a latch; an FPGA trades unit cost for no mask cost and deterministic speed.
25 questions on Digital design and FPGAs
Timed, like the real one, drawn from a bank of 33. Every answer explained.