Friday, November 21, 2008     Register | Login | Search | Contact Us
     

Many of you already received communications about the move of the Cadence user community into cadence.com. And many of you have already joined, with over 4000 registrations in the first two weeks.

The new Cadence Community enhances the ability of Cadence users to connect and collaborate. In addition to moving the community into cadence.com -- enabling single sign-on for community, Sourcelink and Cadence events -- the new site is organized around nine technology segments, giving you easy access to product information, training, forums and blogs. Some of the new features include:
  • Ability to respond to posts via e-mail
  • Technology-specific blogs
  • Latest Web 2.0 social networking capabilities
  • Public profile options
  • Private messaging
  • Friends lists
Visit the new Cadence Community today at www.cadence.com/community and join the discussions!

Registration note: Due to the scope of the enhancements and the new SSO registration system, we were not able to migrate existing cdnusers.org member accounts. So new registrations are required, but this enables a broader set of functionality we think you'll enjoy.

Forum note: Under the guidance of forum moderators, we have taken the 20+ cdnusers.org forums and consolidated them into 11 forums on the new site. Posts have been brought over so you can leverage that posting history. CDNusers forums will be set to read only starting 7/30, and cdnusers.org will be redirected to the new community on 8/4.

Best regards,
Mike and Tom

Michael A. Catrambone - Steering Committee Chairman
Distinguished Engineer
PCB/Mechanical
UTStarcom, Inc.

Tom Diederich
Cadence Community Manager
Home
Forums
Subject: Creating fifo channel between class objects
Posting to forums is available to community members only.
Login or Register
Rate this topic:
   
Author Messages
mirzani
Posts: 0
Online: User is Offline
12/14/2006 6:50 AM  
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)
tpylant
Posts: 87
Online: User is Offline
1/04/2007 12:41 PM  

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 ⎫:0] dword1;
  rand bit ⎫: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


Attachment: mbox_ex.tar.gz

Posting to forums is available to community members only.
Login or Register

Forums > Functional Verification > SystemVerilog > Creating fifo channel between class objects


ActiveForums 3.6
     
Copyright 2006 Cadence Design Systems, Inc.