Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • RTL Foundations36
    • Digital Logic for RTL Engineers
    • Number Systems for RTL Engineers
    • Verilog Fundamentals
      • Modules and Ports
      • Wire vs reg
      • assign vs always
      • The Two Process Templates
      • Blocking vs Non-blocking
      • From Code to Hardware
    • Verilog Operators and Types
    • SystemVerilog for RTL
    • Simulation and Testbenches
  • Combinational Design25
  • Sequential Design27
  • FSM & Control27
  • Timing & Clocking39
  • Reset & CDC34
  • Memory & Buses57
  • Advanced RTL28
  • Senior & Interview76
  • Glossary and Notation
Loading lesson

‹RTL Foundations
  1. Topics
  2. RTL Design
  3. RTL Foundations
  4. Verilog Fundamentals

Part 1 · Foundations · Beginner

Verilog Fundamentals

This topic covers modules, nets, assignments, process templates, and assignment ordering.

  • 6topics
  • 6lessons

Topics in this section

  1. 1Modules and Ports1 lesson
  2. 2Wire vs reg1 lesson
  3. 3assign vs always1 lesson
  4. 4The Two Process Templates1 lesson
  5. 5Blocking vs Non-blocking1 lesson
  6. 6From Code to Hardware1 lesson
On this page

    Verilog describes hardware that all runs concurrently. Processes, instances and continuous assignments run together, while statements inside one begin end block run in the order written.

    Simulation schedules concurrent processes in some order. Two process templates keep simulation and hardware in agreement.

    A module containing ports, continuous assignments, combinational and sequential always blocks, and instances.
    Processes run concurrently. Statements inside one block run in order, and data dependencies and clock edges order the rest.

    Lessons in this topic

    6 lessons, about 26 min

    1. 1Modules and PortsYou can write a module with ANSI ports, a parameter and named connections, and turn implicit-net typos into errors.4 min
    2. 2Wire vs regYou can choose wire or reg from where a signal is assigned, and say what hardware an always block describes.3 min
    3. 3assign vs alwaysYou can choose between assign and a combinational always block, and write a complete combinational block with @(*) or always_comb.3 min
    4. 4The Two Process TemplatesYou can write the combinational and sequential templates, and compare synchronous and asynchronous reset.4 min
    5. 5Blocking vs Non-blockingYou can explain how blocking and non-blocking assignments are scheduled, and say which to use where.4 min
    6. 6From Code to HardwareYou can predict the cells Yosys reports for a gate, a mux, a case, a latch, a plain, enabled or reset flop and an adder, and spot an accidental latch in a stat list.8 min
    Check yourself Two always blocks in the same module both contain assignments. Which executes first?

    Neither is “first”. They are concurrent processes. The language does not define the order in which processes run within a time step, so a simulator may pick any order. Nonblocking assignments make a clocked design come out the same whatever that order is, which is why RTL must be written so the result never depends on it.

    Interview

    “What is the difference between blocking and non-blocking assignments?” is among the most common RTL questions. The last lesson gives the answer together with a simulation you can run.

    Revision sheet

    The whole topic on one page, taken from each lesson's Remember box. Read it before an interview, or print it.

    Modules and Ports

    • Connect by name, not by position: a reordered port list still compiles and connects the wrong signals.

    • Give every parameter a default and override it by name.

    • A port with no range is 1 bit, so a forgotten width on an output silently drops the upper bits.

    Rule of thumb: turn on default_nettype none at the top of every file.

    Wire vs reg

    • reg only means a variable that a procedural block can assign.

    • An always @(*) block that assigns on every path is combinational, an incomplete one infers a latch, and @(posedge clk) describes a flop.

    • Keep one writer per RTL variable. Reserve a resolved net such as wire for shared buses.

    Rule of thumb: the hardware comes from how you assign, not from the keyword.

    assign vs always

    • Use @(*) or always_comb, blocking assignments, and assign every output on every path.

    • An incomplete sensitivity list gives stale simulation but ordinary synthesised hardware.

    • @(*) misses a module signal read only inside a called function; always_comb does not.

    Rule of thumb: never write a sensitivity list for combinational logic by hand.

    The Two Process Templates

    • Combinational: assign a default to every output first, use blocking assignments.

    • Sequential: use non-blocking assignments and one reset style across the design.

    • An asynchronous reset in the sensitivity list still releases asynchronously, so synchronise the release outside.

    Rule of thumb: default first in combinational code, hold by omission in clocked code.

    Blocking vs Non-blocking

    • A blocking assignment updates now. A non-blocking one reads now and updates in the NBA region of the same timestamp.

    • Use <= in clocked blocks and = in combinational blocks.

    • Blocking assignments between clocked processes make a race: the result depends on process order.

    Rule of thumb: non-blocking in clocked blocks, blocking in combinational ones.

    From Code to Hardware

    • Operators become gates, muxes or adders. Variables assigned in a clocked block become one flop per bit, with enable and reset pins taken from the code.

    • An always @(*) output that is not assigned on every path becomes a latch, and Yosys warns while it converts the process.

    • Before mapping, stat counts one cell per operator or register. After synth it counts one cell per gate or per bit.

    Rule of thumb: write down the cell list before you synthesise; any cell you did not predict is a question about your code.

    Practise it

    • Mini project: a 4-bit ALU with flags and an exhaustive bench

    • Code lab: Build a full adder from half adders

    • Practice question: Synchronous D flip-flop with reset

    • Practice question: D flip-flop with asynchronous reset

    • Code lab: Build a D flip-flop with asynchronous reset

    • Practice question: Blocking vs non-blocking in sequential logic

    • Interview: run a mock interview on this topic

    PreviousNext: Modules and Ports

    Up next

    Up nextModules and Ports

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Digital Logic for RTL Engineers
    • Number Systems for RTL Engineers
    • Verilog Operators and Types