Wednesday, December 03, 2008     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: generic compare function :
Posting to forums is available to community members only.
Login or Register
Rate this topic:
   
Author Messages
zcabeli11
Posts: 27
Online: User is Offline
3/17/2008 5:45 AM  
Hello, i'd like to build a generic function that compare 2 elements and check their type on the fly. it should know how to deal with all types of data (bool, bit, uint buses and string that will point on specific port in the design). here's the semi-pseudo code of what i meant: i don't know how to extract variable data-type in run time, is it possible to do it ?

CheckNet (Lvalue:generic, Rvalue:generic) is {
//step 1: if any of the data comes as string, refer to it as a pointer to an element in the HDL and extract it by ticks. 
      if (Lvalue:type == "string")
            //create port of Lvalue
            var Lval:uint = 'Lvalue';
      if (Rvalue:type == "string") 
            //create port of Rvalue 
            var Rval:uint = 'Rvalue';

// step 2: cast all elements to similar data-type that support their value (without truncation      
      }else{ 
         Rval: uint = Rvalue.as_a(uint); 
         Lval: uint = Lvalue.as_a(uint);
      }; 

      if (Rval != Lval) 
             print "not equal"; 
      else 
             print "equal"; 
     }; 
};
thanks,
ddmello
Posts: 15
Online: User is Offline
3/18/2008 2:13 PM  
Hi,

I have a couple of suggestions:

In general checking in Specman is done at a high-level wherever possible, which means that "actual" data from HDL signals is unpacked into a data-structure and compared to an "expected" data-structure using deep_compare_physical().  So users rarely write low level checking routines like the one you pseudo-coded.  I would encourage you to consider that first.

That said, if high-level checking is not an option and you want to create a generic method, you could make Lvalue & Rvalue of type struct, and give that struct subtypes that represent the different types that you need to handle.  The method can then test to see what subtype is passed in and handle it accordingly.  And the code that calls CheckNet() will create the appropriate struct-instances based on the data it needs to process and pass them to CheckNet().

If what I have written above does not help you get started I recommend that you discuss this with your Cadence Applications Engineer who supports Specman for your site.

Hope this helps,
Dean 

zcabeli11
Posts: 27
Online: User is Offline
3/20/2008 10:14 AM  
Hi ddmello and thanks for the help...
i'm trying to figure out the second idea, but i still cannot understand how to define generic struct that can store data_type field of pre-defined type and value that can be of any kind ...

struct data{
data_type: Dtype;
data_val: value;
};
Posting to forums is available to community members only.
Login or Register

Forums > Functional Verification > e > generic compare function :


ActiveForums 3.6
     
Copyright 2006 Cadence Design Systems, Inc.