So far we have been writing Verilog top-level modules that test components. In this lecture we learn how to write te components themselves.
A Verilog top-level (i.e. main
) module consists of the following section:
module
headerassign
.initial
blockalways
blocks.A Verilog component (i.e. reusable in other modules) differs slightly from a top-level module as indicated below:
module
headers is followed by ports, the names of the wires that connect this component to the outside world.input
) and which is outgoing (using output
).
The functionality of the component can be implemented procedurally (in an always
block) or structurally (in the circuit instantiation section).
alu1b
and its tester alu1bClient
in the Resource Directory. alu1b
is a 1-bit adder component made up of basic gates.alu2b
and its tester alu2bClient
in the Resource Directory. alu2b
is a 2-bit adder component made up of two alu1b
adders.