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?
First of all, I see from you using scientific notation from your numbers that you are using
real
fields. You should probably switch to usinguint
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 forif
. To generate a field conditionally on the other you need to use the=>
(implication) operator:You need one such implication for each possible value of
main_clk
.