Hierarchical Design

The importance of using a structured approach when writing computer programs can be outlined by explaining some of the benefits such an approach can bring to both the writer and others wishing to understand the code.

Benefits of Hierarchical Design

In Verilog, a structured approach is perhaps even more important than in other languages, given the complexity of many large digital system designs. Hierarchical design involves creating a structure around which the final program can be created.

There are two main design methodologies which can be implemented during this process:

top-down

bottom-up

Usually, a combination of the two methodologies is used when creating a digital system design.

Example: 4-bit binary counter

The structural diagram below shows the main building blocks required to construct a 4-bit binary counter. However, details such as AND gates and invertors have been neglected here for simplicity. The purpose of this schematic is to illustrate how the design can be broken down into its constituent parts, and the same basic module can be instantiated several times in the design.

Also, by considering the fact that the ET flip flop module could be written at behavioural level, for instance, while the multiplexor module could be written at gate level, it is easy to see the benefits outlined above under "programming style".

In Verilog, these blocks are known as modules, and are constructed with the keywords module and endmodule, as follows:



An important rule in Verilog is the non-recursive nature of modules - it is illegal to have one module/endmodule construction inside another module/endmodule block.

manual pages