Sampled Value Functions (Part 2) : $stable, $past, $changed, $sampled

SystemVerilog Assertions and Functional Coverage From Scratch Concurrent Assertions – Sampled Value Function
24 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
€36.86
List Price:  €138.36
You save:  €101.49
£31.39
List Price:  £117.85
You save:  £86.45
CA$54.55
List Price:  CA$204.75
You save:  CA$150.20
A$59.95
List Price:  A$225.02
You save:  A$165.07
S$53.87
List Price:  S$202.20
You save:  S$148.32
HK$311.84
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
NZ$65.26
List Price:  NZ$244.98
You save:  NZ$179.71
د.إ146.73
List Price:  د.إ550.76
You save:  د.إ404.03
৳4,683.05
List Price:  ৳17,577.58
You save:  ৳12,894.53
RM187.46
List Price:  RM703.64
You save:  RM516.17
₦57,448.10
List Price:  ₦215,628.10
You save:  ₦158,180
₨11,126.27
List Price:  ₨41,761.82
You save:  ₨30,635.54
฿1,451.89
List Price:  ฿5,449.59
You save:  ฿3,997.70
₺1,285.71
List Price:  ₺4,825.84
You save:  ₺3,540.13
B$204.65
List Price:  B$768.17
You save:  B$563.51
R726.31
List Price:  R2,726.19
You save:  R1,999.87
Лв72.02
List Price:  Лв270.35
You save:  Лв198.32
₩54,584.40
List Price:  ₩204,879.40
You save:  ₩150,294.99
₪146.73
List Price:  ₪550.76
You save:  ₪404.03
₱2,318.53
List Price:  ₱8,702.49
You save:  ₱6,383.95
¥6,249.21
List Price:  ¥23,456.07
You save:  ¥17,206.86
MX$663.82
List Price:  MX$2,491.64
You save:  MX$1,827.81
QR145.72
List Price:  QR546.97
You save:  QR401.24
P538.70
List Price:  P2,021.98
You save:  P1,483.28
KSh5,273.40
List Price:  KSh19,793.40
You save:  KSh14,520
E£1,869.26
List Price:  E£7,016.16
You save:  E£5,146.90
ብር2,296.26
List Price:  ብር8,618.89
You save:  ብር6,322.62
Kz33,977.47
List Price:  Kz127,532.47
You save:  Kz93,555
CLP$35,495.17
List Price:  CLP$133,229.07
You save:  CLP$97,733.90
CN¥283.38
List Price:  CN¥1,063.67
You save:  CN¥780.28
RD$2,347.18
List Price:  RD$8,810.02
You save:  RD$6,462.84
DA5,375.60
List Price:  DA20,177.01
You save:  DA14,801.41
FJ$90.32
List Price:  FJ$339.03
You save:  FJ$248.71
Q310.31
List Price:  Q1,164.75
You save:  Q854.43
GY$8,367.37
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
DH396.65
List Price:  DH1,488.82
You save:  DH1,092.16
L705.89
List Price:  L2,649.54
You save:  L1,943.64
ден2,271.07
List Price:  ден8,524.35
You save:  ден6,253.28
MOP$321.29
List Price:  MOP$1,205.95
You save:  MOP$884.66
N$724.61
List Price:  N$2,719.80
You save:  N$1,995.18
C$1,471.36
List Price:  C$5,522.66
You save:  C$4,051.30
रु5,326.02
List Price:  रु19,990.94
You save:  रु14,664.91
S/149.73
List Price:  S/562.03
You save:  S/412.29
K155.30
List Price:  K582.92
You save:  K427.62
SAR149.83
List Price:  SAR562.38
You save:  SAR412.55
ZK1,032.27
List Price:  ZK3,874.57
You save:  ZK2,842.29
L183.39
List Price:  L688.37
You save:  L504.97
Kč911.45
List Price:  Kč3,421.07
You save:  Kč2,509.62
Ft14,269.71
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
ARS$35,525.86
List Price:  ARS$133,344.28
You save:  ARS$97,818.41
Bs276.21
List Price:  Bs1,036.75
You save:  Bs760.54
COP$153,014.05
List Price:  COP$574,329.36
You save:  COP$421,315.30
₡20,481.30
List Price:  ₡76,875.40
You save:  ₡56,394.09
L987.90
List Price:  L3,708.05
You save:  L2,720.14
₲300,117.14
List Price:  ₲1,126,472.24
You save:  ₲826,355.10
$U1,535.02
List Price:  $U5,761.64
You save:  $U4,226.61
zł157.25
List Price:  zł590.26
You save:  zł433
Subscription
$149.95
$39.95
per week
Payment Plan
$149.96
$39.95
per week
4 payments
Already have an account? Log In

