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
€38.30
List Price:  €143.76
You save:  €105.46
£31.77
List Price:  £119.28
You save:  £87.50
CA$57.36
List Price:  CA$215.29
You save:  CA$157.93
A$63.90
List Price:  A$239.88
You save:  A$175.97
S$54.15
List Price:  S$203.27
You save:  S$149.11
HK$310.60
List Price:  HK$1,165.85
You save:  HK$855.24
CHF 35.71
List Price:  CHF 134.03
You save:  CHF 98.32
NOK kr452.23
List Price:  NOK kr1,697.44
You save:  NOK kr1,245.21
DKK kr285.70
List Price:  DKK kr1,072.38
You save:  DKK kr786.67
NZ$70.63
List Price:  NZ$265.11
You save:  NZ$194.48
د.إ146.73
List Price:  د.إ550.76
You save:  د.إ404.03
৳4,754.86
List Price:  ৳17,847.12
You save:  ৳13,092.25
RM180.09
List Price:  RM675.97
You save:  RM495.88
₦61,731.10
List Price:  ₦231,704.12
You save:  ₦169,973.01
₨11,075.45
List Price:  ₨41,571.07
You save:  ₨30,495.62
฿1,366.34
List Price:  ฿5,128.49
You save:  ฿3,762.15
₺1,401.11
List Price:  ₺5,259.01
You save:  ₺3,857.89
B$243.13
List Price:  B$912.59
You save:  B$669.46
R731.81
List Price:  R2,746.81
You save:  R2,015
Лв74.86
List Price:  Лв280.99
You save:  Лв206.13
₩57,784.47
List Price:  ₩216,890.67
You save:  ₩159,106.20
₪145.36
List Price:  ₪545.63
You save:  ₪400.26
₱2,350.45
List Price:  ₱8,822.30
You save:  ₱6,471.85
¥6,249.97
List Price:  ¥23,458.92
You save:  ¥17,208.95
MX$802.24
List Price:  MX$3,011.19
You save:  MX$2,208.94
QR145.05
List Price:  QR544.45
You save:  QR399.39
P549.96
List Price:  P2,064.24
You save:  P1,514.28
KSh5,137
List Price:  KSh19,281.44
You save:  KSh14,144.43
E£2,032.78
List Price:  E£7,629.93
You save:  E£5,597.15
ብር4,960.09
List Price:  ብር18,617.44
You save:  ብር13,657.34
Kz36,674.10
List Price:  Kz137,654.10
You save:  Kz100,980
CLP$39,466.77
List Price:  CLP$148,136.25
You save:  CLP$108,669.47
CN¥291.49
List Price:  CN¥1,094.09
You save:  CN¥802.60
RD$2,422.99
List Price:  RD$9,094.58
You save:  RD$6,671.58
DA5,388.33
List Price:  DA20,224.80
You save:  DA14,836.47
FJ$92.54
List Price:  FJ$347.35
You save:  FJ$254.81
Q306.58
List Price:  Q1,150.76
You save:  Q844.17
GY$8,324.65
List Price:  GY$31,246.11
You save:  GY$22,921.45
ISK kr5,532.92
List Price:  ISK kr20,767.51
You save:  ISK kr15,234.58
DH400.46
List Price:  DH1,503.12
You save:  DH1,102.65
L733.83
List Price:  L2,754.42
You save:  L2,020.58
ден2,356.18
List Price:  ден8,843.79
You save:  ден6,487.61
MOP$318.54
List Price:  MOP$1,195.63
You save:  MOP$877.09
N$732.55
List Price:  N$2,749.60
You save:  N$2,017.04
C$1,464.21
List Price:  C$5,495.84
You save:  C$4,031.62
रु5,412.46
List Price:  रु20,315.36
You save:  रु14,902.90
S/148.16
List Price:  S/556.13
You save:  S/407.97
K161.35
List Price:  K605.63
You save:  K444.28
SAR150.06
List Price:  SAR563.25
You save:  SAR413.19
ZK1,101.18
List Price:  ZK4,133.23
You save:  ZK3,032.05
L190.62
List Price:  L715.48
You save:  L524.86
Kč962.48
List Price:  Kč3,612.64
You save:  Kč2,650.15
Ft15,857.75
List Price:  Ft59,521.15
You save:  Ft43,663.40
SEK kr440.75
List Price:  SEK kr1,654.33
You save:  SEK kr1,213.58
ARS$40,665.03
List Price:  ARS$152,633.83
You save:  ARS$111,968.80
Bs274.96
List Price:  Bs1,032.05
You save:  Bs757.09
COP$174,170.28
List Price:  COP$653,738.02
You save:  COP$479,567.74
₡20,075.51
List Price:  ₡75,352.29
You save:  ₡55,276.77
L1,010.05
List Price:  L3,791.18
You save:  L2,781.12
₲310,263.73
List Price:  ₲1,164,556.88
You save:  ₲854,293.14
$U1,774.74
List Price:  $U6,661.41
You save:  $U4,886.66
zł163.33
List Price:  zł613.07
You save:  zł449.73
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.