[UVM 1.1d] Effect of uvm_object_utils on backward compatibility

Good day!

May I ask if adding `uvm_object_utils will affect backward compatibility?

Currently, I have a base data class (base data class → uvm_sequence_item → uvm_object) that does NOT use `uvm_object_utils.
However, I encounter an elaboration error when using the base data class with uvm_reg_predictor#(base data class).

I can fix the error by:
a) using an older simulator version
b) adding `uvm_object_utils() to the base data class

I prefer b) because it feels like the right solution. However, many other testbenches use my data class. My worry is that option b) might cause errors in these other testbenches. Is this worry valid?

++ Note1
I think the base data class did NOT originally include `uvm_object_utils because it was intended to be a purely-virtual data class, and was not expected to be registered w/ the factory. However, I rummaged through UVM-1.1d source code, and found that uvm_reg_predictor#() uses type_id::create() with its parameterizing class.

++ Note2
Option c) might be to parameterize uvm_reg_predictor with my testbench’s data class, instead of the base data class. However, I still can’t get option c) to work because of unrelated issues.

Thank you very much!

Best Regards,
Jose

In reply to jangeles:

There should be no backward compatibility issues registering a class with the factory that had not been previously. The only issue you could run into is if the base data class constructor was defined using more than just the string name argument. The factory’s create() method only supplies one argument to the constructor.

In reply to jangeles:

I can fix the error by:
a) using an older simulator version
b) adding `uvm_object_utils() to the base data class

I am not sure about how simulator dependency is created over here.

I think the base data class did NOT originally include `uvm_object_utils because it was intended to be a purely-virtual data class, and was not expected to be registered w/ the factory.

Registering the class with factory will create a uvm_object_registry for that class and some other methods. It will also try to create an object of the class internally. The code won’t compile if “base class” is declared as “virtual”. By labeling it as virtual class, it is bound to be an incomplete class.

You need to remove the “virtual” keyword from the base class and make it a normal class. Then you can register it with factory. After registration with factory, there would be no backward compatibility issues.

Or if you have some other testbench base data class (non-virtual), then you can use that class in parameterizing uvm_reg_predictor.

Refer to this blog post that describes the same problem and its workaround.

Thank you guys!

The only issue you could run into is if the base data class constructor was defined using more than just the string name argument.

Only name was used, that’s good news :)

I am not sure about how simulator dependency is created over here.

I think the old simulator version used UVM1.1, while the newer version used UVM1.1d.