I thought a parameter within a virtual class in a package can be overridden. I define several structs in a package that needs to be used in multiple modules and was looking for a clean way of accomplishing it using virtual classes. Is there a better way to do this for synthesizable code? Please see a small example below.
package test_pkg;
parameter X = 4;
virtual class override_params #(parameter ARRAY_SIZE = 2);
parameter XXX = 2*ARRAY_SIZE;
endclass: override_params
endpackage
module test();
parameter NUM_MASTERS = 16;
import test_pkg::override_params#(.ARRAY_SIZE(NUM_MASTERS))::*;
//import test_pkg::*;
//synthesis off
initial
begin
$display (" X is %d\n", X);
$display (" XXX is %d\n", XXX);
end
//synthesis on
endmodule
I was trying to use import to expose the parameters in the virtual class.
Thanks
Noel