Hi, I’m trying to understand why I get a correct waveform for this code (A correct waveform means that data_in is created exactly according to the constraint rules):
Do not re-declare your class member variables when extending into a derived class. The whole point of inheritance is “inheriting” all the members of the base class. Redeclaring member variables with the same creates 2 sets of variables and hides the variables in the base class from references in the extended class.
What is probably happening is you are constructing a transaction_pd type object and storing its handle in a transaction type class variable. That class variable can only reference the set of variables declared in transaction.
All you need to do is override the constraint p_data. When overriding a constraint in an extended class, you disable the same-named constraint in the base class.
Hello,
I think the reason for not correct waveform (i.e incorrect data_in values) could be that the order of solving window_start, window_end and data_in.
In the first case, for constraint p_data, you are using constant range ([10:20]) making easier for constraint solver.
But in the second case, you are using dynamic range ([window_start:window_end]). But what is the order these constraints resolved?
if data_in[] is solved earlier than window_start or window_end, then you could see unexpected results, which is what is happening in your case.
data_in[] has dependency on both window_start and window_end, which are solved by some other constraint. SO you have to use “solve before”
Try with the following:
constraint solve_order {
solve winow_start before data_in;
solve window_end before data_in;
}
I moved the transaction_pd members to transaction.
I don’t have the p_data constraint in transaction. its only existing in transaction_pd.
Still, same results.
But, I tried another thing because I suspected that the problem connected to the ‘inside’ key word. Try to explain this to me:
Is there any reason that get I get a correct waveform for this code (A correct waveform means that data_in is created exactly according to the constraint rules):
You need to show us a minimal,complete reproducible example. You have not sized the queue data_in explicitly or using a constraint. Try showing us a small example of your situation without UVM.