Home Articles Specman-e 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 :

» Let The New Game Begin

Things are changing. The EDA industry is changing, and the verification world is changing (check out Janick Bergeron's inspiring at SNUG San Jose for a glimpse of the future of verification). One of the major challenges we’re already facing today...

» The Miracle Of Verification

Is verification really a miracle and verifiers have ceased to be engineers? Not too long ago I wrote an about some common myths in Verification. Today I would like to talk about a bigger myth which I like to call the "Verification Miracle Myth"....

» Cadence, Synopsys, Mentor - This Is Our Wish List

As the EDA industry seems to be making moves towards a Unified Verification Methodology (OVM + VMM) we thought this would be a great opportunity to share a couple of things that have been on our wish-list for quite a while.

» EndMaker: Make Your SystemVerilog Code Look Professional (Free Utility)

This is a cool little utility that will make your SystemVerilog look much more professional. It simply adds an end-of-method identifier (label) to every task or function so that every endfunction turns into endfunction : function_name (with the...

» VMM Hackers Guide - Creating Smart Scenarios With Atomic Generators

VMM ships with some pretty useful built-in components and applications. VMM''s Atomic Generator is probably one of the most powerful ones, yet it's pretty basic. It can definitely help you generate a flow of random items but it was not intended for...

Add comment

Security code

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