在实际的验证环境中, uvm_agent应该算是比较大的uvm_componet, 里面可以包含squencer、driver、monitor等单元。如下图所示:
同样uvm agent也可以进行一些参数的配置
agent可以分成两种:
- active
- 包含所有的component, 比如sequencer、driver、monitor;
- 数据可以通过driver来驱动DUT
- passive
- 只包含monitor和coverage group等;
- 用于checker和coverage
uvm agent的创建
- 和定义其他模块一样, 先从[uvm_agent] 派生出一个自定义的class,用factory机制注册, 并且创建new函数:
1 | // my_agent is user-given name for this class that has been derived from "uvm_agent" |
- 实例化agent里面的componet
1 | // my_agent is user-given name for this class that has been derived from "uvm_agent" |
- 在build_phase中创建上述的componet。 注意这里的函数用于查询uvm_agent是active模式还是passive模式:
1 | virtual function void build_phase (uvm_phase phase); |
- 把agent中的componet连接起来: 比如说sequencer和driver:
1 | virtual function void connect_phase (uvm_phase phase); |
uvm agent 的配置
uvm agent有个内部参数是is_active
, 可以通过config_db进行配置:
1 | // Set the configuration called "is_active" to the agent's path to mark the given agent as passive |