Thursday, January 08, 2009     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: Overriding constraints
Posting to forums is available to community members only.
Login or Register
Rate this topic:
   
Author Messages
weberrm
Posts: 0
Online: User is Offline
5/11/2006 5:21 AM  
Using the example below, how can I override the constraints of classes A and B on an instance by instance basis?

For instance, let's say I wanted a1's constraint of VarA0 to be VarA0 > 3 and b1's constraint of  VarB1 to be VarB1 < 5.  The point being that in general I want to use the default constraints provided by the class, but for some instances I want to override them.

Thanks!


module test();
  class A;
    rand bit Α:0] varA0;
    rand bit Α:0] varA1;

    constraint c0 { varA0 > 1; }
    constraint c1 { varA1 > 2; }
  endclass

  class B;
   rand bit Α:0] varB0;
   rand bit Α:0] varB1;

   constraint c0 { varB0 > 1; }
   constraint c1 { varB1 > 2; }
 endclass

  A a0=new;
  A a1=new;
  B b0=new;
  B b1=new;

initial begin
  if (a0.randomize()==0) begin
    $display("error!");
  end
  if (a1.randomize()==0) begin
    $display("error!");
  end
  if (b0.randomize()==0) begin
    $display("error!");
  end
  if (b1.randomize()==0) begin
    $display("error!");
  end
  $display("a0.varA0=%d",a0.varA0);
  $display("a0.varA1=%d",a0.varA1);
  $display("a1.varA0=%d",a1.varA0);
  $display("a1.varA1=%d",a1.varA1);
  $display("b0.varB0=%d",b0.varB0);
  $display("b0.varB1=%d",b0.varB1);
  $display("b1.varB0=%d",b1.varB0);
  $display("b1.varB1=%d",b1.varB1);
end   
 
endmodule



kameade
Posts: 13
Online: User is Offline
5/11/2006 10:30 AM  
Hello!

There are quite a few different ways to change constraints for a specific instance of the class. The easiest way to do it is to use the b1.randomize() with {constraint} notation.

if (a1.randomize() with { varA0 > 3;})
$display("a1.varA0=%d a1.varA1=%d", a1.varA0, a1.varA1)
else $display("a1.randomize error");

if (b1.randomize() with {varB1 <5;})
$display("b1.varB0=%d b1.varB1=%d", b1.varB0, b1.varB1);
else $display("b1.randomize error");

The with {...} would have to be used each time you invoke randomize for that instance though. Other options are to use external constraint blocks - but those are class-specific. Or you can extend a class and only modify the constraints (overwrite a constraint or add an additional constraint). You also have the option to enable and disable constraints using the constraint_mode() methods.

I hope that helps a little....

Kathleen Meade
(meade@cadence.com)
tpylant
Posts: 87
Online: User is Offline
9/20/2006 10:07 AM  
Attached is a presentation I created for random data generation which includes slides on overriding constraints.

Tim

Attachment: generation.pdf

parag123
Posts: 2
Online: User is Offline
4/03/2007 9:39 PM  
Hello Tim, I am a new user for SV & while going thru the forum I found that u have attached a pdf, but that seems to be encrypted and I am unable to open it. Same is the case with "itp_pylant_generation.pdf" posted onto the forum. Is there any special way to open it. Could u plz help me out. Parag parag@txc.stpn.soft.net
Akiva
Moderator
Posts: 6
Online: User is Offline
4/02/2008 6:30 PM  
Hi,
I have written a brief article on soft constraints:
http://www.aceverification.com/Soft%20Constraints%20for%20SystemVerilog.pdf
Also, you can download Ace Verification's soft constraints for SV at the following link: http://www.aceverification.com/softconstraints_pkg.htm

Akiva
Akiva
Moderator
Posts: 6
Online: User is Offline
4/02/2008 6:30 PM  
Hi,
I have written a brief article on soft constraints:
http://www.aceverification.com/Soft%20Constraints%20for%20SystemVerilog.pdf
Also, you can download Ace Verification's soft constraints for SV at the following link: http://www.aceverification.com/softconstraints_pkg.htm

Akiva
Posting to forums is available to community members only.
Login or Register

Forums > Functional Verification > SystemVerilog > Overriding constraints


ActiveForums 3.6
     
Copyright 2006 Cadence Design Systems, Inc.