Local Variable Usage with 'and' and 'or' of Sequences

SystemVerilog Assertions and Functional Coverage From Scratch Local Variables and Endpoint Sequence Methods
7 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$39.95
List Price:  $149.95
You save:  $110
₹1,480
List Price:  ₹9,995
You save:  ₹8,515
€38.37
List Price:  €144.04
You save:  €105.66
£31.27
List Price:  £117.40
You save:  £86.12
CA$57.24
List Price:  CA$214.87
You save:  CA$157.62
A$63.98
List Price:  A$240.15
You save:  A$176.17
S$53.95
List Price:  S$202.50
You save:  S$148.55
HK$310.44
List Price:  HK$1,165.23
You save:  HK$854.79
CHF 35.35
List Price:  CHF 132.70
You save:  CHF 97.35
NOK kr450.20
List Price:  NOK kr1,689.81
You save:  NOK kr1,239.61
DKK kr286.56
List Price:  DKK kr1,075.59
You save:  DKK kr789.03
NZ$70.67
List Price:  NZ$265.25
You save:  NZ$194.58
د.إ146.73
List Price:  د.إ550.76
You save:  د.إ404.02
৳4,766.44
List Price:  ৳17,890.59
You save:  ৳13,124.14
RM179.25
List Price:  RM672.82
You save:  RM493.57
₦61,746.71
List Price:  ₦231,762.69
You save:  ₦170,015.98
₨11,104.31
List Price:  ₨41,679.41
You save:  ₨30,575.09
฿1,365.09
List Price:  ฿5,123.79
You save:  ฿3,758.70
₺1,406.05
List Price:  ₺5,277.53
You save:  ₺3,871.48
B$254.73
List Price:  B$956.12
You save:  B$701.39
R749.07
List Price:  R2,811.62
You save:  R2,062.54
Лв75.11
List Price:  Лв281.93
You save:  Лв206.82
₩58,217.52
List Price:  ₩218,516.08
You save:  ₩160,298.56
₪145.79
List Price:  ₪547.22
You save:  ₪401.43
₱2,343.46
List Price:  ₱8,796.06
You save:  ₱6,452.60
¥6,279.14
List Price:  ¥23,568.39
You save:  ¥17,289.24
MX$805.55
List Price:  MX$3,023.62
You save:  MX$2,218.06
QR145.06
List Price:  QR544.49
You save:  QR399.42
P553.96
List Price:  P2,079.26
You save:  P1,525.30
KSh5,155.14
List Price:  KSh19,349.54
You save:  KSh14,194.40
E£2,030.82
List Price:  E£7,622.58
You save:  E£5,591.75
ብር5,078.52
List Price:  ብር19,061.93
You save:  ብር13,983.41
Kz36,434.40
List Price:  Kz136,754.40
You save:  Kz100,320
CLP$39,522.13
List Price:  CLP$148,344.03
You save:  CLP$108,821.90
CN¥291.59
List Price:  CN¥1,094.48
You save:  CN¥802.89
RD$2,429.65
List Price:  RD$9,119.56
You save:  RD$6,689.91
DA5,397.29
List Price:  DA20,258.44
You save:  DA14,861.14
FJ$92.63
List Price:  FJ$347.68
You save:  FJ$255.05
Q307.23
List Price:  Q1,153.19
You save:  Q845.95
GY$8,344.93
List Price:  GY$31,322.21
You save:  GY$22,977.28
ISK kr5,575.02
List Price:  ISK kr20,925.52
You save:  ISK kr15,350.50
DH402.23
List Price:  DH1,509.75
You save:  DH1,107.52
L735.91
List Price:  L2,762.22
You save:  L2,026.30
ден2,360.77
List Price:  ден8,861.04
You save:  ден6,500.26
MOP$319.08
List Price:  MOP$1,197.67
You save:  MOP$878.58
N$741.65
List Price:  N$2,783.77
You save:  N$2,042.11
C$1,467.69
List Price:  C$5,508.89
You save:  C$4,041.20
रु5,432.30
List Price:  रु20,389.82
You save:  रु14,957.52
S/148.52
List Price:  S/557.48
You save:  S/408.95
K161.88
List Price:  K607.63
You save:  K445.74
SAR150.01
List Price:  SAR563.08
You save:  SAR413.06
ZK1,103.85
List Price:  ZK4,143.26
You save:  ZK3,039.40
L191.13
List Price:  L717.40
You save:  L526.27
Kč966.07
List Price:  Kč3,626.09
You save:  Kč2,660.01
Ft15,773.33
List Price:  Ft59,204.28
You save:  Ft43,430.95
SEK kr434.74
List Price:  SEK kr1,631.79
You save:  SEK kr1,197.04
ARS$41,032.15
List Price:  ARS$154,011.80
You save:  ARS$112,979.65
Bs275.61
List Price:  Bs1,034.52
You save:  Bs758.90
COP$176,291.67
List Price:  COP$661,700.54
You save:  COP$485,408.87
₡20,252.23
List Price:  ₡76,015.58
You save:  ₡55,763.35
L1,013.41
List Price:  L3,803.80
You save:  L2,790.38
₲311,072.84
List Price:  ₲1,167,593.83
You save:  ₲856,520.98
$U1,775.42
List Price:  $U6,663.96
You save:  $U4,888.53
zł163.57
List Price:  zł613.95
You save:  zł450.38
Subscription
$149.95
$39.95
per week
Payment Plan
$149.96
$39.95
per week
4 payments
Already have an account? Log In

