I'd like to know if it's possible to somehow figure out if, by mistake, inside a UVM driver the developer writes to a DUT output signal, instead of an input signal. I've tried this out and there is no compile/runtime error message. The example is here (try outs were done in Incisive on my machine and the code later uploaded):
http://www.edaplayground.com/x/386
The assign on 'some_signal' models a DUT output (a continuous driver). I would have expected a runtime error whenever I try to drive 'some_signal' from the class saying that the signal is multiply driven, but the class driver "wins" and updates the signal.
Some time ago, when I had just started doing SV I played around with modports. I would declare some signals as inputs in the modport, but I noticed that it was still legal to drive them. I quit using them afterwards. Apparently this is something well known, as this post says: https://verificationacademy.com/forums/systemverilog/modports-sv
I recently inherited some code from a colleague that makes use of modports in classes. I made the following example to illustrate what that code is doing:
http://www.edaplayground.com/x/2W_
I try to use modports in the two classes, but ModelSim complains that one should not use modports in hierarchical paths. Incisive had no problem with the code and issued no warnings. The ModelSim errors, together with this quote from the 2012 standard "To restrict interface access within a module, there are modport lists with directions declared within the interface." kind of suggest that modports aren't really intended to be used in classes.
Can someone confirm that modports aren't the way to go here? Also, does anyone know if such errors (driving DUT outputs from classes) could be caught in any way?