Transcript

Stable, the returns to the value of the expression did not change in dollar rose, it went from zero to $1 fairly, it went from one to zero here, it did not change. So it's a very obvious thing. And again clocking event is optional, but you need it if you're using dollar stable in continuous assignment, as I just showed you in the previous slide, here's a simple example Cisco can take read and config read Param. Basically, I'm passing this actuals to these formals. And I keep showing this kind of example, just to reiterate and reinforce the point that don't write your properties quote unquote, hard coded to a certain signaling, keep them generic and then reuse them. So whenever says at the bottom edge of syslog, if config read is hard Then the config read Param should have been stable from the previous term very simple and again like dollar rose or fail you can assign or use dollar stable in in continuous assignment, and because you do that you have to explicitly provide the clocking or sampling age.

So, here we are saying that if the config sake has remained stable from the previous clock, the or the previous sampling adage that if that is true then take seek value and apply to stable value or take an error value if the config says they change from the previous clock, then take our value and apply it to the same value. Just like Rosenfeld, you can use this in a procedural block. So, you Here we have a simple example always at positive clock a stable number equal to a stable num plus stable here what I'm trying to do is I'm trying to count how many times a clock sorry the a stable or a has remained stable. So, when this is true, it will be it will be a logic high and it will be added and continue to add for as many clock as it has remained stable, stable.

Okay, let me make sure we understand that stable does not mean high stable means either it goes low previously and low now or high previously and high now. And then if and you can use this for requests grant, all kinds of different signals. So here what I'm doing is if I A has been stable than display that is which we have been stable this way that he has been stable and I do a logical end of the two and it both have been several from the previous clock They say he be stable his clock and here's the simulation log of this particular assertion you can see that B was zero and B is zero now at positive clock, so, B is stable, a is not stable a change here, a has been stable from 15 to 25. So, a has been stable but we did change so B is not stable.

Similarly another example of and and at 35, both A and B changed. So nothing was stable. But then again at 45 A remain one so a stable. Now a is stable from 45 to 55. be stable from 45 to 55. So, we will get three a dismissiveness a stable be stable and a and b is stable this law. So, a very simple example, but you can use it very effectively in your design to make sure you you gauge certain spurious transitions.

This is probably one of the most important functions sent and in this case is a sample value function dollar passed dollar pass of this expression how many clock takes in the past and then I will explain to you what expression two is a gating expression meaning if it is not true then do not use do not evaluate dollar pass very simple and then again blocking event is is the Blocking event is optional, but for example, you're using it in a in a continuous assignment, then you do need the blocking event otherwise, like in the previous cases is derived from the assertion or from the procedural block. So, this is the syntax of the dollar passed. If you do not specify number of tags then it will only look for the expression value in the previous law just one clock date so, the default is one clock.

Now, remember that dollar rolls dollar fail dollar stable return a logic true meaning one or a logic false meaning zero. But here dollar pass returns a sample the sample value of the expression one that was present number of clock ticks prior to the current clocking sample value, it actually returns the value what is the value in the previous clock or in the previous 10 clocks? So here's a simple I'm purposely showing it in the procedural block. And again, I'm reiterating reiterating that is not a Boolean pass or fail, but it returns the value. So here dollar past, always at pauses of clock, if past value of a is hex five, then display past a, and here as you can see, you want to display pass am using dollar pasty, okay? So these dollar pass day, these dollar pass a they will all inherit or infer the clock from dollars wrong because none of them have their own clock.

Similarly, for B I'm saying if it's a hex a then display that I'm also saying that C is equal to whatever the value of a because remember, we are dealing with a value now, whatever the value of a was in the prior clock day, logically and it will be twice and with whatever the value we had one big plot prior, I'm just saying one take, because I'm not specifically assigning number of tickets. So default is one. And here is a simple simulation log. At at time 25, the past failure of a was five minutes at the previous glottic. It was phi and pass B was hacked. Say as we expected, of course, I made sure that my test bench is such that will give you the right results.

