UVM e Verification Tutorial using Specman
Aviral Mittal
I have collected some simple and popular questions and their
answers here
Q. What does a % character means before a field in a
struct?
A percent character emplies a 'physcial' field. These fields are
usually related
to actual signals on the DUT. These are also used in 'pack' and
'unpack' methods defined in 'e'.
If a field is not preceded by % before its name, it will be ignored
by 'pack' and 'unpack' methods.
If a field is precedded by a % character, it will be used by 'pack'
and 'unpack' methods.
Q. What does a '!' character means before a field in a struct?
A exclaimation character implies 'do not generate'.
If a field is not preceded by ! before its name, Specman will
generate a random value for this field.
If a field is preceded by ! before its name, Specman will not
generate a random value for this field.
Q. What does '{ ; }' means?
Its the list concatination operator.
Q. How is stimulus generation actually started?
Each struct has a predefined run() method. The run() method is
automatically started in the 'run' phase.
Usually the BFM will have a TCM which will get data item from the
driver, and drive it on the DUT interface
using the elements or field values from the data item.
This TCM is usaully started by extending run() method of the BFM.
For example if the TCM is called 'drive_bus()' then the BFM should
have s'thing like this: run() is also {start drive_bus()};
Q. What is any_struct:
Specman has a predefined struct, any_struct, which in turn has many
predefined methods.
Some of these predefined methods, such as init() and run(), are
invoked automatically when you execute
the test command. Other predefined methods, such as copy() or
do_print(), manipulate data within the struct.
All user-defined structs inherit from any_struct, so all its
predefined methods are available to any struct you define.
Q. What is reset_soft()
It is a predefined method to ignore the soft constraints on a field.
Q. What is "is a"
struct-exp is a subtype [(name)]
Example :
if me is a long packet (l) {
print l;
};
Other example of "is a" can be used for type narrowing
keep type my_tree is a oak;
Q. Template Struct:
A way of defining parameterized structs.
Example:
template struct stack of <type> {
private items: list of <type>;
pop(): <type> is {
if items.is_empty() { error("Stack is empty") };
return items.pop();
};
push(x: <type>) is {
items.add(x);
};
};
Q. What is 'on'
'on' is evnet related
event burst_ended;
on burst_ended {
}
on event_name {action;...}; Q. What is rise/fall/change
These are 'e' temporal expressions.
Q. deliver_item : A specman method
Q. What is the relationship between do pkt_item and
get_next_item()?
A. 'do pkt_item' will generate a 'pkt_item', so we can do something
like
do pkt_item;
do pkt_item;
do_pkt_item;
this should generate 3 pkt_items. But Wait, unless the BFM retreives
each of the generated 'pkt_item' using
'get_next_item(), and
sends a 'emit item_done' to the BFM, the BFM will not generate the
subsequent data items.