Jump to content

uvm_reg_adapter compile problem


Recommended Posts

Hi, all

I met the compile error when i use the uvm_reg_adpater. Could someone help to solve.

Here are the codes:

`ifndef __CHPP_REG2PCIE_ADAPTER__

`define __CHPP_REG2PCIE_ADAPTER__

//------------------------------------------------------------------------------

//

// CLASS: chpp_reg2pcie_adapter

//

//------------------------------------------------------------------------------

class chpp_reg2pcie_adapter extends uvm_reg_adapter;

// provide implementations of virtual methods such as get_type_name and create

`uvm_object_utils(chpp_reg2pcie_adapter)

// functions and tasks

function new(string name = "chpp_reg2pcie_adapter");

super.new(name);

endfunction

virtual function uvm_sequence_item reg2bus(const ref uvm_reg_bus_op reg_rw);

chpp_pcie_item bus = chpp_pcie_item::type_id::create("reg_rw");

if (reg_rw.kind == UVM_READ) begin

bus.req_typ = MRd;

bus.length = 0;

bus.reqer_id = cpu_id;

bus.last_be = 0;

bus.first_be = 0;

bus.addr = reg_rw.addr;

bus.data_payload.size() = 0;

end

if (rw.kind == UVM_WRITE) begin

bus.req_typ = MWr;

bus.length = 1'b1;

bus.reqer_id = cpu_id;

bus.last_be = 0;

bus.first_be = 0;

bus.addr = reg_rw.addr;

bus.data_payload.push_back(reg_rw.data);

end

return bus;

endfunction

virtual function void bus2reg(uvm_sequence_item bus_item,

ref uvm_reg_bus_op reg_rw);

chpp_pcie_item bus;

if (!$cast(bus,bus_item)) begin

`uvm_fatal("NOT_REG_TYPE","Provided bus_item is not of the correct type")

return;

end

if (bus.req_typ == MRd) begin

reg_rw.kind = UVM_READ;

reg_rw.addr = bus.addr;

reg_rw.data = bus.data;

//reg_rw.byte_en = bus.byte_en;

reg_rw.status = UVM_IS_OK;

end

if (bus.req_typ == MWr) begin

reg_rw.kind = UVM_WRITE;

reg_rw.addr = bus.addr;

reg_rw.data = bus.data;

//reg_rw.byte_en = bus.byte_en;

reg_rw.status = UVM_IS_OK;

end

endfunction

endclass : chpp_reg2pcie_adapter

`endif

VCS1209 reports such error:

Error-[XMRE] Cross-module reference resolution error

../sv/02_master/config/221_chpp_reg2pcie_adapter.sv, 64

Error found while trying to resolve cross-module reference.

token 'rw'. Originating package 'chpp_pkg'.

Source info: if (rw.kind == UVM_WRITE) begin

bus.req_typ = MWr;

...

15 warnings

1 error

CPU time: 2.863 seconds to compile

Thanks in advance!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...