• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. Creating fifo channel between class objects

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 64
  • Views 14948
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Creating fifo channel between class objects

archive
archive over 18 years ago

I'm trying to create a fifo channel between two classes.. I tried using Queue in an interface and pass the interface to the virtual interface of the class .. Not currently supported..
Tried using a global queue and passing its reference to the classes I get the "As a temporary implementation restriction, an array class member reference is not permitted in this context" error..

Any suggestions for a work around..
Thanks..

Following is the code and the log file..

package fifo1;

class genfra;
rand bit [31:0] dword1;
rand bit [31:0] dword2;
endclass :genfra


class crefra;

local genfra fifoc[$] ;
genfra temp1 ;
integer success,i,dly;

function new(ref genfra fifo[$]);
fifoc = fifo;
endfunction

task gennpush();
for(i = 0 ; i < 20 ;i++)
begin
temp1=new();
success = temp1.randomize();
success = randomize(dly) with {dly > 2;dly < 5;};
$display("time=%d.. temp1.dword1 = %08x ",$time,temp1.dword1);
$display("time=%d.. temp1.dword2 = %08x ",$time,temp1.dword2);
fifoc.push_back(temp1);
#dly;
end
endtask

endclass

class prifra;
local genfra fifop[$] ;

function new(ref genfra fifo[$]);
fifop = fifo;
endfunction

task popnprint();
genfra temp2 ;
forever
begin
$display("time=%d..before pop ",$time);
if(fifop.size())
begin
#5;
$display("fifo size before pop ",fifop.size());
temp2=fifop.pop_front();
$display("time=%d.. temp2.dword1 = %08x ",$time,temp2.dword1);
$display("time=%d.. temp2.dword2 = %08x ",$time,temp2.dword2);
$display("fifo size after pop ",fifop.size());
end
else
#1;
end
endtask
endclass

endpackage



module top;
timeunit 1ns;
int success,i;
import fifo1::*;
genfra fifo[$] ;
crefra cf = new(fifo);
prifra pf = new(fifo);


initial
begin
fork
cf.gennpush();
pf.popnprint();
join any
$finish;
end


final $display("time=%d Ending Simulation ",$time,);

endmodule

log file :


ncverilog: 05.83-p002: (c) Copyright 1995-2006 Cadence Design Systems, Inc.
TOOL: ncverilog 05.83-p002: Started on Dec 14, 2006 at 19:44:23 IST
ncverilog
-l
./transcript.clachan.log
+ncaccess+rw
+notimingchecks
+libext+.v
+sv
+svseed=35
clachan.sv
file: clachan.sv
fifoc = fifo;
|
ncvlog: *E,WOUPYR (clachan.sv,21|4): As a temporary implementation restriction, an array class member reference is not permitted in this context.
fifoc = fifo;
|
ncvlog: *E,WOUPSR (clachan.sv,21|11): A reference to an entire array is not permitted in this context [SystemVerilog].
fifop = fifo;
|
ncvlog: *E,WOUPYR (clachan.sv,43|4): As a temporary implementation restriction, an array class member reference is not permitted in this context.
fifop = fifo;
|
ncvlog: *E,WOUPSR (clachan.sv,43|11): A reference to an entire array is not permitted in this context [SystemVerilog].
package worklib.fifo1:sv
errors: 4, warnings: 0
import fifo1::*;
|
ncvlog: *E,NOPBIND (clachan.sv,73|11): Package fifo1 could not be bound.
genfra fifo[$] ;
|
ncvlog: *E,SVNOTY (clachan.sv,74|5): Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.
genfra fifo[$] ;
|
ncvlog: *E,ILLPRI (clachan.sv,74|12): illegal expression primary [4.2(IEEE)].
genfra fifo[$] ;
|
ncvlog: *E,EXPIDN (clachan.sv,74|15): expecting an identifier [3.2][3.8][3.9(IEEE)].
crefra cf = new(fifo);
|
ncvlog: *E,EXPSMC (clachan.sv,75|10): expecting a semicolon (';') [12.3.2(IEEE)].
crefra cf = new(fifo);
|
ncvlog: *E,EXPSMC (clachan.sv,75|20): expecting a semicolon (';') [12.3.2(IEEE)].
prifra pf = new(fifo);
|
ncvlog: *E,EXPSMC (clachan.sv,76|10): expecting a semicolon (';') [12.3.2(IEEE)].
prifra pf = new(fifo);
|
ncvlog: *E,EXPSMC (clachan.sv,76|20): expecting a semicolon (';') [12.3.2(IEEE)].
$finish;
|
ncvlog: *E,MISEXX (clachan.sv,85|13): expecting an '=' or '<=' sign in an assignment [9.2(IEEE)].
module worklib.top:sv
errors: 9, warnings: 0
ncvlog: *F,NOTOPL: no top-level unit found, must have recursive instances.
ncverilog: *E,VLGERR: An error occurred during parsing. Review the log file for errors with the code *E and fix those identified problems to proceed. Exiting with code (status 2).
TOOL: ncverilog 05.83-p002: Exiting on Dec 14, 2006 at 19:44:23 IST (total: 00:00:00)


Originally posted in cdnusers.org by mirzani
  • Cancel
  • archive
    archive over 18 years ago

    I used a mailbox to do what you want. Although mailboxes aren't formally supported in IUS, I included a mailbox class that works the same way (all files attached).

    Here's the main change to your code:

    package fifo1;

    import mailbox::*;

    class genfra extends mb_item;
      rand bit [31:0] dword1;
      rand bit [31:0] dword2;
    endclass :genfra

    class crefra;
      mailbox   fifoc ;
      genfra    temp1 ;
      int       dly;

      function new(mailbox fifo);
        fifoc = fifo;
      endfunction

      task gennpush();
        repeat (20) begin
          temp1=new();
          assert(temp1.randomize());
          assert(randomize(dly) with {dly > 2;dly < 5;});
          $display("time=%d.. temp1.dword1 = %08x  ",$time,temp1.dword1);
          $display("time=%d.. temp1.dword2 = %08x  ",$time,temp1.dword2);
          fifoc.put(temp1);
          #dly;
        end
      endtask
    ...
    endpackage

    module top;
      timeunit 1ns;
      import fifo1::*;
      import mailbox::*;

      mailbox fifo = new(10);
      crefra cf = new(fifo);
      prifra pf = new(fifo);
    ...
    endmodule


    Originally posted in cdnusers.org by tpylant
    mbox_ex.tar.gz
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information