Passing Parameterized class object to a Class

Hello All,

I am working to implement class based Scoreboard. The Scoreboard has a handle to a queue that it can pop entries from and a Mailbox to receive packets from the Monitor.

I am currently stuck as to how I can pass a parameterized Queue class to the Scoreboard Class. There are multiple scoreboards of different packet structs I wish to pass from the Main Program block. Any help will be appreciated.

//-------------------------------------------------------------------------------
// scoreboard_clss
//-------------------------------------------------------------------------------

class  scoreboard_clss #(// Queue Class 
			type queue_clss_inst 	= queue_clss #(.PAYLOAD_T(pkt_type), .SIZE('d64)) , 
                         // PAYLOAD 
                        parameter type PKT_PAYLOAD_T = pkt_type 
			);  

   string 			name; 
   queue_clss_inst		QE;  
   mailbox #(PKT_PAYLOAD_T) 	mailbox_sb;
   PKT_PAYLOAD_T		mb_ip_pkt; 
   PKT_PAYLOAD_T		qe_ip_pkt;  
   int 				oflow_err; 
   int 				uflow_err;  
   int unsigned 		err_count;
   bit 				sim_pass;  // 0 - true ; 1 - false, non-zero error code means error returned

   function new(string name 			= "TB Scoreboard",
  	 	mailbox #(PKT_PAYLOAD_T) 	mailbox_sb,
   		queue_clss_inst			QE 
	 	); 
    this.name = name;
    this.mailbox_sb = mailbox_sb; 
    this.QE 	= QE; 
    oflow_err = '0; 
    uflow_err = '0; 
    err_count = '0; 
    sim_pass = '0; 
   endfunction: new 

   virtual function bit sim_pass_get(); sim_pass_get = sim_pass;	endfunction
   virtual function void sim_fail(); sim_pass = 1;                      endfunction
   virtual function void err_count_incr(); err_count++; sim_fail();     endfunction
   virtual function int unsigned err_count_get(); return err_count;     endfunction
   extern virtual task sb_start();
   extern virtual function void sb_compare();
   extern virtual task print_err_report();
   extern virtual task reset();
  endclass : scoreboard_clss

//-------------------------------------------------------------------------------
// queue_clss
//-------------------------------------------------------------------------------

 class queue_clss #(// Queue Type 
                    type PAYLOAD_T = logic, 
		    // Queue Depth 
		    parameter SIZE = 'd128); 
   string name; 
   PAYLOAD_T QUEUE [$:SIZE]; 
   int 		cnt= 0; 
   logic [1:0] 	last_xfer = '0;
  function new (string name = "TB Queue"); 
   this.name = name; 
  endfunction 
  extern virtual task q_reset ();
  extern virtual function bit q_full ();   // 0- Not Full,  1-Full  
  extern virtual function bit q_empty ();  // 0- Not Empty, 1-Empty
  extern virtual task push (input  PAYLOAD_T ip_pkt = '0	, output logic ovrflw_err); 
  extern virtual task pop  (output PAYLOAD_T op_pkt = '0	, output logic undrflw_err);    
  endclass: queue_clss

the Issue is I see a compilatiom Error While instantiating the Scoreboard class in the TB Block, as below:

scoreboard_clss #(// Queue Class 
		   queue_clss #(.PAYLOAD_T(pkt_type0), .SIZE('d64)) , 
                   // PAYLOAD 
                   .PKT_PAYLOAD_T(pkt_type0) 
 	) scoreboard_inst = new("TB ULT Scoreboard-0", mbox_mon2sb, Que0);  

Error:
Error-[SE] Syntax error
Following verilog source has syntax error :
“ult_tb_prgrm.sv”,
374: token is ‘.’
.PKT_PAYLOAD_T(pkt_type0)
^

thanks
Irshad

In reply to Mohammed Irshad Ahmed:

Your problems seems to be you are mixing parameter passing by order versus by name. Choose one or the other.

Hello Dave,

Can you help me with the correct-code ? I am not able to get this fixed.

thanks
Irshad

In reply to Mohammed Irshad Ahmed:

scoreboard_clss #(// Queue Class 
		   queue_clss #(.PAYLOAD_T(pkt_type0), .SIZE('d64)) , 
                   // PAYLOAD 
                   pkt_type0
 	) scoreboard_inst = new("TB ULT Scoreboard-0", mbox_mon2sb, Que0);

or

scoreboard_clss #(// Queue Class 
		   . queue_clss_inst (queue_clss #(.PAYLOAD_T(pkt_type0), .SIZE('d64)) ), 
                   // PAYLOAD 
                   .PKT_PAYLOAD_T(pkt_type0) 
 	) scoreboard_inst = new("TB ULT Scoreboard-0", mbox_mon2sb, Que0);

In reply to dave_59:

Thanks. I see the mistake. :)

-Irshad