Digital Electronics & Verilog
Rebuild digital logic in Verilog the way DV interviews expect — number systems and Boolean minimization, combinational and sequential blocks, Mealy/Moore FSMs, memories and FIFOs, and a synthesizable coding style checked by a self-checking testbench.
By the end you can
- Reason about signed/unsigned arithmetic and minimize logic from a truth table
- Write synthesizable combinational and sequential RTL from a spec
- Code counters, memories, FIFOs and Mealy/Moore FSMs fluently
- Wrap a design in a self-checking testbench with a golden model
0 / 13 assignments done
Move each assignment through the stages — progress saves automatically.
Number systems, Boolean logic & Verilog basics
0/3Represent and compute in binary, minimize logic from a truth table, and write your first structural and behavioral Verilog.
Signed adder/subtractor with status flags
Build an N-bit adder/subtractor (parameterizable width) that computes A+B or A-B based on a mode bit, and emits carry-out, overflow, zero and negative flags. Treat the operands as two's-complement signed numbers.
Requirements
- Parameter WIDTH controls the operand size
- sub=1 performs A-B via two's-complement of B
- Overflow is detected from the sign bits, not carry-out
- zero, negative, carry, overflow flags are all correct
You'll be able to
- Explain the difference between carry-out and signed overflow
- Implement subtraction with a single adder and an XOR row
Submitting your solution link marks this assignment done.
A full worked solution with a step-by-step walkthrough — included with the domain pack and All-Access. Try it yourself first.
Minimize a Boolean function and map it to gates
Given a 4-variable truth table (with two don't-cares), derive the minimal sum-of-products by hand, then code the result two ways: a gate-level (structural) module and an equivalent behavioral assign. Show they match.
Requirements
- A K-map worked out in comments with the chosen prime implicants
- One structural module using primitive gates
- One behavioral module using a single assign
- A short testbench proving both agree for all 16 inputs
You'll be able to
- Reduce logic with a K-map including don't-cares
- Relate a Boolean expression to both structural and behavioral RTL
Submitting your solution link marks this assignment done.
A full worked solution with a step-by-step walkthrough — included with the domain pack and All-Access. Try it yourself first.
4-bit ripple-carry adder from a full-adder
Write a 1-bit full_adder module, then instantiate four of them to build a 4-bit ripple-carry adder. Use a generate loop so the width is easy to change.
Requirements
- A reusable full_adder module (sum, cout)
- A parameterized top that chains carries with a generate-for
- Correct port connections between stages
- A directed testbench covering a few key vectors
You'll be able to
- Build hierarchy by instantiating a leaf cell
- Use generate loops to parameterize structure
Submitting your solution link marks this assignment done.
A full worked solution with a step-by-step walkthrough — included with the domain pack and All-Access. Try it yourself first.
Combinational building blocks
0/3Design the muxes, decoders, encoders and an ALU that show up in every combinational round — and write procedural logic without accidental latches.
Parameterizable mux, decoder and priority encoder
Build three parameterized blocks: an N:1 multiplexer, a 3-to-8 decoder with enable, and an 8-to-3 priority encoder that also outputs a 'valid' bit. Keep them purely combinational.
Requirements
- N:1 mux selected by $clog2(N) select bits
- Decoder respects the enable input
- Priority encoder resolves the highest set bit and flags valid
- No inferred latches (every output assigned on all paths)
You'll be able to
- Write scalable combinational blocks with parameters
- Distinguish an encoder from a priority encoder
Submitting your solution link marks this assignment done.
A full worked solution with a step-by-step walkthrough — included with the domain pack and All-Access. Try it yourself first.
8-bit ALU with status flags
Design an 8-bit ALU supporting ADD, SUB, AND, OR, XOR, shift-left, shift-right and compare, selected by an opcode. Produce zero, carry, negative and overflow flags where they apply.
Requirements
- At least 8 operations selected by an opcode
- Arithmetic ops set carry/overflow correctly; logic ops clear them sensibly
- A single combinational result with no latches
- A testbench exercising each opcode and its flags
You'll be able to
- Fold an arithmetic and logic datapath into one block
- Reason about which flags are meaningful per operation
Submitting your solution link marks this assignment done.
A full worked solution with a step-by-step walkthrough — included with the domain pack and All-Access. Try it yourself first.
Procedural coding: blocking, nonblocking & latches
Take a small buggy block that infers an unintended latch and mixes blocking/nonblocking assignments, and fix it. Explain in comments why each change matters.
Requirements
- Combinational logic uses blocking (=) in always @*
- Sequential logic uses nonblocking (<=) in always @(posedge clk)
- Every combinational output is assigned on all paths (no latch)
- A note explaining the simulation-vs-synthesis reason for each rule
You'll be able to
- Apply the blocking/nonblocking rule correctly
- Recognize and remove an inferred latch
Submitting your solution link marks this assignment done.
A full worked solution with a step-by-step walkthrough — included with the domain pack and All-Access. Try it yourself first.
Sequential logic & finite state machines
0/3Clocked design you can defend: flip-flops, counters, shift registers, and Mealy vs Moore state machines — plus reusable tasks and functions.
Counter and shift register with load & enable
Build a WIDTH-bit up/down counter with synchronous load, count-enable and a synchronous reset, and a universal shift register (hold / shift-left / shift-right / parallel-load). Share a clean reset style.
Requirements
- Counter supports up/down, load, enable and synchronous reset
- Shift register supports the four standard modes via a 2-bit control
- Consistent reset polarity and style across both
- A testbench that checks wrap-around and each shift mode
You'll be able to
- Code clocked registers with control inputs cleanly
- Choose and justify synchronous vs asynchronous reset
Submitting your solution link marks this assignment done.
A full worked solution with a step-by-step walkthrough — included with the domain pack and All-Access. Try it yourself first.
Overlapping '1011' sequence detector (Mealy & Moore)
Design an FSM that raises a pulse whenever the serial input has produced the overlapping pattern 1011. Implement it twice — once as a Mealy machine and once as a Moore machine — and compare their output timing.
Requirements
- Overlapping matches are detected (e.g. 1011011)
- A clean three-block or two-block FSM coding style
- Both Mealy and Moore versions with named states
- A testbench and a note on the one-cycle timing difference
You'll be able to
- Draw and code a state diagram for a pattern detector
- Explain when Mealy vs Moore output timing matters
Submitting your solution link marks this assignment done.
A full worked solution with a step-by-step walkthrough — included with the domain pack and All-Access. Try it yourself first.
Reusable helpers: parity and clog2 functions
Write an automatic function that returns even parity of a vector and a function that computes ceil-log2 of a parameter, then use both inside a small design so the width scales automatically.
Requirements
- A pure function (no side effects) for parity
- A clog2 function used to size a bus at elaboration
- The automatic keyword where recursion or reentrancy is needed
- A short check that parity toggles as expected
You'll be able to
- Factor repeated logic into functions
- Size buses from parameters with clog2
Submitting your solution link marks this assignment done.
A full worked solution with a step-by-step walkthrough — included with the domain pack and All-Access. Try it yourself first.
Memories, synthesizable style & verification
0/4Storage, a synthesizable coding discipline, and a self-checking testbench — the RTL-to-DV handoff.
Single-port RAM and a 2R1W register file
Model a synchronous single-port RAM (registered read) and a register file with two read ports and one write port. Handle the read-during-write case explicitly and document the behavior you chose.
Requirements
- Parameterized DEPTH and WIDTH using clog2 addressing
- Synchronous write; choose and document read-first or write-first
- Register file: two combinational (or registered) reads, one write
- A testbench that hits the read-during-write corner
You'll be able to
- Model memories the way synthesis tools infer them
- Reason about read/write collision behavior
Submitting your solution link marks this assignment done.
A full worked solution with a step-by-step walkthrough — included with the domain pack and All-Access. Try it yourself first.
Synchronous FIFO with full/empty flags
Design a synchronous (single-clock) FIFO of parameterized depth with write/read pointers and correct full and empty detection. Use one extra pointer bit to distinguish full from empty.
Requirements
- Parameterized DEPTH (power of two) and WIDTH
- full and empty derived from wptr/rptr with the extra MSB trick
- No overflow on write-when-full or underflow on read-when-empty
- A testbench that fills, drains and interleaves operations
You'll be able to
- Implement pointer-based FIFO flag logic
- Explain the extra-bit trick for full vs empty
Submitting your solution link marks this assignment done.
A full worked solution with a step-by-step walkthrough — included with the domain pack and All-Access. Try it yourself first.
Make it synthesizable: kill latches & fix reset
Given a block that simulates fine but won't synthesize cleanly (inferred latches, a mixed reset, and a non-constant loop bound), refactor it into synthesizable RTL and list what each fix changed.
Requirements
- No inferred latches (full assignment or defaults)
- One consistent reset scheme with constant reset values
- Only synthesizable constructs (no delays, static loop bounds)
- A short before/after note on each issue
You'll be able to
- Separate simulation-only code from synthesizable RTL
- Apply a consistent, tool-friendly reset style
Submitting your solution link marks this assignment done.
A full worked solution with a step-by-step walkthrough — included with the domain pack and All-Access. Try it yourself first.
Self-checking testbench with a golden model
Wrap one of this module's designs (say the ALU or FIFO) in a self-checking testbench: generate stimulus, compute the expected result with a simple reference model, compare automatically, and print a pass/fail summary.
Requirements
- Stimulus generation (directed plus a few randomized vectors)
- A behavioral golden model computing the expected output
- Automatic comparison with an error count, not manual waveform reading
- A final PASS/FAIL banner with the mismatch count
You'll be able to
- Write a testbench that checks itself instead of eyeballing waves
- Separate stimulus, reference model and checker
Submitting your solution link marks this assignment done.
A full worked solution with a step-by-step walkthrough — included with the domain pack and All-Access. Try it yourself first.
Put it to work
Drill the matching interview questions, then see where this module sits in the full Design Verification roadmap.