User Define Primitives


User Defined Primitive (UDP) Declarations

The UDP’s are used to augment the gate primitives and are defined by truth tables. Instances of UDP’s can be used in the same way as gate primitives. There are 2 types of primitives:


1. Sequential UDP’s permit initialization of output terminals, which are declared to be of reg type and they store values. Level-sensitive entries take precedence over edge-sensitive declarations. An input logic state Z is interpreted as an X. Similarly, only 0, 1, X or - (unchanged) logic values are permitted on the output.

2. Combinational UDP’s do not store values and cannot be initialized.

The following additional abbreviations are permitted in UDP declarations.

UDP begins with reserve word primitive and ends with endprimitive. Ports/terminals of primitive should follow. This is similar to what we do for module definition. UDPs should be defined outside module and endmodule

Combinational UDP’s example


Sequential Level Sensitive UDP’s example


Sequential Edge Sensitive UDP’s example