Transcript

Hello, and welcome to this lecture in this lecture, I will describe some obscure error messages that you may get. And these are related to the end and or of sequences where you use local variable. So let's start with a simple example. I have a sequence as one, but I have declared a local variable x. And then I'm doing an order of two sequences. This is sequence number one, and this is sequence number two.

In this sequence, I'm assigning some data part of your design or test bench to the local variable x. Then I'm ordering the sequence with another sequence where I'm not assigning any data or anything to the local variable x. When you do and then I will take the local data x and assign it to some other data If you go this particular order of sequences This way you will get an error. And the error will tell you this is from mentors question same that local variable accurate x reference in expression where it does not flow. I am not sure if this error message is understandable. And the alarm say that data does not flow out of the competent sequence, again a big obstacle.

So, let me explain what's going on here. In this sequence, we are assigning data to x. And this is an order of two sequences. So, let's say this sequence and, and first and then we assign data to x. Because this is an order as soon as one of the two sequences finishes, the control flows out of here, and then you assign the local variable to which you apply data to data one So, So far, so good, there is absolutely nothing wrong with it. But what if this sequence ends first, and then because this is an all again, the control will flow out.

And now when you try to assign X to data X has not been initialized, it is still in unknown state. So you cannot apply an unknown local data to any other variable. So, this is the reason why you get an error because of the order of two sequences where x is assigned only in one of the two sequences. So, this makes sense, and that's what the error message means. So, what's the solution? The simplest solution is that before you enter the order of sequences, you assign the data.

So, that way it does not matter which of the two sequences and first X has known data and then when you assign it to some other data It is okay. So this will pass. The other solution which I am not recommending it is not a clean solution, but it works. So for the sake of completeness I am showing it here. Here, basically what you do is in both sequences you apply, you apply the data to x, so that any again doesn't matter which sequence ends First, you will still have known data on x and then x will be assigned to another data. So, that's also fine and this works.

But more than often what you really need to do is what is shown here. In this sequence, I'm assigning at the end of this sequence, I'm saying x equal to data. And then I'm saying or at the end of this sequence x equal to beta two is a different data and in real life, the reason you Assign data in such a sequence is because at the end of a given sequence, you want to assign different data. So since this is an R, again, doesn't matter, the sequence ends First, there is some known data that is assigned to x. And so that when you assign X to data, one of the biggest wine, so the order of two sequences, where either the data is the same, all the data is different. The order of sequences with this kind of assignment or local data works.

Now we are going to look at and have two sequences. So I'm taking this particular example and I'm only changing or to end, like shown here. Now when you do this, you will get an error because this is an ad. So let's see what's going on here. Since this is an end of two sequences, both sequences must add. Let's say the sequence is first and then sequence ends.

So since this sequence ended later, x will be equal to data to, or but now let's say this sequence ends first, and, and this sequence and later than x to be equal to data. So once these two sequences are over and control flows out, you're going to say data when equal to x, but which x? Is it the data that was assigned or is it the data to assign? So that's an error. And again, the error message is obscure. So when you do an end of two sequences, and you assign two different data's, that's an error.

So again, the solution here is the same as the one for all is the same sequence and I'm assigning a data, same data. And then it doesn't matter which of the two sequences and first as soon as both and control throws out. And then you assign the data or manipulate the data and then assign it to something else. So the point here is that if you do need two different data to be assigned based on two different sequences, and n simply won't work, you'll have to call this in a totally different way. But this this kind of assignment of different data with an end does not work. And to complete the story, what I'm showing here is that this is the same sequence that I showed in the very first slide whether or not we replace or with an ad, and you're applying data in just one of the two sequences.

But in this case, because this is an end, war sequences must end. So as long as you assign data to x in one of the two sequences that will be unknown data, when the control flows out of sequence. Note that when we had a Or here, then this will give an error as I explained in the very first slide. So, these are some detailed nuances that will come in handy when you deep dive deep into usage of local variables. So, that's all thank you for attending the lecture.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.