Specman e : Conditional Constraint in config sequence

746 Views Asked by At

In the config sequence I would like to create a conditional constraint. I have two clock rates and only a set of combinations of the clock rates are legal in the design.

I am having trouble coming up with the correct syntax to achieve this.The use of case or if statements give me a syntax error. This is what I have right now.

case main_clk{
    1e6:{
        keep div_clk == select{
            80: 5e9;
            20: 5.6e9;
        };
    };
   .
   .
   .
};

I also tried using when but it didn't work. Any suggestions on how I can implement this?

1

There are 1 best solutions below

0
On BEST ANSWER

First of all, I see from you using scientific notation from your numbers that you are using real fields. You should probably switch to using uint fields as they are more flexible from a generation point of view.

The case statement is procedural and cannot be used for generation. The same goes for if. To generate a field conditionally on the other you need to use the => (implication) operator:

  keep main_clk == 1e6 =>
    soft div_clk == select {
      80: 5e9;
      20: 5.6e9;
    };

You need one such implication for each possible value of main_clk.