Thursday, February 09, 2012     Register | Login | Search | Contact Us
     

Many of you already received communications about the move of the Cadence user community into cadence.com. And many of you have already joined, with over 4000 registrations in the first two weeks.

The new Cadence Community enhances the ability of Cadence users to connect and collaborate. In addition to moving the community into cadence.com -- enabling single sign-on for community, Sourcelink and Cadence events -- the new site is organized around nine technology segments, giving you easy access to product information, training, forums and blogs. Some of the new features include:
  • Ability to respond to posts via e-mail
  • Technology-specific blogs
  • Latest Web 2.0 social networking capabilities
  • Public profile options
  • Private messaging
  • Friends lists
Visit the new Cadence Community today at www.cadence.com/community and join the discussions!

Registration note: Due to the scope of the enhancements and the new SSO registration system, we were not able to migrate existing cdnusers.org member accounts. So new registrations are required, but this enables a broader set of functionality we think you'll enjoy.

Forum note: Under the guidance of forum moderators, we have taken the 20+ cdnusers.org forums and consolidated them into 11 forums on the new site. Posts have been brought over so you can leverage that posting history. CDNusers forums will be set to read only starting 7/30, and cdnusers.org will be redirected to the new community on 8/4.

Best regards,
Mike and Tom

Michael A. Catrambone - Steering Committee Chairman
Distinguished Engineer
PCB/Mechanical
UTStarcom, Inc.

Tom Diederich
Cadence Community Manager
Home
Forums
Subject: usage of pack & unpack in URM
Posting to forums is available to community members only.
Login or Register
Rate this topic:
   
Author Messages
raghavendrap
Posts: 20
Online: User is Offline
4/01/2008 5:39 AM  
Hello friends,
                       can anyone let me know the usage of pack & unpack (urm_object ) with specific example.

Regards
Raghavendra
tpylant
Posts: 87
Online: User is Offline
4/04/2008 9:27 AM  
I am not sure I would advocate using URM pack/unpack because you have to know a lot about what is going on. In OVM the packer has functions to pack various object types and the automation is there. You will see from this example that it is pretty ugly to do this in URM. Of course you can make your own convenience functions to simplify this greatly.
 
module test;
  `include "urm.svh"
  class mydata extends urm_object;
    int sz;
    byte payload[]
 
    function void resize(int size);
      sz = size;
      payload = new[sz](payload);
    endfunction
 
    function void do_pack (ref bit bitstream[],
                           input urm_packer      packer);
      //Used to size the bitstream array
      if(packer.nopack) begin
         packer.count+= (payload.size()*8) + $bits(sz);
         return;
      end
 
      for(int i=$bits(sz)-1; i>=0; --i) begin
        bitstream[packer.count] = sz>>i; packer.count++;
      end
      for(int j=0; j<payload.size(); ++j)
        for(int i=7; i>=0; --i) begin
          bitstream[packer.count] = payload[j]>>i; packer.count++;
        end
    endfunction
    function void do_unpack (ref bit bitstream[],
                           input urm_packer      packer);
      sz = 0; 
      for(int i=0; i<$bits(sz); ++i) begin
        sz = (sz<<1) + bitstream[packer.count] packer.count++;
      end
      resize(sz);
      for(int j=0; j&lt;payload.size(); ++j) begin
        for(int i=7; i>=0; --i) begin
          payload[j] = (payload[j]<<1) + bitstream[packer.count] packer.count++;
        end
      end
    endfunction
 
    `urm_object_utils_begin(mydata)
      `urm_field_int(sz, DEFAULT)
      `urm_field_array_int(payload, DEFAULT)
    `urm_object_utils_end
 
  endclass
  mydata md = new;
  mydata md2 = new;
 
  bit bits[]
  initial begin
    md.set_name("md"); md2.set_name("md2");
    md.resize(10);
    for(int i=0; i<10; ++i) md.payload[i] = i*i;
    void'(md.pack(bits));
    void'(md2.unpack(bits));
    md.print();
    md2.print();
  end
endmodule
Tim
Posting to forums is available to community members only.
Login or Register

Forums > Functional Verification > SystemVerilog > usage of pack & unpack in URM


ActiveForums 3.6
     
Copyright 2006 Cadence Design Systems, Inc.