The API is the
same for Verilog and SystemVerilog. As stated previously, the name
"Verilog" refers both to Verilog and SystemVerilog unless otherwise
noted.
The
recording APIs for Verilog and VHDL are a bit simpler than the SCV API.
Specifically, in Verilog and VHDL:
- There is no
concept of begin and end attributes All attributes are recorded with the
system task $add_attribute() or add_attribute.
A transaction has a begin time, an end
time, and attributes. Examples of transactions include read operations, write
operations, and packet transmissions. The transaction level is the level at
which many users think about the design, so it is the level at which you can
verify the design most effectively.
Transactions are recorded on a stream. A
stream is a collection of transactions, recorded over time. A stream has a
name, and usually exists somewhere within the test bench hierarchy – for
example a driver might have a stream which represents all the transactions that
have occurred on that driver. Each driver defines a collection of attributes (
transaction items ) which are defined by users, and which are meaningful to the
transaction. The values of attributes are set for each transaction. Finally,
transactions can be linked to each other. A link has a direction and a
user-defined name, and specifies a relation between the two transactions.
module top;
Here,
1. $create_transaction_stream() is used to define a transaction stream. You can use this system task to create one or more stream objects.
module top;
integer hStream
initial begin
hStream = $create_transaction_stream("stream", "transaction");
.
.
end
.
.
endmodule
integer hTrans;
.
.
hTrans = $begin_transaction(hstream, "READ");
1. $create_transaction_stream() is used to define a transaction stream. You can use this system task to create one or more stream objects.
module top;
integer hStream
initial begin
hStream = $create_transaction_stream("stream", "transaction");
.
.
end
.
.
endmodule
2. $begin_transaction
is used to start a transaction by providing a valid handle of the transaction
as shown below.
integer hTrans;
.
.
hTrans = $begin_transaction(hstream, "READ");
In this
example, we begin a transaction named "READ" on the stream already
created. The $begin_transaction system function accepts other parameters to
specify: the start time for the transaction, and any relationship information,
including its designation as a phase transaction.
The return
value is the handle for the transaction. It is needed to end the transaction or
record attribute.
3. $end_transaction has a single required argument – the handle of the transaction that is to be ended. It also has a single optional argument, the time in the past that this transaction ended. After a transaction has been ended, the transaction handle can still be used to add attributes and create relations.
$end_transaction( handle transaction [, time endTime])
4. $free_transaction has a single argument – the handle of the transaction to be deleted. Once a transaction is deleted the handle becomes invalid. It cannot be used in any other recording interfaces.
$free_transaction (handle transaction)
5. $add_attribute has two required arguments – a transaction handle on which the attribute is to be created and the attribute that is to be recorded. There is one optional argument of type string named attributeName. This attributeName specifies an alias name for the attribute. If not specified, the name used for the attribute is the actual name of the SystemVerilog object.
$add_attribute( handle transaction, object attributeValue [, string attributeName])
6. $add_relation has three arguments – the first two are the two transaction handles which are related. The third argument is the string name of the relation.
$add_relation( handle sourceTransaction, handle targetTransaction, string relationshipName)
No comments:
Post a Comment
Please provide valuable comments and suggestions for our motivation. Feel free to write down any query if you have regarding this post.