And that's pretty much it in the past. So here are some simple applications. The spec says that if the current state is cache, read Then the past state cannot be cache invalid, you can never read from an invalid line as if here are from the CPU cache world, you will know this. And here's a simple assertion for that at policies of law state equal to cache read implies that same clock, the past state that with the state in the previous clock, the sample value of state in the previous clock is not cash invalid. Similarly, there's a spec that says, If five Sol is asserted, and data ready was data was ready to be sent the last clause then the current state, you cannot send the data because the pipe stall is asserted in this law. So even if the data was ready to be sent in the previous clock, the current state must be data hold.

So Is this bag and he is he assertion for it or the property for it at policies of claw. If pipe stall is high and and logical end dollar past state was data same. And again I will keep repeating this everything is sample value, everything is sample, in this case that causes of clog in the pre pond region. So, if this condition is true if this antecedent is true, then the consequence states that the state must be equal to data hold. So, it's rather intuitive when you will get the hang of it. As you write more and more assertions, again, try to write simple assertions for a complex spec, break it down into simpler sequences and then tie them all together.

This is to enforce upon That dollar past returns the value of the audio expression. But Dollar fell dollar rose dollar stable they only look at the least significant bit of the signal. And then you know, consider it pass or fail. So for example, for example, let's say you have a 32 bit bus D bus. And you say that a B EC is high, it implies that the bus should go to zero. And you may forget that all of fel only works on the least significant bit.

You may forget that. So you may say that, hey, then that bus needs to go to zero all the 32 bits need to go to zero. Well, let's say only the least significant bit went to zero. He'll get an incorrect pass. So Remember that So, how do you deal with this What if I want to make sure that the entire bus goes to zero? So, that's where dollar boss comes to rescue again you have a 32 bit bus, you have a dx, what am I going to say is dx implies that one clock tick earlier the bus was the buses value was not equal to all zeros and the current value of the bus is all zeros.

That means you did transition from whatever the value was earlier. All the entire D buzz went to zero. Now, this is the correct assertion to compare because, again all the past returns value or the entire expression, why Dollar fell dollar rose all the stable only deals with the least significant bit of code that is dollar change. Which is also intuitive. If it changed whether one to zero or zero to one, then in the similar fashion, it will work. So here's a simple example dollar rose B implies that at the next clock dollar change z.

So, he has $1 Rose be in the pre porn region and he, he was zero in the pre porn region at this long it goes to one in the one region at this clock shot in the property will pass here it goes from one to zero here it goes from zero to one and this will pass as well. This will fail because a did not change. It remained level sensitive at this clock, because when we detected dollar rose We here at the next log, we did not see a change in it. So of course it fade very intuitive. But here's a very interesting example. Let's say your spec says That the toggle signal dollar sake toggles every clock very simple spec.

In other words see that called signal follows a pattern 10101001010 which is actually one in the same. So the first inclination you will you probably will have your writing assertion this way. You'll say assert property sampling edge at pauses of cloth dog say one clock later it should be not policy. Okay so if it is one next blog it will be it should be zero. And then if, if it's zero then the next vlog it should be one. Well, why wouldn't this work?

This property simply states now remember the the phenomenon of free porn region. So this property simply says that the toggle signal be true It simply says there is no implication here. There is no overlapping non overlapping implication here is simply say that every pause is of clock, this has to be true. And if it is, and this has to be true and one clock later it has to be false, or this has to be one, one clock later, it needs to be zero. So, one clock later, let's say it is zero, but at the same clock, this property is also going to expect the toggle set to be a one. I mean, how can a signal be zero and one at the same time.

And so this property will fail or it just doesn't work, it will give some garbage results. So that's why dollar changed is useful. So here you simply say that at pauses of clock, one, you have to wait for one clock because you're comparing the values that are clock dollar changed talk toggles it. So, every clock it will simply say hey, if the previous value was zero it should be one now, if it was one it should be zero and you will be able to detect this pattern. So, this is a very simple example, but also very power powerful in explaining what dollar changed means dollar sampled. Now this is interesting dollar sample like all these slides throughout the lectures I've been telling you that the expressions the values in tire assertion, meaning assert property, property cause a sequence all the variables, all the signal names are sampled in the frequent region.

