Taking Care of False Positive Using Local Variables

SystemVerilog Assertions and Functional Coverage From Scratch Local Variables and Endpoint Sequence Methods
8 minutes
Share the link to this page
You need to have access to the item to view this lesson.
One-time Fee
List Price:  $149.95
You save:  $110
List Price:  ₹9,995
You save:  ₹8,515
List Price:  €138.36
You save:  €101.49
List Price:  £117.85
You save:  £86.45
List Price:  CA$204.75
You save:  CA$150.20
List Price:  A$225.02
You save:  A$165.07
List Price:  S$202.20
You save:  S$148.32
List Price:  HK$1,170.49
You save:  HK$858.65
CHF 36.52
List Price:  CHF 137.07
You save:  CHF 100.55
NOK kr426.90
List Price:  NOK kr1,602.36
You save:  NOK kr1,175.45
DKK kr275.06
List Price:  DKK kr1,032.42
You save:  DKK kr757.36
List Price:  NZ$244.98
You save:  NZ$179.71
List Price:  د.إ550.76
You save:  د.إ404.03
List Price:  ৳17,577.58
You save:  ৳12,894.53
List Price:  RM703.64
You save:  RM516.17
List Price:  ₦215,628.10
You save:  ₦158,180
List Price:  ₨41,761.82
You save:  ₨30,635.54
List Price:  ฿5,449.59
You save:  ฿3,997.70
List Price:  ₺4,825.84
You save:  ₺3,540.13
List Price:  B$768.17
You save:  B$563.51
List Price:  R2,726.19
You save:  R1,999.87
List Price:  Лв270.35
You save:  Лв198.32
List Price:  ₩204,879.40
You save:  ₩150,294.99
List Price:  ₪550.76
You save:  ₪404.03
List Price:  ₱8,702.49
You save:  ₱6,383.95
List Price:  ¥23,456.07
You save:  ¥17,206.86
List Price:  MX$2,491.64
You save:  MX$1,827.81
List Price:  QR546.97
You save:  QR401.24
List Price:  P2,021.98
You save:  P1,483.28
List Price:  KSh19,793.40
You save:  KSh14,520
List Price:  E£7,016.16
You save:  E£5,146.90
List Price:  ብር8,618.89
You save:  ብር6,322.62
List Price:  Kz127,532.47
You save:  Kz93,555
List Price:  CLP$133,229.07
You save:  CLP$97,733.90
List Price:  CN¥1,063.67
You save:  CN¥780.28
List Price:  RD$8,810.02
You save:  RD$6,462.84
List Price:  DA20,177.01
You save:  DA14,801.41
List Price:  FJ$339.03
You save:  FJ$248.71
List Price:  Q1,164.75
You save:  Q854.43
List Price:  GY$31,406.43
You save:  GY$23,039.06
ISK kr5,533.07
List Price:  ISK kr20,768.07
You save:  ISK kr15,235
List Price:  DH1,488.82
You save:  DH1,092.16
List Price:  L2,649.54
You save:  L1,943.64
List Price:  ден8,524.35
You save:  ден6,253.28
List Price:  MOP$1,205.95
You save:  MOP$884.66
List Price:  N$2,719.80
You save:  N$1,995.18
List Price:  C$5,522.66
You save:  C$4,051.30
List Price:  रु19,990.94
You save:  रु14,664.91
List Price:  S/562.03
You save:  S/412.29
List Price:  K582.92
You save:  K427.62
List Price:  SAR562.38
You save:  SAR412.55
List Price:  ZK3,874.57
You save:  ZK2,842.29
List Price:  L688.37
You save:  L504.97
List Price:  Kč3,421.07
You save:  Kč2,509.62
List Price:  Ft53,560.55
You save:  Ft39,290.83
SEK kr428.45
List Price:  SEK kr1,608.17
You save:  SEK kr1,179.72
List Price:  ARS$133,344.28
You save:  ARS$97,818.41
List Price:  Bs1,036.75
You save:  Bs760.54
List Price:  COP$574,329.36
You save:  COP$421,315.30
List Price:  ₡76,875.40
You save:  ₡56,394.09
List Price:  L3,708.05
You save:  L2,720.14
List Price:  ₲1,126,472.24
You save:  ₲826,355.10
List Price:  $U5,761.64
You save:  $U4,226.61
List Price:  zł590.26
You save:  zł433
per week
Payment Plan
per week
4 payments
Already have an account? Log In


