AMBA VIP基础使用方式(AHB)

1. AHB环境配置

1) 基础配置

作为master或者slave使用时,对应的is_active = 1
只作为监测(monitor)使用时,对应的is_active =0

class ahb_cfg extends svt_ahb_system_configuration;
	`uvm_object_utils(ahb_cfg)
	function new(string name="ahb_cfg");
		super.new(name);
		this.num_masters=2;
		this.num_slaves=2;
		this.create_sub_cfg(num_masters,num_slaves);
		foreach(this.master_cfg[i]) begin
			this.master_cfg[i].is_active = 1;
			this.master_cfg[i].data_width = 32;
			this.master_cfg[i].addr_width = 32;
			this.ahb_lite = 1;
		end
		//slave ……
	endfunction
endclass

2. testbench声明

`include "svt_ahb_slave_bind_if.svi"
`include "svt_ahb_master_bind_if.svi"

module top;
	svt_ahb_if			ahb_if();

	assign	ahb_if.hclk = clk;
	assign	ahb_if.hresetn = rstn;

	initial begin
		uvm_config_db#(svt_ahb_vif)::set(uvm_root::get(),"uvm_test_top.u_env.u_ahb_env", "vif", ahb_if);
	end

endmodule

3. interface连接

1)active 端口连接(slave为例)

bind `DUT svt_ahb_slave_bind_if #(
	.HADDR_WIDTH_PARAM		(32),
	.HWDATA_WIDTH_PARAM	(32)
	...
)  ahb_bind_if(
	.haddr			(haddr		),
	.hburst			(hburst		),
	....
);

bind top svt_ahb_slave_connector #(1)  xxx_ahb_bind_connector(ahb_if,slave_if[0].svt_ahb_slave_async_modport, `DUT.ahb_bind_if);

2)passive 端口连接
passive模式相对active需要修改两个地方:

  1. cfg文件中的active配置
foreach(this.master_cfg[i]) begin
	this.master_cfg[i].is_active = 0;
	...
end
  1. bind连接
bind top svt_ahb_slave_connector #(0)  xxx_ahb_bind_connector(ahb_if,slave_if[0].svt_ahb_monitor_modport, `DUT.ahb_bind_if);

4. 环境例化

svt_ahb_system_env	u_ahb_env;

uvm_config_db#(svt_ahb_system_configuration)::set(this,"u_ahb_env","cfg",ahb_cfg);

ahb_env = svt_ahb_system_env::type_id::create("ahb_env",this);

如需要使用reg_model需要增加如下内容

//1.cfg文件修改
foreach(this.master_cfg[i]) begin
	this.master_cfg[i].is_active = 1;
	...
end
this.master_cfg[0].uvm_reg_enable = 1;

//2.配置regmodel
uvm_config_db#(uvm_reg_block)::set(this,"u_ahb_env.master[0]", "ahb_regmodel",regmodel);

5. 端口连接

monitor采样端口连接

this.u_ahb_env.slave[x].monitor.item_observed_port.connect(this.chk.item_observed_response_export);
  • 6
    点赞
  • 64
    收藏
    觉得还不错? 一键收藏
  • 11
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值