I recently read a paper by Rich Edelman titled “Does the Factory say Override”
I have following Code :: EDA_CODE1
For above code via +define+MACRO the code uses macro `uvm_component_param_utils which doesn’t perform string registration .
No Fatal error is flashed when the override fails !!
Without any define I observe Fatal Error ( advantage of explicit Specialization of uvm_component_registry ) ,
[Q1] why is it so ??
[II] [Q2] Can I say that a short-cut to determine whether an override takes place is that ::
(1) The overridden_type ( extended class ) should be extended from the original type ( base class )
(2) Both the Specialization should be Matching type ( both signed / unsigned , both 2-state / 4-state , both have same range )
Eg :: If the following assignment is Successful override will ALWAYS take effect
class C #(BITWIDTH); // Base type / Original type
endclass
class C2 #(UINT32 BITWIDTH) extends C#(BITWIDTH); // Extended type / Override type
endclass
class C3 #( BITWIDTH) extends C#(BITWIDTH); // Extended type / Override type
endclass
module top();
C #(128) c_signed_int_128; // signed - type
C2 #(128) c_unsigned_int_128; // unsigned - type
C3 #(128) c3_signed_int_128 ; // signed - type
initial begin
c_unsigned_int_128 = new();
c3_unsigned_int_128 = new();
c_signed_int_128 = c_unsigned_int_128 ; // Compilation Error since not Matching types ( one is signed other is unsigned ) !!
c_signed_int_128 = c3_signed_int_128 ; // Since Matching types override would be honored !!
end
// [a] Hence C #(128) can't be overridden by C2 #(128)
// since specialization isn't matching !!
// **C #(128) can be overridden by C3 #(128)
// since specialization is matching !!
endmodule
Similarly for second code :: EDA_CODE2
[b][Q3] Are the following actual argument to string argument Tname a valid syntax ??** ::
$sformatf("env#(%0s)" , $typename( T ) )
$sformatf("env_with_coverage#(%0s)" , $typename( T ) )
$sformatf("wrapper#(%0s)" , $typename( T )
Is there any alternate way to provide a valid string argument to Tname taking into consideration the type Parameter T ?
[Q4] Since ONLY code with +define+M5 has the 2 Parameterization as Matching ,
shouldn’t Code via +define+M5 give a Successful Override ?
In all other cases ( +define+M1 / +define+M2 / +define+M3 / +define+M4 ) I should expect a Fatal error , right ?