Hello and welcome to this lecture. In this lecture we'll see how you may end up getting a false positive using the clock delay range operator if you're not careful, and we'll also see how to solve that problem using local variables. So let's start with a very simple property. And this property and as you have seen before, since our look assertions is a multi threaded language, so in this property, I'm saying that when ready is true, it implies at at that time with overlapping operator, that ready act must arrive from within one clock to five clocks, very simple property. But let me show you what happens. So he has ready, ready and claw.

Now let's say that he arrives at this clock and within one to five clocks 123 and four clock, let's say ready arrives when that happens the property will pass. But let's say that ready also arrives at the very next clock as shown yet in as well as also looks for RadioShack within one to five clocks and it says one two and three, three clock later already. So, it also passes. But how do you know that this ready either came for s one or s two for example ready I came for s one but it never came for s two you will still see a pass indication because as to have no idea that the radio game for as one. So this is a false positive. And this is very dangerous.

It's not a limitation of the language. It's just a way the multi threaded concepts or semantics of the language works. So you have to be very careful when you use clock delay range operator for false positives. So let me show you a simulation log on how this false positive can come. So add at 30 at 20. Ready becomes one.

And then at the next clock, we recognize it and enter v enter the sequence already arrives. So that's the first ready now we move along and then a second ready comes at 70. And we enter the sequence and we say second ready is detected. But at 90 radio comms and vote ready is will be considered acknowledged, and the property will pass. This is a real simulation log from my test bench. And as you can clearly see that the property passes on a single radio for border radius.

So how do we solve this problem? That's where the local variables come into picture. So the way to solve this problem is for every ready, you need to create a ready num, some number associated with ready in your test bench. And also for every ready act, you need to create another number that's associated with a ready EQ. This is very similar to ID bass bus, for example in axi reads or writes can be pipelined. Before one raid is over, you can issue another read and the Only way your hardware would know, or data came for which read is when an ID is associated with each read.

So the concept is the same here. So what I'm doing here is I'm creating a sequence ready, check, and I'm declaring a local variable called local data. Then in the sequence as we have seen with local variables, local variables must be attached to an expression. Since I don't have an expression, I simply say true. One, take B one, and at that time, remember or store the readiness that you created in your test went into local data. Also, notice that with any expression, you can attach any sub routine.

So here I'm simply attaching $1 display. So as a side note, this is a very useful way that you can put dollar this way statements in your sequences or properties to help you debug as you simulate your design. So I am storing writing them into local data, then I have to wait for one to five blocks. And then I'm checking to see that radio has arrived. And if radio is true, then I also check to see that that radio num is the same as the one that was stored in local data. So, this way, we know that this radio economic is associated with this ready and when you do this, you will not get a false positive because we are checking for every readiness, the associated radiate now.

So in our in our case, when first ready, comes, let's say ready now We ready equal to one and then when ready He comes reject to see that ready act now numbers also want and then less seven ready comes again and let's set for that we do not get ready then during the property when we are waiting for one to five clogs, you will see that if readin act numb did calm and it is still one than the property should fail. So this is how you will solve the problem using local variables. And this is a very important concept you must understand and see how local variables can help you with pipeline multithreaded assertions in system our log. So here's just a simple log. First radio arrives. And here this display statement is is coming.

It's coming from the display Man that is that I just shown short here, enter sequence local ready now we call the local data. So, first ready arrives then after some time when ready arrives, the sequence checks to see that is ready act number corresponds to the force ready now any of that is true then the property passes. So now we have made sure that the ready act that arrived is indeed for ready number one and then when second radio arrives we we check to see whenever ready arrives again like here that the red Vietnam do is equal to ready now. So now we know that they're ready, arrived for the second ready and if the numbers do not match the property phase so in this As of course I have may decide that they're ready now my ready economic match and the property passes. So please revisit the slides if you're not sure how it works.

And make sure that you take care of false positives in your design. That's all for this lecture. Thank you.

Sign Up


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.