Favor Composition Over Inheritance - Even for Constraints

Simulation is currently the dominant functional verification technique, with constrained random verification the most widely used methodology. While producing random data is a big part of it, letting the solver blindly generate stimulus isn't going to be very efficient. Constraints are needed to guide the stimulus toward interesting scenarios.


This is a companion discussion topic for the original entry at https://verificationgentleman.netlify.app/2020/03/29/composition-for-constraints.html

I definitely like this idea, however, I’d like it even more if it had factory override capabilities like mixin constraints do. For that reason, mixin constraints have an edge in my book.

The more I consider this approach, it seems like a good alternative for occurrences of x.randomize() with { ... }; more so than an alternative for mixins/inheritance.