Time consuming methods (TCMs) are e methods that are similar to Verilog tasks and VHDL processes. A TCM is an operational procedure containing actions that define its behavior over time. Simulation time elapses in TCMs. TCMs can execute over multiple cycles and are used to synchronize processes in an e program with processes or events in the DUT.
TCMs can contain actions that consume time, such as wait, and sync, and can call other TCMs. Within a single e program, multiple TCMs can execute either in sequence or in parallel, along separate threads.
A TCM can be defined only within a struct or unit and an instance of the struct or unit must be created before you can execute the TCM. When a TCM is executed, it can manipulate the fields of that struct instance.
Similar to a regular method, a TCM can read or write locally declared variables, fields within the local struct, arguments and return value (implicit result variable), and fields in other structs using path notation.
The maximum number of parameters you can declare for a TCM is 14. However, it is always possible to work around this restriction by passing a compound parameter such as a struct or a list.
The wait action suspends the execution of the current time consuming method until a given temporal expression succeeds. A TCM cannot continue during the same cycle in which it reaches a wait.
The sync action suspends execution of the current TCM until the temporal expression succeeds. Evaluation of the temporal expression starts immediately when the sync action is reached.
The sync action is similar to the wait action, except that a wait action always requires at least one cycle of the TCMs sampling event before execution can continue. With a sync action, execution can continue in the same simulator callback.
There is always an implicit sync on the sampling event at the beginning of every TCM.
One can generate the fields of a struct on-the-fly by calling the gen action from a TCM. The gen action generates a random value for the instance of the item specified in the expression and stores the value in that instance, while considering all relevant constraints at the current scope on that item or its children. Additional constraints can be applied to a particular instance of the item by use of the keeping keyword.
In TCMs, it is possible to call HDL tasks and functions directly from e code. This is useful when there are existing bus functional models (BFMs) in HDL that are already proven to work. e supports Verilog tasks and functions and VHDL procedures and functions.