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)
|