HDL Programming Fundamentals: VHDL and Verilog

In This Chapter
Understand the concept of procedures (VHDL), tasks (Verilog), and functions (both VHDL and Verilog).
Review and understand how to convert between different types of data.
Review signed vector multiplication.
Understand a simple enzyme mechanism.
Instead of writing the segment/construct every time it is used, a single call statement to a function, task, or a procedure that references this segment/construct is all that is needed.
Procedures and tasks can have more than one input and more than one output. Functions have a single output, but can have more than one input.
Procedures and functions in VHDL can be called only from within process. Tasks and functions in Verilog can be called only from within always or initial.
Procedures (VHDL) and tasks (Verilog) are similar to subroutines in other software languages, such as C. In many modules, a routine is repeatedly used, such as a multiplication algorithm, addition algorithm, or conversion between two numbering systems. Instead of writing these routines every time they are needed, the routines' codes can be stored as the body of a procedure (VHDL) or as the body of a task (Verilog). Whenever the routine needs to be executed, the procedure (task) is called by writing just one call statement. Section 6.2.1 discusses procedures, and Section 6.2.2 discusses tasks.
Procedures are behavioral statements (see Chapter 3, "Behavioral Descriptions"). A procedure has two parts: the...