Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Calling function inside seq body

Status
Not open for further replies.

Basilxxx

Newbie
Joined
Jul 25, 2022
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
15
Hi,

Im trying to compile my code where I call write function inside seq body and Im getting the following error:
Code:
Error-[XMRE] Cross-module reference resolution error
testbench.sv, 15
  Error found while trying to resolve cross-module reference.
  token 'seq_item'.  Originating package '$unit'.
  Source info: seq_item.address = address;
 
 
 
Error-[XMRE] Cross-module reference resolution error
testbench.sv, 16
  Error found while trying to resolve cross-module reference.
  token 'seq_item'.  Originating package '$unit'.
  Source info: seq_item.data_bytes = new[4];
 
 
 
Error-[XMRE] Cross-module reference resolution error
testbench.sv, 17
  Error found while trying to resolve cross-module reference.
  token 'seq_item'.  Originating package '$unit'.
  Source info: seq_item.data_bytes = data_bytes;
 
 
 
Error-[XMRE] Cross-module reference resolution error
testbench.sv, 18
  Error found while trying to resolve cross-module reference.
  token 'seq_item'.  Originating package '$unit'.
  Source info: seq_item.byte_enable = new[4];
 
 
 
Error-[XMRE] Cross-module reference resolution error
testbench.sv, 19
  Error found while trying to resolve cross-module reference.
  token 'seq_item'.  Originating package '$unit'.
  Source info: seq_item.byte_enable = 4'hf;
 
 
 
Error-[XMRE] Cross-module reference resolution error
testbench.sv, 20
  Error found while trying to resolve cross-module reference.
  token 'seq_item'.  Originating package '$unit'.
  Source info: foreach (seq_item.data_bytes [i] ) begin
  seq_item.data_bytes[i] = address[(8 * i)+:0];
  seq_item.byte_enable[i] = data_bytes[(8 * i)+:0];
  end
 
 
 
Error-[XMRE] Cross-module reference resolution error
testbench.sv, 21
  Error found while trying to resolve cross-module reference.
  token 'seq_item'.  Originating package '$unit'.
  Source info: seq_item.data_bytes[i] = address[(8 * i)+:0];
 
 
 
Error-[XMRE] Cross-module reference resolution error
testbench.sv, 22
  Error found while trying to resolve cross-module reference.
  token 'seq_item'.  Originating package '$unit'.
  Source info: seq_item.byte_enable[i] = data_bytes[(8 * i)+:0];

Below is the executabale code i compiled:

Code:
class c1;
  rand byte unsigned byte_data[];
  rand longint unsigned address;
  rand bit byte_enable[];
 
  virtual task body();
    c1 seq_item;
    seq_item =new();
    $display("Write Done ...");
        //Call write function
    write(32'h0100_0814,32'h01);
  endtask :body
 
  function void write(int address, int data_bytes);
     seq_item.address                   = address;
     seq_item.data_bytes                = new[4];
     seq_item.data_bytes                = data_bytes;
     seq_item.byte_enable               = new[4];
     seq_item.byte_enable               = 4'hF;
     foreach(seq_item.data_bytes[i]) begin
       seq_item.data_bytes[i] = address[8*i +:0];
       seq_item.byte_enable[i] = data_bytes[8*i +:0];
       end
   endfunction    
endclass : c1
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top