Hi Amrutha,
If I could jump in, I think your original question is that you would like to send a series of transaction items where the randomized values in each item somehow depends on previous transactions. You also seem to have a requirement that you do not want to override any function except body() to do this.
It also looks like you are taking the approach of pre-generating all your items into an array, then using the body() method to loop through the items and send them. If I recall correctly, this is the kind of approach VMM uses. While this certainly is possible to do in OVM, I think you might be missing one of the design goals of scenarios - the ability to react to the current state of the simulation when building transaction items. When you pre-generate all your items, that kind of defeats their goal of building a transaction "just in time" when it is needed by the driver.
Back to your question, I'm not sure why you don't want to override the other functions, such as pre_apply() and mid_apply(). That is why they exist. They are meant to be user-accessible "hooks" into the process of randomizing and sending items to the driver. By default, they do nothing. They are there for you to take control over the creation of the item before it is sent. pre_apply is called before the item is randomized and mid_apply is called after randomization but before the item is sent. So, you could create variables in the scenario that maintain "state" or "memory" of what has transpired and set the item properties accordingly.
If you really don't want to use these functions, it is also possible to build in the "memory" of previous values right into the item randomization constraints themselves. For example, let's say you want to generate a random series of READ and WRITE transactions, with the constraint that the READ transactions only select values for addr that have already been used by previous WRITE transactions.
You could write something like this in your transaction class, and then you would not need pre_apply() or mid_apply():
Code:
class my_txn;
rand op_t mode; // Assume op_t is one of {READ, WRITE}
rand int unsigned addr;
static int unsigned addresses_used[$];
constraint use_prev_addr { mode == READ -> addr inside {addresses_used}; }
function void post_randomize();
if (mode == WRITE) addresses_used.push_back(addr);
endfunction
endclass
Does this help at all? Please forgive me if I misunderstood your question.
-Kurt
Bookmarks