Home SystemVerilog Packing In OVM-e


Packing In OVM-e PDF Print E-mail
User Rating: / 0
Thursday, 24 December 2009 16:40

This example shows how to pack a struct into a list of Double Words (32 bit) keeping the original order. This time we got less talking, and more code:



Here's our struct:

struct my_struct_s { %byte1: byte;
 %word1: uint(bits: 16);
 %byte2: byte;
 %byte3: byte;
 %byte4: byte;
 %data1: uint(bits:11);
 %dword1: uint(bits: 32);
 %data2: uint(bits: 5);
keep byte1 == 0x12;
 keep word1 == 0x3456;
 keep byte2 == 0x78;
 keep byte3 == 0x9a;
 keep byte4 == 0xff;
 keep data1 == 11''b10101010101;
 keep dword1 == 32''b01010111111111111111101010101010;
 keep data2 == 5''b10101;

Let's instantiate it and pack it:

extend sys { my_struct: my_struct_s;
 run() is also {
 print my_struct using hex; // just for reference
 var my_list: list of uint(bits:32);
 my_list = pack(packing.high, my_struct);  // stage 1, pack
 my_list = my_list.reverse(); // stage 2, reverse to restore original order
 print my_list using hex;

And here's what the output should look like, note that the list reflects the original bit order

my_struct = my_struct_s-@0: my_struct_s
----------------------------------------------  @temp
0       %byte1:                         0x12
1       %word1:                         0x3456
2       %byte2:                         0x78
3       %byte3:                         0x9a
4       %byte4:                         0xff
5       %data1:                         0x555
6       %dword1:                        0x57fffaaa
7       %data2:                         0x15
my_list =
0.      12345678
1.      9affaaaa
2.      ffff5555
No actual running requested.
Checking the test ...
Checking is complete - 0 DUT errors, 0 DUT warnings.


More articles :

» Don't Be SYSsy

Anyone who’s ever worked with me knows that I have several weaknesses. One of them is extra sensitivity to things that reside under sys (global.sys) in Specman/e. If this is Chinese to you then you’re probably a SystemVerilog guy: "sys" is the...

» The Big Picture

Great verification engineers know the secret - if they want to be successful they must also understand the essence of the entire chip design flow, from concept to working samples. Here are some great videos that will help you see the big picture a...

» About UVM And You

There’s been a lot of buzz about the lately and for a reason. The Universal Verification Methodology is about to change the rules of the game pretty soon, if not already. That is interesting because not too long ago verification engineers...

» Ignorance Is A Bliss

There is a rather confusing feature in Specman’s coverage engine that I would like to share with you today. I’ve met several people (including myself) who had been struggling to understand what was going on there and gave up Recently I was...

» What Makes A Great Verification Team GREAT?

Your tool provider won’t tell you that, nor will those fancy methodology books, but verification is not all about mastering technical skills. True, those will help you very much in your daily work but verification is first and foremost TEAM WORK....

Add comment

Security code

Copyright © 2018 Think Verification - Tips & Insights on ASIC Verification. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.