Nội dung text Task _ Function in Verilog.pptx
Tasks and Functions
Tasks and Functions Tasks and functions are used when same functionality is required to be used at many places in the design. Both must be defined in a module and are local to the module. Code is placed in-line by the Verilog compiler. They can have local variables, registers, time variable, integers, real but not wires. Tasks are used for the code that contains timing constructs or multiple outputs. Functions are used when the code is purely combinational, executes in 0 simulation time and always return a single value. Functions and tasks are used only in behavioral code. Both are Included in design hierarchy and can be addressed by hierarchical names referencing.