4. Modular Design and Code Reuse



Modular design and code reuse is at the core of HDL, and is therefore the central topic of this laboratory. During this lab you will make many new modules, but you will also have the chance to reuse old code. This is encouraged in practice as it allows hardware designers to get more functionality and use out of a single effort or investment (more bang for your buck as they say in business!).

To design in a modular manner is to divide a problem up into many small chunks of functionality, each of which can be created and tested individually before being combined to create the whole. By sub-dividing a problem in this way, the amount of debugging is greatly reduced, and often coding shortcuts can be made by reusing modules in different places in your design. Modular design is a mindset that encourages planning, isolating and exploiting reoccurring blocks of functionality to minimise the quantity of required coding.

Along with instantiation, two aspects of modular design are covered within this laboratory. These are called 'Generics' and 'Generate statements'.