ASIC Verification: Events in Specman

Thursday, March 6, 2008

Events in Specman

In this tutorial, we are going to see the definition of events, how the event is emitted and understand the temporal operators. In order to communicate the specman elite 'e' with HDL simulator, say for example Modelsim, timing and synchronization are very important. The 'e' language provides timing constructs for specifying behavior over time.

Events are defined as the occurrences of certain activity in specman elite or the HDL simulator. Events can be attached to a temporal expressions using the option is temporal expression syntax.
struct event_definition
// Standalone event that will be emitted manually.
event sync_xmitted;

// When a negedge of the HDL signal ~top/clk occurs
// an event top_clock is triggered in specman elite.
// @sim is an sampling event that initiate a callback
// from simulator to specman
event top_clock is fall ('~/top/clk') @sim;

// pack_xmitted is emitted when sync_xmitted is
// followed by 30 clock cycles of emissions of top_clk
// event. @top_clock is a sampling event.
event pack_xmitted is {@sync_xmitted; [30]} @ top_clock ;
}; // End of struct

Event Emission

The triggering of event is called event emission. Events are emitted explicitly with emit action. When events are emitted, threads that were blocked are un blocked and scheduled for the execution. The following program explain this concept.
event rx_evt;
tx() sys.clk is {
wait cycle;
// Wait for the next emission of sys.clk event
emit rx_evt;
// Emit the rx_evt
out("Receive event is emitted");

rx() sys.clk is {

// Wait for the next emission of rx_evt
// it will happen when the rx_evt event is triggered
// by the 'emit rx_evt' action in the tx() method

wait @rx_evt;
// Print after the rx_evt is emitted
out ("Rx event is occured");
stop_run ();
// Finish the run

run() is also {
// Start both the methods in parallel
// at the beginning of simulation

start tx();
start rx();
// End of run()
// End of struct

extend sys {
event clk is sys.any;
tx_rx_inst : tx_rx;


No comments: