In UVM-based SystemVerilog testbenches, transaction classes must extend from uvm_sequence_item (not uvm_transaction) and include factory registration via uvm_create_subclass, with copy functions named 'do_copy' and convert_to_string functions for debugging; sequences extend from uvm_sequence, are parameterized with transaction types, and use the body task to generate transactions via factory creation (class_name :: type_id :: create()) followed by start_item() and finish_item() methods to send transactions to the sequencer, while debug messages should use uvm_info macros instead of system.$display().
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Course : UVM in Systemverilog 1: L7.2 : Writing First UVM Transaction & Sequence Classes
Added:so here is your first uv-based program this is an equivalent response of converting your previous example into a uvm based response so in the main testbench package i am first importing it the uvm package also you need to enable uvm appropriately uh by using some switches or you might want to if you are doing it in in your own environment you you might want to download it and include the package into your compilation scope and after that i have written five different files named a transaction file an agent file a sequence an environment and a test file so i have included a lot of them and if you look at the main expansion all this part is exactly the same except the initial begin part which will come at the end so first we will go through the transaction so we are modeling the exa transaction in your environment and it will look like this so here is your axa class exit transaction class which is extending from the uvm sequence site so as i said earlier you should always extend your transaction classes from this uvm sequence item class not from the uvm transaction class and the next line should be a factory registration macro which is uvm tick uvm object utils in case of the data components which are transactions and sequences and rest of the part is looking similar to your simple known uvm based pure system you know class based test bench that you have seen in previous examples and note that instead of writing a copy in your previous example where you have written your own class based test bench you could you could have given any name for this copying function and convert the printing function but when you write the uvm based expense you should follow this your copy function name should be like do underscore copy and you should pass an uvm object as an argument so this line you cannot change and the content of this do copy function is same as that of the copy function so this is how it will work in case of uv transactions when you call a trans any uvm transaction dot copy function the um um mechanism will automatically call the do copy function within the transaction item therefore you don't need to write give the name of copy here but you should give the name of do copy here and also you should give the name exactly same as convert to string and it's not print function or some other function if you want you can add extra function but this convert to string is a standard uvm uh transaction function so this part was quite simple your you a uvm transaction was almost similar to that of your simple class based transactions and next one is generating multiple transactions which is nothing but a sequence so after writing transaction you should write a sequence or multiple sequences so your frequency something which is initiating a load a large number of transaction either one transaction or n transactions and this is how you should write you will write a uvm sequence plus your sequence name which is extending from the uvm sequence and remember to parameterize uh this particular sequence with the type of transaction which you wanted to operate with in this case it is ax underscore three action which is just the name of this particular class which you have uh given for that transaction class now the next line is the uvm factory registration macro which is tick uvm object utils allowing the class name of the sequence now the purpose of writing a sequence is to generate a number of transactions so you can compare the sequence class to a generator class in a class based test bench even though it is not exactly equal it is doing somewhat similar functionality but remember that the sequence is just doing the the functionality of generating transaction it have no information about where these transactions will be sent or it has no idea about about the structure of the test bench or about the interface or about any ports or about any mail boxes in short sequence is a standalone stimulus generation class now here is the content of the sequence you need to write a new function and it should be something similar to this you can pass an optional argument to every initialization objects and also you should can call the super dot new and if you have so many other initialization you can add it here and don't remember to add the super dot new if you're adding some lines after this and the next task in the next method and sequence is a body task so this is a compulsory task you need to fill the content of the body tax so it should be what it is a virtual task and it's a task casket it's not a function and you should write all your intelligence of writing or generating multiple transactions within this body function body task so in here instead of writing it it's within this body task i am writing it as another separate task with names and right transaction if this is somewhat similar to this um task you have seen in a class-based symbol sv test bench but there are few differences which will look into this so again i'm using a for look to gen to generate few a number of transactions and the first difference you have noticed should be um the way in which i am initial creating the object of the transaction so in in a simple sv based response you were initializing or an object just by using the new name so we were just calling like something something like t x n is equal to nu generally in uvm based test bench we will not directly call any of the class objectives with a new function but instead we will use the um's its own factory registration method so this is nothing but this factory registration method so this is a general syntax to create any object by using factory so first you will give the class name so here in this case it's the ax underscore txl then colon colon type id colon call and create then you can pass all the arguments of that particular object if there are any so this class name column colon type is a general structure you don't need to understand completely at this point as a beginner but just to understand that it is equivalent to calling a new function right or this this call will eventually create a new function or eventually create an object of this class type and return that handle to this particular variable dxn so it's literally equivalent to dxn is equal to nu but never directly called this tx and is equally new within this in in case of any of the uvm components because why you see if you are simply calling new or answer it might work but you are losing the power of uvm factory which is very important in case of vertical and horizontal the use of your trespage component so here you have created the handle of this transaction and next as usual we will randomize the transaction and after that again these two lines are specific to uvm within the sequence you will after creating the handle of the transaction you will call these methods called start item and finish items at this point you just remember that this these are the tasks which will eventually send this particular transaction into your sequencer and finally into the driver so this is where you actually send a transaction um to your duty or into the driver and finally into the duty if you told you want to get some response buy from the duty at the sequence this is where you will wait for it you can ignore it at this point of time and another important difference between your conventional test bench and the uvm test punch is the way in which you print your debug messages there you are using the system will dollar display function but ideally i would recommend never use your dollar display functions into any of the uvm components but instead use the uvm's its own macro named tick uv info to report any information or debug messages we will use tick uvm info and there are similar other messages other macros as well which are tick uv mirror dqm warning and the uvm fatal so you might want to use the trick uvm error to report an error in in your test point whenever you're encountering an error scenario now this is how you will report uh debug messages by using take qam info so typically the first argument is a string which could be the function or some other your own standard way of recognizing this message so ideally i would give the function or tax name from which this is reporting and next next one could be a formatting string which is uh giving the actual information with the actual debug information in this case i am saying that uh sending axa right transaction and using the tx android convert to string method to get a formatted transaction and the third argument to this is the uvm verbosity level so you can disable this debug message information printing by using different verbosities levels but again at this point don't bother about it just use uvm medium always now to summarize this is how you write a sequence so the main difference or the main features of the sequence that you might want to notice here is first one is a body function so this the body tasks and it is where you will write all your intelligence and this is a task which is getting called when the sequence is actually starting on a sequencer which you will see later and you can add any other any number of subtasks to this and whenever you are creating a transaction or any other uvm based components or data classes always use the factory creation method just by class name colon colon type id code and call and create and in case of transactions when you actually wanted to send a transaction to this um duty use this start item and finish item functions and also in order to print debug messages instead don't use dollar display function but use tick uv mean for macro
Related Videos
LBF101 Creating an XML Changelog
liquibase7511
3K views•2026-06-15
Alta Labs Cloud Dashboard Real time Network & Xnet Insights!
ShinyTechThings
158 views•2026-06-17
Wait... Group Policy Not Applying? Check This First!
keeplearning_iT
144 views•2026-06-15
Leetcode Weekly Contest 506 | Life's boring these days
Pudeesht
2K views•2026-06-14
microJAM: MAKING A MICRO GAME FOR A GAME JAM IN CLOJURESCRIPT AND TOTALLY NOT C
janetacarr
156 views•2026-06-18
Partitioning vs Bucketing vs Clustering: How to Make Queries 100x Faster
thedataandaiguy
194 views•2026-06-16
Design Claude Code Like a Senior Engineer
hayk.simonyan
344 views•2026-06-19
Linus Torvalds: AI Won’t Replace Understanding Code
SavvyNik
140 views•2026-06-19











