Home > Community > Forums > Functional Verification > Creating fifo channel between class objects

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Creating fifo channel between class objects  

Last post Thu, Dec 14 2006 6:50 AM by archive. 1 replies.
Started by archive 14 Dec 2006 06:50 AM. Topic has 1 replies and 2180 views
Page 1 of 1 (2 items)
Sort Posts:
  • Thu, Dec 14 2006 6:50 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    Creating fifo channel between class objects Reply

    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
    • Post Points: 0
  • Thu, Jan 4 2007 12:41 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Creating fifo channel between class objects Reply

    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
    • Post Points: 0
Page 1 of 1 (2 items)
Sort Posts:
Started by archive at 14 Dec 2006 06:50 AM. Topic has 1 replies.