Home / Learn Verilog / Code Reuse Patterns
Code Reuse Patterns
Put it in a module, function, or macro.
Quick summaryPut it in a module, function, or macro.
How to think about this
Definition
Reuse logic through modules (hardware), functions (expressions) and tasks (procedures).
Why you need this
DRY: do not repeat yourself.
How it works
Pick the smallest unit that fits.
Where you'll see this
- Everyday RTL design
- FPGA and ASIC projects
- Testbenches and debugging
Try it
Function reuse in many placesVerilog: edit and run
a saturates at 15.
Test what you just read
1. DRY means...
Avoid duplication.