Slide 27 of 65
Notes:
Subprograms in VHDL are in the form of functions and procedures. Functions return a value and can be used in signal and variable assignment statements:
e.g. A <= abs(-1); -- where abs() returns absolute value
Procedures, on the other hand, do not have return values but can manipulate the signals or variables passed to them as parameters:
absolute() here is a procedure that directly assigns A its absolute value
The use of functions and procedures enables code compaction, enhances readability, and supports hierarchy by allowing code sequences that are used frequently to be defined and subsequently reused easily.