Library organization determines how a tool finds module definitions and selects a top-level design. Verilog configuration constructs can specify binding, but support varies across open-source and commercial tools. For a portable learning project, begin with explicit file lists, one authoritative definition per module and an explicitly selected top.
Worked example
This Icarus command names the top testbench and all required files. The -I option searches include files; it is not the same as a module library search directory. Paths below are illustrative and must match your project structure.
iverilog -g2005 -I include -s tb -o build/example.vvp rtl/adder.v tb/tb.v
vvp build/example.vvp
What to watch for
Compiling two different definitions of the same module name is not a reliable library-selection strategy. Make binding choices explicit in the build configuration.
Try it yourself
Why select the simulation top explicitly?
Answer: It prevents unrelated uninstantiated modules or testbenches from being treated as additional root designs and makes regressions reproducible.
How to study this topic
This is a tool-command example rather than Verilog source. Adapt file paths, port names and tool options to your project. Keep the command in a repeatable build script and review the tool output instead of assuming that completion proves the circuit is correct.
Continue learning
Previous: Compiler directives and includes
Browse the complete Verilog index
Explore related programmes
These recorded programmes are upcoming. This article is general educational content, not a syllabus or course sample.
Verilog