Course · Verilog
Learn RTL through signals and clocks
Design combinational and sequential circuits with signals and RTL.
What you build
- Combinational blocks from continuous assignments and vectors
- Clocked registers and state machines with reset
- Testbenches that drive inputs, print results, and dump a waveform
Before you start
Binary numbers and the idea of a clock. No other HDL is required.
Table of contents
13 chaptersBasics
- A module, its ports, and assign
Read a half adder as a box with ports, learn the module and port declaration forms, predict what its testbench prints, run it, then change one wire and see the print change.
Checkpoint: Run the example and compare it with your prediction
- Vectors, bit selects and operators
Bundle bits into a vector, pull ranges out of it, join pieces with braces, and learn what each operator family builds and how wide its result is, from bitwise, logical and reduction operators to arithmetic, shifts, comparisons and precedence, before rearranging a byte in Practice.
Checkpoint: Submit the Practice problem for grading
- Literals, signed values and expression width
Write sized literals, know that an unsized one is at least 32 bits, read one bit pattern as signed or unsigned, and give an addition a target wide enough to keep its carry.
Checkpoint: Submit the Practice problem for grading
- Nets, variables and the combinational always
Tell nets from variables, write a multiplexer twice, as an assign with ?: and as an always @* with case, see why every path must assign the output, and use blocking = inside combinational blocks.
Checkpoint: Answer the checks in this chapter
- Registers and nonblocking assignment
Describe a register with always @(posedge clock) and <=, learn the order of work inside one time step, read a counter trace to see the value before and after an edge, and watch a swap break when = replaces <=.
Checkpoint: Run the example and compare it with your prediction
- Reset, enable and priority
Give a register a synchronous reset and an enable, order the if/else chain so reset wins, and make a counter wrap where the requirement says rather than where the width runs out.
Checkpoint: Submit the Practice problem for grading
Applied design
- Register stages, observation and waveforms
Chain registers into stages, learn what a testbench sees at the edge, after #1, with $strobe and in a waveform, start a VCD recording with $dumpfile and $dumpvars, give its times a unit with `timescale, and build a rising-edge detector whose pulse is exactly one cycle wide.
Checkpoint: Submit the Practice problem for grading
- Instances, hierarchy and parameters
Place a module inside another as an instance, connect its ports by name, override a parameter per instance, run internal nets between instances, read a four-bit ripple-carry adder as a hierarchy, and recognize the elaboration errors and silent miswirings a connection list can hide.
Checkpoint: Submit the Practice problem for grading
- A state machine from a state table
Turn a state table into a state register, a next-state case and output logic, run a two-state rise detector and check its trace and waveform against the table, repair a broken transition, and design a three-state machine yourself.
Checkpoint: Submit the Practice problem for grading
- Memories and FIFOs
Declare a memory as an array of registers, write it at the edge and read it asynchronously or through a register with one cycle of latency, then build a parameterized synchronous FIFO whose count, full and empty decide which pushes and pops take effect.
Checkpoint: Submit the Practice problem for grading
Verification
- Testbench techniques
Write a testbench with reg inputs, wire outputs and a dut instance, make time pass with # delays, a clock and event controls, then package stimulus in a task, compare against a model with !==, and end a failing or hanging run with $fatal.
Checkpoint: Run the example and compare it with your prediction
- Recording waveforms
Choose which instances a VCD records with $dumpvars scopes and depths, read a waveform whose scopes skip a level, and recognize the mistakes that leave a recording empty, late, too shallow, off by a rounded delay, or missing an unnamed value.
Checkpoint: Run the example and compare it with your prediction
Capstone
- Design from a requirement
Read a requirement into ports, widths, a select mapping, a priority order, a sampling time and boundary cases, predict the counter contract cycle by cycle, then write both checkpoint designs on your own.
Checkpoint: Submit the Practice problem for grading