Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[req] constraint expression in vera

Status
Not open for further replies.

AlexWan

Full Member level 5
Joined
Dec 26, 2003
Messages
304
Helped
8
Reputation
16
Reaction score
2
Trophy points
1,298
Activity points
2,692
There are some code with OpenVera. I can't know about the meaning.
Code:
enum ModeType {STOP = 1, DOZE = 2, DBUG = 4, RESET = 8, SOFTRESET = 16};
rand reg[31:0]       mode = 0;

  constraint mode_constraint {
     mode in {STOP, DOZE, DBUG, RESET,SOFTRESET,
              STOP | DOZE, STOP | DBUG, STOP | RESET,STOP | SOFTRESET,
              DOZE | DBUG, DOZE | RESET,DOZE | SOFTRESET,
              DBUG | RESET, DBUG | SOFTRESET,
              RESET |SOFTRESET};
   }

How to understand the "STOP | DOZE", "STOP | DBUG", ...? Could any one explain those code?

Thanks.
 

aji_vlsi

Advanced Member level 2
Joined
Sep 10, 2004
Messages
646
Helped
85
Reputation
170
Reaction score
12
Trophy points
1,298
Location
Bangalore, India
Activity points
4,946
AlexWan said:
There are some code with OpenVera. I can't know about the meaning.
Code:
enum ModeType {STOP = 1, DOZE = 2, DBUG = 4, RESET = 8, SOFTRESET = 16};
rand reg[31:0]       mode = 0;

  constraint mode_constraint {
     mode in {STOP, DOZE, DBUG, RESET,SOFTRESET,
              STOP | DOZE, STOP | DBUG, STOP | RESET,STOP | SOFTRESET,
              DOZE | DBUG, DOZE | RESET,DOZE | SOFTRESET,
              DBUG | RESET, DBUG | SOFTRESET,
              RESET |SOFTRESET};
   }

How to understand the "STOP | DOZE", "STOP | DBUG", ...? Could any one explain those code?

Thanks.

Hi,
it is simple enumerated values - since "mode" is a 32-bit vector, the above constraint essentially means:

Code:
rand reg[31:0]       mode = 0;

  constraint mode_constraint {
     mode in {1, 2, 4, ..};
   }

Does that help?
Ajeetha, CVC
www.noveldv.com
 

AlexWan

Full Member level 5
Joined
Dec 26, 2003
Messages
304
Helped
8
Reputation
16
Reaction score
2
Trophy points
1,298
Activity points
2,692
aji_vlsi said:
Hi,
it is simple enumerated values - since "mode" is a 32-bit vector, the above constraint essentially means:
Code:
rand reg[31:0]       mode = 0;
  constraint mode_constraint {
     mode in {1, 2, 4, ..};
   }

For single enum element, mode is in {1,2,4,8,16}. But I want to know what's meaning of following:
"STOP | DOZE",
"STOP | DBUG",
"STOP | RESET",
"STOP | SOFTRESET",
"DOZE | DBUG",
"DOZE | RESET",
"DOZE | SOFTRESET",
"DBUG | RESET",
"DBUG | SOFTRESET",
"RESET |SOFTRESET".

Please give me some explain or information!
Thanks.
 

aji_vlsi

Advanced Member level 2
Joined
Sep 10, 2004
Messages
646
Helped
85
Reputation
170
Reaction score
12
Trophy points
1,298
Location
Bangalore, India
Activity points
4,946
AlexWan said:
For single enum element, mode is in {1,2,4,8,16}. But I want to know what's meaning of following:
"STOP | DOZE",

Please give me some explain or information!
Thanks.
AlexWan,
It is an "expression", having said that perhaps your original code should have read:

STOP || DOZE than STOP | DOZE. As per VERA LRM, || is logical OR, | is bitwise OR. In any case, the meaning is what you get after that expression evaluation. Assuming it is ||, STOP || DOZE means, keep mode in wither STOP or DOZE.

Does that help?
Ajeetha, CVC
www.noveldv.com
 

vivek

Member level 4
Joined
May 19, 2005
Messages
69
Helped
10
Reputation
20
Reaction score
1
Trophy points
1,288
Activity points
2,040
i agree upon the '||' operator part, but little bit intrigued here. As per original code:

Code:
constraint mode_constraint { 
     mode in {STOP, DOZE, DBUG, RESET,SOFTRESET, 
                   STOP | DOZE, STOP | DBUG, STOP | RESET,STOP | SOFTRESET, 
                   DOZE | DBUG, DOZE | RESET,DOZE | SOFTRESET, 
                   DBUG | RESET, DBUG | SOFTRESET, 
                   RESET |SOFTRESET};

What is the difference if i give it simply as :

Code:
constraint mode_constraint { 
     mode in {STOP, DOZE, DBUG, RESET,SOFTRESET};

What differnce will this make if i randomize?
 

AlexWan

Full Member level 5
Joined
Dec 26, 2003
Messages
304
Helped
8
Reputation
16
Reaction score
2
Trophy points
1,298
Activity points
2,692
For my opinion, "|" in this constraint is based on the logic. Maybe it is a parallel trigger.

Any one know this style??
 

nand_gates

Advanced Member level 3
Joined
Jul 19, 2004
Messages
892
Helped
175
Reputation
350
Reaction score
51
Trophy points
1,308
Activity points
6,830
The vera code is absulutely OK!
'|' is the correct choice here.

This is very common method used for register configuration!
I really wonder how so many peoples got confused!

Look at it this way!
The mode registers is a configuration register as
follows now I want to ceck various configurations.

Code:
+-----------+-------+------+------+------+
|   bit4    |  bit3 | bit2 | bit1 | bit0 |
+-----------+-------+------+------+------+
| SOFTRESET | RESET | DBUG | DOZE | STOP |
+-----------+-------+------+------+------+

1. STOP
2. DOZE
3. DBUG
4. RESET
5. SOFTRESET
6. STOP and DOZE
7. STOP and DBUG
8. STOP and RESET
9. STOP and SOFTRESET
10. DOZE and DBUG
11. DOZE and RESET
12. DOZE and SOFTRESET
13. DBUG and RESET
14. DBUG and SOFTRESET
15. RESET and SOFTRESET

Now check the code!
 

AlexWan

Full Member level 5
Joined
Dec 26, 2003
Messages
304
Helped
8
Reputation
16
Reaction score
2
Trophy points
1,298
Activity points
2,692
Hi nand_gates

How to explain the elements: RESET | SOFTRESET | DEBUG for your opinion????
 

nand_gates

Advanced Member level 3
Joined
Jul 19, 2004
Messages
892
Helped
175
Reputation
350
Reaction score
51
Trophy points
1,308
Activity points
6,830
Hi,
According to the definition of mode config register there are 32 possible
configuration values. Out of which the tester only wants to verify few combinations only!
"RESET | SOFTRESET | DEBUG" is also a valid configuration value.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top