I have the following code ::
package my_pkg2 ; // Inside package my_pkg2
import uvm_pkg::* ; // Else Comilation error due to invalid 'uvm_blocking_put_port' type !!
typedef class producer ; // Class to be declared in top_tb !! . Gives Error although , not sure why
producer prod ;
class my_blocking_put_port #( type T = int ) extends uvm_blocking_put_port # ( T ) ("put_port" , prod ) ;
endclass
typedef class consumer ; // Class to be declared in top_tb !! . Gives Error although , not sure why
consumer cons ;
class my_blocking_put_imp #( type T = int , type IMP = int ) extends uvm_blocking_put_imp # ( T , IMP ) ( "put_imp" , cons ) ;
endclass
endpackage
Now I include and import this my_pkg2.sv in file top_tb.sv
// Inside file top_tb.sv
`include "uvm_pkg.sv"
`include "my_pkg2.sv"
`include "uvm_macros.svh"
import uvm_pkg::*;
import my_pkg2::*;
class producer extends uvm_component ;
`uvm_component_utils(producer)
// Standard 3 line component constructor here !!
function void build_phase ( uvm_phase phase ) ;
prod = this ;
put_port = new();
endfunction
endclass
class consumer extends uvm_component ;
`uvm_component_utils(consumer)
// Standard 3 line component constructor here !!
my_blocking_put_imp #(trans,consumer ) put_imp ;
function void build_phase ( uvm_phase phase ) ;
cons = this ;
put_imp = new();
endfunction
module top_tb ;
.....
endmodule
I get the following error ::
The forward typedef of the class does not have a definition in the same
scope. Please provide a definition to the forward class declaration.
Is typedef limited to same file declaration ?
Any solution to the issue would be appreciated .
Thanks