top of page
16.3. Comparison: Combinational vs Sequential UDPs
.png)
Edge Notation for Sequential UDPs
.png)
When to Use UDPs
-
Simple combinational logic (2-3 inputs)
-
Basic sequential elements (simple flip-flops)
-
When truth/state table is simpler than code
-
Educational purposes (clarity)
When to Use Modules
-
Multiple outputs needed
-
Vector (multi-bit) operations
-
Complex logic
-
Need to instantiate other components
-
More than 10 inputs
16.3.2. Best Practices and Guidelines
General Guidelines
-
Use descriptive names: udp_and, udp_dff (not u1, u2)
-
Always initialize sequential UDPs
-
Comment the truth/state table
-
Test thoroughly with all input combinations
-
Use don't cares (?) to simplify tables
-
Document edge sensitivity clearly
Table Formatting
-
Align columns for readability
-
Add comments for each section
-
Group related entries
-
Use consistent spacing
Common Best Practices Table
.png)
.png)
16.3.3. Common Mistakes and Solutions
Mistake #1: Forgetting reg for Sequential Output
Verilog
Mistake #2: Missing Initialization
Verilog
Mistake #3: Output Not First Port
Verilog
Mistake #4: Using Vectors
Verilog
bottom of page
