16. Introduction to User Defined Primitives
User Defined Primitives (UDPs) are custom primitive components defined using truth tables or state tables. They provide a simple, table-based approach to defining basic logic gates and sequential elements without using behavioral or structural Verilog code.
What are UDPs?
UDPs are user-defined building blocks that:
-
Define custom primitives using tables instead of code
-
Are simpler than modules for basic logic
-
Have exactly ONE output (first port)
-
Can be combinational or sequential
-
Are fully synthesizable
Why Use UDPs?
-
Simplicity: Table-based definition is intuitive
-
Efficiency: Compact representation of logic
-
Clarity: Truth/state tables are self-documenting
-
Reusability: Define once, instantiate many times
-
Synthesis: Directly maps to gates
Types of UDPs
.png)
UDP Restrictions and Rules
CRITICAL RESTRICTIONS:
-
Exactly ONE output (must be first port)
-
Maximum 10 inputs
-
All ports are scalar (1-bit only, no vectors)
-
No bidirectional (inout) ports
-
No procedural blocks (always, initial)
-
Cannot instantiate modules or other UDPs
-
Defined at top level (not inside modules)
16.1. Combinational UDPs
16.2. Sequential UDPs
16.3. Advanced Techniques
