I wan to communicate vmm xactions with uvm agent in vmm env.
By converting vmm tranctor data to UVM sequence format and connection VMM channel to tlm port of UVM . It’s expected to work .
Will it possible by direct connecting vmm channel to uvm agent with data pakt conversion?
Is there any other way to avoid data pkt conversion and doing communication between vmm channel to UVM agent in vmm env?
Or
any other better approach from 1staboves ?
Pls explain with example which will properly understandable.
Transactions in VMM and UVM are fundamentally different. They are different classes and use different methods, so it is not possible to pass a vmm_data object to a UVM agent and vice versa withoug a data conversion.
If they’re both apb masters, the conversion is easy. The data members just get copied from one to the other. The trick is that you’ll have to do the conversion inside of a custom component - one that talks VMM on one side to get/put the VMM transaction via the VMM channel and talks UVM on the other to get/put via TLM.
I have done the data coversion from vmm tranction to uvm sequence item(uvm tranction).
Also I have developed adapter for same .
Now I wan to connect that adapter to uvm driver component .
can anyone explain with example for connecting adapter to driver port?
As per my knowledge uvm driverconnected to sequencer by sequence_item_port by using connect methode .
So wht will be for adapter connection with uvm driver component?
The easiest thing is probably to create a sequence that pulls sequence_items from the converter and then passes them to the driver. That way the sequence/sequencer/driver relationship isn’t changed. Going off the top of my head, it would look something like this:
class my_seq extends uvm_sequence#(uvm_apb_item);
vmm2uvm_converter conv; //pointer set from env/test after creating sequence
//before starting it
virtual task body();
while(not_done) begin
conv.get(trans);
start_item(trans);
finish_item(trans);
end
endtask
...
endclass
The conv.get() call would be a blocking call to pull the converted transaction when one becomes available. Since you’ve already got the vmm_channel, I’m thinking that this would do a channel.get(), convert the vmm_data object and return the converted uvm_sequence_item.
Sound good?
-Tom
Again test is generating stimulus from vmm world .
So Vmm Transctions are need to be converted to UVM sequence item onfly in env .
Will the above mentioned method work?
or Is there a way whr another custom compent of UVM is created and connected to uvm_agent component for communicating between agent and new component ?
assuming that new component can do conversion from vmm tranction to uvm tranction
You could do it via the agent, but you’d have to extend uvm_agent to add the tlm port. By doing it in the sequence, all you have to do is pass in a handle to your converter component to the sequence, as I showed. By doing it this way, your agent is more reusable since it doesn’t depend on the added port. If/when you convert your stimulus generator to UVM, you can simply replace the my_seq sequence I showed with one that generates your transaction stream and neither the agent, sequencer nor driver would need to change.
static function uvm_apb_rw convert(vmm_apb_rw from, uvm_apb_rw to=null);
if (to == null)
convert = new;
else
convert = to;
case (from.kind)
vmm_apb_rw::READ: convert.cmd = uvm_apb_rw::RD;
vmm_apb_rw::WRITE: convert.cmd = uvm_apb_rw::WR;
endcase
convert.addr = from.addr;
convert.data = from.data;
convert.set_transaction_id(from.data_id);
convert.set_sequence_id(from.scenario_id);
endfunction
encclass
Suppose above is code for converter.
Can you pls how to use it for
class my_seq extends uvm_sequence#(uvm_apb_item);
vmm2uvm_converter conv; //pointer set from env/test after creating sequence
//before starting it
virtual task body();
while(not_done) begin
conv.get(trans);
start_item(trans);
finish_item(trans);
end
endtask
…
endclass
and wht’s the cond in while loop? , generally it’s the seqlen , but in this case tanction is generated from vmm generator.
inside vmm env how would it be communicated with uvm_agent.
you have to get the vmm_apb object from somewhere. Presumably, the VMM generator puts it into a VMM channel. You don’t show the apb_rw_convert_vmm2uvm class as being a UVM component, so I’m assuming it’s just a wrapper for the convert() function.
If that’s the case, then the sequence should look something like this:
class my_seq extends uvm_sequence#(uvm_apb_item);
vmm_channel vmmchan; //pointer set from env/test after creating sequence before starting it
apb_rw_convert_vmm2uvm vmm2uvm;
function new(string name = "my_seq");
super.new();
vmm2uvm = new();
endfunction
virtual task body();
vmm_apb_rw vmm;
uvm_apb_rw item;
forever begin // sequence will get killed when phase exits.
vmmchan.get(vmm);
item = vmm2uvm.convert(vmm); // see note below
start_item(item);
finish_item(item);
end
endtask
...
endclass
[NOTE] The way you’ve written your convert() function, you don’t need the ‘to’ argument, since you never do anything with it.
So, to recap:
Pass the VMM channel handle to your sequence, which has both vmm_apb and uvm_apb objects, as well as a apb_rw_convert_vmm2uvm object.
Have the sequence get the vmm_apb object from the channel (blocking operation)
Convert the vmm_apb object to a uvm_apb item
Call start_item/finish_item to send the item to the driver
No extra ports on the UVM agent. And since we don’t recommend this, I’m not even going to show you how to do it.
I modified the loop to be a forever loop. The sequence will automatically terminate when the phase ends. You’ll have to control the phase objections from your test, so your VMM generator will have to provide some sort of event that indicates that it’s done.
You’ll have to make sure that there’s some indication that the VMM side of the world has actually created the vmm_channel before you can pass its handle into the sequence (same for the converter, if it’s not a UVM component). A wait statement in the uvm_test run_phase looking for some event that the VMM side will trigger before it starts generating stimuli should do it.
Good luck,
-Tom
function new(string name = “my_virtual_sequence”);
super.new(name);
vmm2uvm = new(“VMM channel to UVM”);
uvm2vmm = new(“UVM channel to VMM”);
endfunction
forever begin // sequence will get killed when phase exits.
vmm2uvm.get(vmm);
start_item(item);
finish_item(item);
end
endtask
…
endclass
I created a seq which takes vmm data from channel and then using vmm channel to tlm port of uvm converted to uvm sequence item and inside task I am geting that item.
I am case uvm vip is present inside vmm wraper.
So vmm generation tranction need to be come by channel and processed to UVM VIP.
Again after procession in UVM VIP returned back to VMM wrapper.
Can you pls explain me how to use this uvm Sequenc class in VMM wrapper and on fly calling of UVM Sequencer will happened?
Also in VMM build phase , how connection of this sequence will be happened with sequencer?
You can’t run a uvm_sequence in a VMM wrapper. UVM sequences only run on UVM sequencers. If you really need to wrap a UVM component, you should wrap the UVM agent.
After you call finish_item() in your sequence, you should do a uvm2vmm.put(item) to send the result back to VMM-land.
It’ll be up to you to start the UVM sequence from your UVM test. Again, you need to do some handshaking in your test’s run_phase() method to make sure that the VMM build has completed and the channels and converters exist, then pass the handles into the UVM sequence before starting it.
Hi ,
As per you method I have tried
like below:
class my_seq extends uvm_sequence#(uvm_apb_item);
vmm_channel vmmchan; //pointer set from env/test after creating sequence before starting it
apb_rw_convert_vmm2uvm vmm2uvm;
function new(string name = “my_seq”);
super.new();
vmm2uvm = new();
endfunction
forever begin // sequence will get killed when phase exits.
vmmchan.get(vmm);
item = vmm2uvm.convert(vmm); // see note below
start_item(item);
finish_item(item);
end
endtask
…
endclass
I am abled to do start_item , but not getting finish_item in test simulation.