Sadiya Tarannum Ahmed, Senior CAE, Synopsys
In the default flow, the transaction level communication in VMM Channels operates in the ‘PUSH’ mode, i.e., the process is initiated by the producer which randomizes and pushes a transaction in the channel when it is empty. This process is repeated again when the channel is empty or the consumer retrieves the transaction from the channel. However, in specific cases, you might not want the generator to create stimulus before the bus protocol is ready or until it is requested by the bus-protocol. In this case, you may want to use the ‘PULL’ mode in VMM channels.
In ‘Pull’ mode, the consumer initiates the process by requesting transactions and then the generator or the producer responds to it by putting the transaction into the channel.
The following steps show how the communication can operate in “PULL_MODE”.
Step1: In the generator code, call the vmm_channel::wait_for request() method before randomizing and putting the transaction into the channel.
By default vmm_channel::wait_for_request() does not block (“PUSH MODE”). In “PULL” mode, it will block until a get/peek/activate() is invoked by the consumer
class cpu_rand_scenario extends vmm_ms_scenario; … cpu_trans blueprint; `vmm_scenario_new(cpu_rand_scenario) … … virtual task execute(ref int n); blueprint = cpu_trans::create_instance(this, "blueprint”); chan.wait_for_request(); assert(blueprint.randomize()); else `vmm_fatal(log, “cpu_trans randomization failed”); chan.put(blueprint.copy()); n++; endtask … `vmm_class_factory(cpu_rand_scenario) endclass
Step2: Set the mode of channels.
By default, all channels are configure to work in “PUSH_MODE” and can be set to work in “PULL_MODE” statically or dynamically.
·Static setting: Set the mode of channel in the testbench environment or in your testcases
gen_to_drv_chan.set_mode(vmm_channel::PULL_MODE);
Dynamic: call the Runtime switch +vmm_opts+pull_mode_on
Since the mode can be changed through vmm_opts, hierarchical or instance based setting for any channel can also be done at runtime. This brings in a lot of flexibility and the same channel can be made to work under different modes for different tests or even within the same simulation
The pre-defined atomic and scenario generators now support this feature; which can either be enabled by runtime control or by setting the associated channel mode to PULL_MODE in the environment.
Thus you now have the flexibility to configure your transaction level communication easily based on your requirements.
Posted in