Design and Verify FPGA Logic with Verilog
Verify an FPGA module with self-checking simulation, synthesis, timing constraints, clock-domain review, and board-level acceptance checks.
List ports, widths, signedness, active reset level, clock assumptions, and the cycle when each result becomes valid. Specify behavior during reset and when valid inputs arrive on consecutive cycles. Choose a small representative module, such as a counter that stops at its maximum value. Write a reference model based on the stated behavior before sharing arithmetic expressions with the RTL. A second implementation of the same expression can carry the same mistake into the test. ## Key Points - [Icarus Verilog getting started](https://steveicarus.github.io/iverilog/usage/getting_started.html) - [Yosys synthesis documentation](https://yosyshq.readthedocs.io/projects/yosys/en/latest/) - [AMD Vivado Logic Simulation](https://download.amd.com/docnav/documents/UG900_2023.1_English.pdf)
skilldb get systems-programming-skills/fpga-verilog-verificationFull skill: 33 linesDesign and Verify FPGA Logic with Verilog
Write the interface contract first
List ports, widths, signedness, active reset level, clock assumptions, and the cycle when each result becomes valid. Specify behavior during reset and when valid inputs arrive on consecutive cycles. Choose a small representative module, such as a counter that stops at its maximum value. Write a reference model based on the stated behavior before sharing arithmetic expressions with the RTL. A second implementation of the same expression can carry the same mistake into the test.
Separate synthesizable RTL from simulation code. Assign every combinational output on every intended path, size constants and intermediate arithmetic explicitly, and keep state updates on the specified clock edge. For each width or configuration, test values just below, at, and above the expected boundary where the interface permits them. Choose a simulator and language mode that support the constructs in use.
Build a self-checking testbench
Generate stimulus away from the sampled edge or drive it using the simulator's supported clocking convention. Sample after sequential assignments settle. For the counter, reset to zero, count to the maximum, hold enable high for several cycles, then verify that the count remains stable. Exercise the disabled path, restart after reset, and run at a second legal width. Have the testbench exit nonzero on a mismatch or a timeout. Record a seed for randomized tests. A waveform should help diagnose a failure after the testbench has already decided whether the run passed.
For a small SystemVerilog fixture, one possible local test is to run iverilog -g2012 -s counter_tb -o counter_sim counter.sv counter_tb.sv followed by vvp counter_sim. Keep the top-level testbench name explicit and use $fatal for an assertion failure. A smoke test that only prints a waveform can pass while the output is wrong.
Require implementation evidence
Synthesize the RTL without the testbench and inspect warnings for unexpected inferred latches, undriven nets, width conversion, and unintended clock structures. Use the project’s supported device flow for pin mappings, I/O standards, placement, and routing. Define primary and generated clocks and any board I/O delays. Review unconstrained paths and both setup and hold reports. Never add a broad timing exception to make a report pass.
At every clock domain crossing, identify the source and destination clocks and the signal type. A stable single-bit control can use a suitable synchronizer. A pulse or multi-bit payload needs a mechanism that preserves delivery and coherence, such as a documented handshake or asynchronous FIFO. Account for reset release as well as data transfer. Digital simulation alone cannot establish metastability safety. Save the CDC review and timing reports alongside the simulation log.
Finish with a board-specific check of reset and basic I/O behavior on the target hardware. Mark a missing board, unrun simulation, or incomplete timing constraints explicitly in the release evidence.
References
Install this skill directly: skilldb add systems-programming-skills
Related Skills
Memory Safety
Techniques for achieving memory safety without garbage collection including ownership models, arenas, and static analysis
Modern Fortran Scientific Build and Verification
Organize, build, and verify a modern Fortran scientific or HPC project. Use for module dependency failures, compiler/profile migrations, numerical regression tests, and reproducible archived results.
Zig Basics
Zig language fundamentals for systems programming including comptime, error handling, and manual memory management
Build Systems
Build systems for systems programming including CMake, Meson, and Zig build with cross-compilation
Cpp Modern
Modern C++ (C++20/23) patterns including concepts, ranges, coroutines, and modules
Ffi
Foreign function interfaces for calling between C, C++, Rust, Zig, Python, and other languages safely