Tutorial: a counter, from RTL to layout
Take the first guided project through every stage, and learn what each result means.
On this page
ObjectiveBefore you start1. Create the project2. Read the design3. Simulate4. Open the waveform5. Synthesize6. Build the chipHow to tell it workedIf something goes wrongNextObjective#
Take a working 8-bit counter through simulation, synthesis and the build, and understand each result.
Before you start#
- A Nelix account, signed in.
- The Workspace open. See Editor and terminal.
1. Create the project#
nelix new g1-counter --template g1-counter
cd ~/project/g1-counter2. Read the design#
cat rtl/top.svmodule top (
input logic clk,
input logic rst_n,
output logic [7:0] count,
output logic done
);
logic en;
always_ff @(posedge clk or negedge rst_n) begin
if (!rst_n) begin
count <= 8'd0;
en <= 1'b0;
end else begin
en <= 1'b1;
if (en) count <= count + 8'd1;
end
end
assign done = (count == 8'd32);
endmoduleIt counts up by one on each clock, and raises done when the count is 32.
3. Simulate#
nelix testExpected: the run ends with
test_top.test_top passed
** TESTS=1 PASS=1 FAIL=0 SKIP=0 **4. Open the waveform#
nelix waveformExpected: find count and watch it step from 0 to 32. done goes high when it reaches 32.
count stays at 0 while rst_n is low. After reset is released, one clock passes while en is set, then count goes up by one on every rising edge. Recorded from a real simulation.5. Synthesize#
nelix synthExpected: the log ends with a cell count. For this design:
Number of cells: 34
$_AND_ 8
$_DFFE_PN0P_ 8
$_DFF_PN0_ 1
$_NOT_ 3
$_OR_ 7
$_XOR_ 7There are nine flip-flops: eight for count and one for en. The rest is the adder and the comparison with 32. nelix schematic draws them.
$adff and $adffe), an adder ($add) that feeds the count back plus one, and a comparison ($eq) with 32 that drives done.6. Build the chip#
nelix buildThis takes about a minute for this design. Watch the phases on the build card on Overview.
Expected: the card shows Passed, with the cell count and area of your chip.
nelix report
nelix layoutHow to tell it worked#
- Simulate, Synthesize and Build the chip each show Passed on Overview.
- The layout viewer shows a small block of cells in the die.
If something goes wrong#
| Problem | Cause | Fix |
|---|---|---|
nelix new says the name is taken | A project with that name exists | Use it, or choose another name: nelix new counter2 --template g1-counter |
nelix test cannot find the project | You are not in the project folder | cd ~/project/g1-counter |
| The build waits before starting | Another build is running | It starts when a slot is free |
Next#
Debugging a failed simulation uses the second guided project.
Verified. Simulation and synthesis run with Icarus Verilog 12.0, cocotb 2.1.0 and Yosys 0.33 on 5 October 2026. The build step was not run.
Something unclear or missing? Send feedbackSign in and use Feedback to tell us.