Well, there is a sample value function called on a sample that does exactly the same. So what is the difference? First, let me show that. Let's say you have a property $1 sample A equal to dollar sample equal to equal to dollar sample B. This is the same as what we have written all the time because A and B are always sample values in the premium region or positive clock. So why do we need this dollar sample if everything is already sampled, there are a few cases where you do need it.

Let me give an example. We saw disabled live in earlier slides. Disabled if whatever the condition exists here is totally asynchronous. disabled by default is asynchronous, meaning disable if shuts off or triggers as soon as reset goes from high to low or low to high. The disable if signal or expression is not sampled. So, if you do want to have a synchronous reset, for example, and not an asynchronous reset, you can say disable if Dollar sample reset as opposed to reset.

So, as you can see, there are places and this is probably the only place in a property in an assert in a sequence where a particular signal is not sampled. And you can use dollar sampled to make it simple make it synchronous. In the LRM, 2009 and 2012. They added something called pass in future sample value function, they did not exist in the 2005 LRM. And these these symbol value functions are of two types one our past and one a future. We'll see that in the next slide.

There's a couple of slides. But what is what is global? Why, why are these called Global clocking sample value functions? So, first you need to understand what's the global clock clock is actually a system or a log construct, and it is used extensively. And if you want the real detail of it, you may you will have to refer to the system or log in, but you don't need that knowledge. What you need to know is right here that's all you need to know for similar decisions.

So here's a module and you have a clock of type logic and I'm saying global clocking keywords global clocking says clock name of the global clock, which is a clock and then clocking. So, this is the name of the global clocking event. So says clock is now considered a global clocking event. It is defined to occur if there is a change in clock at clock, not positive, not negative edge anytime clock changes. And you can access this global clock syslog by using dollar global clock and this is how so let's say I'm I'm I'm making much simpler I'm not giving it a name this is an optional name and global clocking block. So, I'm simply saying global clocking at clock like here and then clocking then I can say assert property add global clock, like I just say that you can use dollar global clock system function add global clock A.

So, global clock here is at clock. So, this property basically reads as a set property at clock A. So, as far as assertions are concerned, this is pretty much all you need to know in terms of understand what is the global clock because if you don't understand global clock you will definitely not understand what is global clock. past and future sample value functions are. The past sample value functions are dollar passed. Dollar rows n underscore g clock tells you that it's global clocking function sample value function we saw dollar past dollar rows dollar felt dollar stable and dollar change these are the global clock counterparts have the same functions in their work exactly the same day only differences these functions with an underscore g clock suffix they will work only for global clocking event has been defined.

Other than that, there is no difference in the execution in their semantics. So, I will not go into the detail of each of this log because we have already covered similarly, future. So, they in the in in in dollar past dollar rose file we always looked at the previous property and obviously as the name suggests the Future sample value functions instead of dollar pass you have dollar future instead of dollar rose you have dollar rising instead of dollar value of dollar falling similarly steady and stable versus steady and changing what is changed, these are past tenses these are future tenses so to say. So, basically it says that the sample the value of the expression in the time step step that subsequently and immediately follows the timestamp in which the function is gone score which is the future quantity. Okay. I will leave it at that because that's all you need to know for for applying this future simple value functions.

But note that in the in this boss simple function, we have account counterparts Dollar pass rows fell several changed without the G Cloud suffix like we just saw and all the previous slides. But for the future simple value functions, there are no non global clock counterparts, you don't have dollar future we don't have dollar rising, and so on and so forth. So as far as the future sample value functions are concerned, they only work off of a global clock. He has a very simple example. Very, if you just read this bag you're meeting, oh, how am I going to design an assertion? Here's a PCI type of bus example.

When frame underscore signal frame underscore signal should be stable between two consecutive clock ticks. Frame can change only the pauses of clock day and no glitch in between. The best way to solve this and go right in assertion is a set property at global clock. Disable if ready, I'm using all the available features of an assert property if dollar changing clock that means if frame is going to change the next clock, then it has to be a rising g clock. And this basically meets this requirement if dollar changing clock that means, the next has to be So, if there is a glitch and it goes to falling g clock you know that it has failed. So, between two consecutive clock ticks, the changing frame means rising g clock.

So, the next clock when frame changes at that next clock it has to be Rising free. That's pretty much a for all the simple value functions. It has been a long lecture. These simple value functions are not that difficult to comprehend. But thanks a lot for attending this lecture and I will see you soon in the next 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.