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
€37.97
List Price:  €142.52
You save:  €104.55
£31.62
List Price:  £118.70
You save:  £87.08
CA$55.80
List Price:  CA$209.46
You save:  CA$153.66
A$61.35
List Price:  A$230.27
You save:  A$168.92
S$53.69
List Price:  S$201.55
You save:  S$147.85
HK$310.93
List Price:  HK$1,167.06
You save:  HK$856.13
CHF 35.30
List Price:  CHF 132.51
You save:  CHF 97.21
NOK kr441.57
List Price:  NOK kr1,657.43
You save:  NOK kr1,215.85
DKK kr283.22
List Price:  DKK kr1,063.06
You save:  DKK kr779.84
NZ$68.10
List Price:  NZ$255.62
You save:  NZ$187.52
د.إ146.73
List Price:  د.إ550.76
You save:  د.إ404.03
৳4,778.10
List Price:  ৳17,934.34
You save:  ৳13,156.23
RM178.37
List Price:  RM669.52
You save:  RM491.15
₦67,139.57
List Price:  ₦252,004.47
You save:  ₦184,864.90
₨11,115.15
List Price:  ₨41,720.08
You save:  ₨30,604.92
฿1,385.02
List Price:  ฿5,198.61
You save:  ฿3,813.59
₺1,380.34
List Price:  ₺5,181.04
You save:  ₺3,800.70
B$232.12
List Price:  B$871.28
You save:  B$639.15
R724.11
List Price:  R2,717.92
You save:  R1,993.80
Лв74.25
List Price:  Лв278.72
You save:  Лв204.46
₩55,978.29
List Price:  ₩210,111.28
You save:  ₩154,132.98
₪149.19
List Price:  ₪559.99
You save:  ₪410.79
₱2,359.60
List Price:  ₱8,856.64
You save:  ₱6,497.04
¥6,168.38
List Price:  ¥23,152.66
You save:  ¥16,984.28
MX$812.76
List Price:  MX$3,050.66
You save:  MX$2,237.89
QR145.80
List Price:  QR547.27
You save:  QR401.46
P546.22
List Price:  P2,050.20
You save:  P1,503.98
KSh5,163.53
List Price:  KSh19,381.03
You save:  KSh14,217.50
E£1,983.54
List Price:  E£7,445.10
You save:  E£5,461.56
ብር4,985.04
List Price:  ብር18,711.08
You save:  ብር13,726.04
Kz36,447.47
List Price:  Kz136,803.48
You save:  Kz100,356
CLP$38,904.10
List Price:  CLP$146,024.30
You save:  CLP$107,120.20
CN¥289.30
List Price:  CN¥1,085.89
You save:  CN¥796.58
RD$2,411.55
List Price:  RD$9,051.64
You save:  RD$6,640.08
DA5,336.91
List Price:  DA20,031.79
You save:  DA14,694.87
FJ$90.69
List Price:  FJ$340.41
You save:  FJ$249.72
Q308.66
List Price:  Q1,158.55
You save:  Q849.89
GY$8,365.18
List Price:  GY$31,398.24
You save:  GY$23,033.05
ISK kr5,525.08
List Price:  ISK kr20,738.08
You save:  ISK kr15,213
DH399.43
List Price:  DH1,499.24
You save:  DH1,099.81
L727.49
List Price:  L2,730.59
You save:  L2,003.10
ден2,336.54
List Price:  ден8,770.07
You save:  ден6,433.53
MOP$320.56
List Price:  MOP$1,203.22
You save:  MOP$882.65
N$725.20
List Price:  N$2,722.02
You save:  N$1,996.82
C$1,471.33
List Price:  C$5,522.58
You save:  C$4,051.24
रु5,396.91
List Price:  रु20,256.99
You save:  रु14,860.08
S/151.73
List Price:  S/569.52
You save:  S/417.79
K160.95
List Price:  K604.15
You save:  K443.19
SAR149.98
List Price:  SAR562.94
You save:  SAR412.96
ZK1,106.53
List Price:  ZK4,153.31
You save:  ZK3,046.77
L188.95
List Price:  L709.24
You save:  L520.28
Kč962.03
List Price:  Kč3,610.94
You save:  Kč2,648.91
Ft15,613.61
List Price:  Ft58,604.79
You save:  Ft42,991.18
SEK kr440.65
List Price:  SEK kr1,653.96
You save:  SEK kr1,213.31
ARS$40,059.13
List Price:  ARS$150,359.64
You save:  ARS$110,300.50
Bs276.88
List Price:  Bs1,039.26
You save:  Bs762.37
COP$176,322.29
List Price:  COP$661,815.48
You save:  COP$485,493.18
₡20,304.64
List Price:  ₡76,212.31
You save:  ₡55,907.66
L1,010.38
List Price:  L3,792.41
You save:  L2,782.03
₲313,132.78
List Price:  ₲1,175,325.66
You save:  ₲862,192.88
$U1,709.25
List Price:  $U6,415.58
You save:  $U4,706.32
zł165.08
List Price:  zł619.65
You save:  zł454.56
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.