ASIC Verification: Sequences in Specman

Monday, September 22, 2008

Sequences in Specman

What are the sequences in Specman? What are the significance of sequences? This post explains the way of implementing the sequences in specman.

Introduction: Sequences let you define the streams of data items sent over to the input protocol of the DUT. Before moving on to the details of sequences, let me give you some of the important definitions.

Item : It is a struct that represents the main inputs to the DUT - Basically a USB packet or an CPU instruction.

Sequence : It is a struct that represents the streams of data items generated one after another according to some protocol, say for example, in USB - Out or setup packet is transferred followed by Data packet.

Sequence driver : The SD acts as an agent b/w sequences and the Bus Functional Model (BFM). Basically, a SD takes the generated data items and pass it on to the BFM which in turns convert all your high level data items (Packets or Instruction) into low level data items (bits and bytes).

Basically a TCM which resides in the BFM does the actual transmission of data items. Both the sequence driver and BFM acts as a pair; The sequence driver serves as the interface upward towards the sequnces and the BFM serves as the interface downward towards DUT. Therefore the Sequence driver only interacts with BFM for the purpose of driving data item into the DUT.

How to use sequences?

1. Define the sequence item struct - For an item to be used with sequences, it must have some common functionality.

type usb_pid_t : [SETUP = 0xD, OUT = 0x1 , IN = 0x9];

// Create the sequence item
struct usb_transaction_s like any_sequence_item {
dev_addr : uint (bits : 7);
ep_num : uint (bits:4);
pid : usb_pid_t;
data : list of uint (bits : 8);
};

2. Define the sequence and its driver using the sequence statement

// Define the sequence
sequence usb_sequence_s using

item = usb_transaction_s,
created_driver : usb_transaction_driver_u; // Name of the driver
created_kind : usb_transaction_kind_t; // Various sub types for the sequence

3. Hook up the sequence driver to the environment

Have a BFM that knows how to drive the USB packet to the DUT.

unit usb_bfm {

event usb_clk is rise ('usb_clk_30') @ sim;
drive_packet ( packet : usb_transaction_s) @ usb_clk is {
-------
------
}; // End of drive_packet TCM
}; // End of unit usb_bfm

The BFM is instantiated in the Agent

extend usb_bfm {
driver : usb_transaction_driver_u; // Reference to the sequence driver in the BFM
};

unit usb_agent {
bfm : usb_bfm is instance; };

extend usb_agent {
driver : usb_transaction_driver_u is instance;
keep bfm.driver == driver;
};

connect the pre-defined clock to the BFM clock

extend usb_bfm {
on usb_clk { emit driver.clock }; };

Pull item from driver, process it and inform through done
Instantiate the driver into the Agent

extend usb_bfm {
execute_items () @ clock is {

var sequential_items : usb_transaction_s;
while (TRUE) {
sequential_items = driver.get_next_item();
drive_packet (sequential_item);
emit driver.packet_done;
}; // End of while loop
}; // End of execute_item TCM

run() is also {
start execute_items ();
}; // End of run method
}; // End of usb_bfm

In the next post, we will see how to implemet the sequence library and how to write the test case s using the sequences.


8 comments:

Anonymous said...

man this is confusing ..
specman sucks

Anonymous said...

Where is the gut of the driver defined? Like, where are the driver clock, done flag and others defined?

I assume the sequence driver and other stuffs are part of the sequence library. And they are implemented with the sequence library.

Am I correct?

Anonymous said...

Sorry for the stupid question. What is the best search engine http://google.com or http://yahoo.com?

velvlsi said...

tell your mail id suresh...

selva vinayakam said...

any body know how to send sequence from bfm to dut

Tauf said...

Guys am working on specman from past couple of months. will try to put some light on this topic..how to send sequence from bfm to dut?
keep it simple:)
1) firstly sequence library consists only sequences according to eRM methodology
Now, sequences in the Seq library.. simply responsible to constrained i/p data streams with the help of item stuct unit( which is dynamic object, who generates all the constrained fields on the fly).

2) driver will keep transmitting items regularly while sequences passing until sequence finished sending (constrained data packet/frame).

3)This item(packet/frame) will be passed as an argument by calling the BFM (TCM method)

4) the BFM (TCM method) will pass the complete packet/frame by transforming higher level of data to lower level data (transformation will be done by pack option high/low option available in specman). Where BFM is mainly responsible to drive the data to DUT interface.

Hope my explanation will help u guys

Cheerz:)

Anonymous said...

this language is confusing,not is so much complex but is confuse

beela jhones said...

Brilliant post. I think there is a gap in the market for this type of equipment, but this company are really filling the brief.

Asic Design