|
楼主 |
发表于 2013-7-24 13:05:43
|
显示全部楼层
应该就是的。不大明白你说的跟offset进行绑定是什么意思,反正当时我使用register model的时候,需要用configure函数对其指定hdl_path
- virtual function void build_phase(uvm_phase phase);
- super.build_phase(phase);
- demo_cfg = demo_config::type_id::create("demo_cfg");
- vdo_cfg = config1::type_id::create("vdo_cfg");
- uvm_config_object::set(this,"apb0*","cfg",demo_cfg);
- uvm_config_object::set(this,"apb0.slave[0]*","cfg",demo_cfg.slave_configs[0]);
- uvm_config_object::set(this,"vdo0*","cfg",vdo_cfg);
- uvm_config_object::set(this,"vdo0.slave[0]","cfg",vdo_cfg.slave_configs[0]);
- apb0=apb_env::type_id::create("apb0",this);
- vdo0=vdo_env::type_id::create("vdo0",this);
- regmodel=ral_block_apb_basic_block::type_id::create("regmodel",,get_full_name());
- regmodel.configure(null,"top.u_dut.apb_slave");
- regmodel.build();
- regmodel.lock_model();
- regmodel.reset();
- reg_sqr_adapter=reg_to_apb_adapter::type_id::create("reg_sqr_adapter",,get_full_name());
- mon_sqr_adapter=reg_to_apb_adapter::type_id::create("mon_sqr_adapter",,get_full_name());
- reg_predictor=new("reg_predictor",this);
- endfunction : build_phase
复制代码 好像我用的configure中省掉了一些参数,我记得这个东西很长的参数列表。
这个regmodel是个ram,而它的地址的指定,是在为其建立模型的时候:
- class ral_mem_MY_RAM extends uvm_mem;
- //function new(string name = "MY_RAM");
- function new(string name = "n_ram");
- super.new(name, `UVM_REG_ADDR_WIDTH'h400, 32, "RW", build_coverage(UVM_NO_COVERAGE));
- endfunction
- virtual function void build();
- endfunction: build
- `uvm_object_utils(ral_mem_MY_RAM)
- endclass : ral_mem_MY_RAM
复制代码 好像是new函数中需要指定(好像是大小),然后将其映射到default_map上去的时候要指定起始地址?时间太久我不大记得了。
- class ral_block_apb_basic_block extends uvm_reg_block;
- //rand ral_mem_MY_RAM MY_RAM;
- rand ral_mem_MY_RAM n_ram;
- function new(string name = "apb_slave");
- super.new(name, build_coverage(UVM_NO_COVERAGE));
- endfunction: new
- virtual function void build();
- this.default_map = create_map("", 0, 4, UVM_LITTLE_ENDIAN);
- //this.MY_RAM = ral_mem_MY_RAM::type_id::create("MY_RAM");
- //this.MY_RAM.build();
- //this.MY_RAM.configure(this, "");
- //this.default_map.add_mem(this.MY_RAM, `UVM_REG_ADDR_WIDTH'h0, "RW", 0);
- this.n_ram = ral_mem_MY_RAM::type_id::create("n_ram");
- this.n_ram.build();
- this.n_ram.configure(this,"n_ram.mem");
- this.default_map.add_mem(this.n_ram,`UVM_REG_ADDR_WIDTH'h0,"RW",0);
- //add_hdl_path("dut","apb_slave");
- endfunction : build
- function display();
- $display({"***************now is ",get_full_name()});
- endfunction : display
- `uvm_object_utils(ral_block_apb_basic_block)
- endclass : ral_block_apb_basic_block
复制代码 |
|