SystemVerilog OOP Mastery · All levels
Parameterized Components and Agents at Scale: Exercises
Exercises for Parameterized Components and Agents at Scale.
Practice exercises
Exercise 1
You have `generic_agent#(axi_item)` and `generic_agent#(apb_item)` in one env. You need extra latency only in AXI driver. How should override be targeted?
Solution
diagram
Override `generic_driver#(axi_item)` (type or instance path) and leave `generic_driver#(apb_item)` untouched, because each specialization is distinct.Exercise 2
A review flags repeated long type signatures in env code. What improvement keeps behavior unchanged but improves maintainability?
Solution
diagram
Introduce protocol-specific typedef aliases (`axi_agent_t`, `apb_agent_t`) and use those aliases in declarations and create sites.