‘expect’, ‘assume’ Blocking ‘action block’

16 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.44
List Price:  €144.28
You save:  €105.84
£31.93
List Price:  £119.86
You save:  £87.93
CA$57.45
List Price:  CA$215.64
You save:  CA$158.19
A$64.12
List Price:  A$240.67
You save:  A$176.55
S$54.27
List Price:  S$203.70
You save:  S$149.43
HK$310.47
List Price:  HK$1,165.34
You save:  HK$854.86
CHF 35.74
List Price:  CHF 134.15
You save:  CHF 98.41
NOK kr456.25
List Price:  NOK kr1,712.53
You save:  NOK kr1,256.27
DKK kr286.72
List Price:  DKK kr1,076.21
You save:  DKK kr789.48
NZ$70.92
List Price:  NZ$266.22
You save:  NZ$195.29
د.إ146.73
List Price:  د.إ550.75
You save:  د.إ404.02
৳4,792.38
List Price:  ৳17,987.92
You save:  ৳13,195.54
RM180.09
List Price:  RM675.97
You save:  RM495.88
₦62,179.77
List Price:  ₦233,388.17
You save:  ₦171,208.40
₨11,161.13
List Price:  ₨41,892.66
You save:  ₨30,731.52
฿1,376.19
List Price:  ฿5,165.47
You save:  ฿3,789.28
₺1,405.79
List Price:  ₺5,276.58
You save:  ₺3,870.78
B$246.73
List Price:  B$926.09
You save:  B$679.36
R734.27
List Price:  R2,756.05
You save:  R2,021.78
Лв75.23
List Price:  Лв282.40
You save:  Лв207.16
₩57,882.25
List Price:  ₩217,257.66
You save:  ₩159,375.41
₪145.78
List Price:  ₪547.21
You save:  ₪401.42
₱2,350.49
List Price:  ₱8,822.45
You save:  ₱6,471.96
¥6,261.91
List Price:  ¥23,503.72
You save:  ¥17,241.81
MX$810.63
List Price:  MX$3,042.66
You save:  MX$2,232.03
QR146.36
List Price:  QR549.38
You save:  QR403.02
P552.40
List Price:  P2,073.41
You save:  P1,521.01
KSh5,163.53
List Price:  KSh19,381.03
You save:  KSh14,217.50
E£2,034.16
List Price:  E£7,635.12
You save:  E£5,600.95
ብር5,099.95
List Price:  ብር19,142.37
You save:  ብር14,042.42
Kz36,674.10
List Price:  Kz137,654.10
You save:  Kz100,980
CLP$39,616.41
List Price:  CLP$148,697.91
You save:  CLP$109,081.50
CN¥291.59
List Price:  CN¥1,094.47
You save:  CN¥802.87
RD$2,439
List Price:  RD$9,154.65
You save:  RD$6,715.65
DA5,375.65
List Price:  DA20,177.19
You save:  DA14,801.54
FJ$92.73
List Price:  FJ$348.08
You save:  FJ$255.34
Q308.92
List Price:  Q1,159.54
You save:  Q850.61
GY$8,390.52
List Price:  GY$31,493.33
You save:  GY$23,102.81
ISK kr5,555.04
List Price:  ISK kr20,850.54
You save:  ISK kr15,295.50
DH402.49
List Price:  DH1,510.75
You save:  DH1,108.25
L735.86
List Price:  L2,762.03
You save:  L2,026.16
ден2,366.27
List Price:  ден8,881.68
You save:  ден6,515.40
MOP$320.99
List Price:  MOP$1,204.85
You save:  MOP$883.85
N$733.03
List Price:  N$2,751.42
You save:  N$2,018.38
C$1,476.03
List Price:  C$5,540.19
You save:  C$4,064.16
रु5,459.94
List Price:  रु20,493.58
You save:  रु15,033.64
S/149.71
List Price:  S/561.93
You save:  S/412.22
K162.56
List Price:  K610.15
You save:  K447.59
SAR150.11
List Price:  SAR563.45
You save:  SAR413.33
ZK1,109.90
List Price:  ZK4,165.96
You save:  ZK3,056.06
L191.30
List Price:  L718.05
You save:  L526.74
Kč966.19
List Price:  Kč3,626.54
You save:  Kč2,660.35
Ft15,901.88
List Price:  Ft59,686.78
You save:  Ft43,784.90
SEK kr440.95
List Price:  SEK kr1,655.10
You save:  SEK kr1,214.15
ARS$40,829.29
List Price:  ARS$153,250.37
You save:  ARS$112,421.08
Bs277.12
List Price:  Bs1,040.18
You save:  Bs763.05
COP$174,918.24
List Price:  COP$656,545.43
You save:  COP$481,627.19
₡20,168.90
List Price:  ₡75,702.82
You save:  ₡55,533.91
L1,018.04
List Price:  L3,821.16
You save:  L2,803.12
₲313,289.69
List Price:  ₲1,175,914.62
You save:  ₲862,624.93
$U1,782.11
List Price:  $U6,689.05
You save:  $U4,906.94
zł163.79
List Price:  zł614.79
You save:  zł451
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 lecture number 19. So far we have seen assert and cover for the assertion statements. In this lecture we'll cover expect and assume. And then we'll also look at how a blocking action block affects your goal. The expects statement is a procedural blocking statement. If you recall when we say immediate assert, which is non temporal, so it's immediately executed.

If you say assert property to fire a concurrent assertion from a procedural blog, then it fires itself and the code moves to the next statement without waiting for the asset property to complete because assert property will execute in balance. To the procedural code as opposed to assert and cover and immediate assert. And also the defer immediate assert. Expect statement is a blocking statement. So, it has the same syntax as that for a certain property. And let's look at this example to make sure we understand what a blocking statement means.

So I have a simple initial block, and I'm displaying before calling the expect that I am indeed before expect expect at policies of clock c implies starting that clock c followed to clock letter D and to crops letter E. So there is a temporal domain here you're going to consume at his four clocks in this particular property. And then of course, we have exit blocks if it passes or if it fails, then what I did was after expect I put another display saying goodbye after expect this is to show whether they expect is blocking or non blocking. Expect is blocking as I just say. So, in the log file if you see Hello before expect, then we wait for C, D and E according to the requirements in the property and they all arrive exactly as required. So, they expect will pass and then we get goodbye after expect.

So, you can see that the procedural code after expect was blocked until expect was done. So, here's my question again what would happen if you change expect within assert. So, instead of expecting to set a certain property and the And then the property is this property, then the execution will started display Hello before expect, let's say hello before assert assert will be fired and it will start executing in parallel to the procedural code. And the very next statement that will be executed would be this other display goodbye our ex after expect. So in short if you looked at a log file, and if you had an assert here instead of expect you'll see Hello before expect and goodbye after expect both at time zero. Goodbye after an extract will not wait for a search to complete.

So that's pretty much it as far as the expert statement is concerned. It makes sense to have such a blocking segment because there are many times we simply want a particular property to pass or fail before we do anything else. If it runs in parallel, then you have to continually check to see if the parallel lowly running properties passing or failing. So that's the reason for an expect statement. Some rules on the semantic. Here's the property, dp.

And what I'm doing in the initial block is I am excited expecting a ball at pauses of clock, ABC to hold and this is ABC here. Now this is okay because one thing that expect requires is to have an explicit clock edge that is associated with the expect state. Here we do have one so that's okay. This is okay too. Even though you don't really see our explicit clock is right here. Because dp property or has a positive clock, so that's okay too.

This is not okay. Because expect ABC x spec does not have any explicit clock edge associated with it. And neither does ABC sequence ABC sequel doesn't have a clock edge either the clock gauge is specified before expect is called that's no good. It has to be with expect so that's why this gives an error. The similar to this again we have expect ABC in this code always a positive clock begin expect ABC. So normally you would assume based on our previous asserting our semantics, that if there is no clock specified here, it will inherit the clock from the preceding always block not true.

With expect you will get an error. Again the point being with expect you need to explicitly provide a clock for it Eyes your posture compliance. So, these are just some basic rules on how to use expect and and we covered the semantics in the previous slide. Okay, let's look at assume, assume basically allows properties to be considered as assumptions. Why do we need as you There are two main reasons for assume one is static formal, and some call it formal or constrained random simulation. Just quickly, semi formal is a huge field in itself and is beyond the scope of this course.

But let me just give a brief overview. Static formal is a tool and it's a methodology and technique where you take a certain corner of logic, let's say it has 10 inputs, and then outputs and you tell the static formal algorithm to exercise all possible combinations of those 10 inputs, both in combinatorial domain as well as temporal domain. And let's say the, the, the block of logic is maybe 10,000 Gates is not so big, but it's not so small either. What happens during the so called former analysis is that there is something called logic cone explosion problem. You can imagine that when you want to try all possible combinations, combinatorial combinations are to raise to 10. And that's manageable, but it's a temporal many at this clock.

If input a is one, then the next log input B could be zero or one so on and so forth. And this whole evaluation just explodes. And many times the tool just will either give up or it will, it will just take so long that you will give up So, in order to avoid this logic static cone explosion, assume is assumed statement was added to the LRM. So, what it will do is, you will say assume a certain relationship, either a temporal relationship or a combinatorial relationship. And now what formal analysis tools will do is a set of trying all possible combinations of those 10 inputs I was just talking about, it will restrict or assume certain values and certain temporal conditions on certain inputs. So, as you can imagine, it doesn't have to try now all combinations, all possible permutations, it will only try those outside of the assume scope.

So, the former tool doesn't really Verify to make sure that what you have assumed is correct, whether that condition will indeed be met, it simply assumes what you have asked you to assume and move forward. But in simulation, let's say instead of assert cover, expect us to assume then that property must hold and just like in assert, if the property fails, then you will get a failure. So, in simulation, the assumed property is checked for formal it is not checked, it is checked only for the underlying assumption. So, in this simple example, we can say there is a property whenever grant is asserted Hi, the next clock request should be taken away. Now, this simple temporal condition will help the formal to tremendously in reducing its permutations. And this is also a simple example it says that IV Rank is asserted, it implies that it will remain a Saturday, consecutively, this is the consecutive reputation operator, Iraqis assert a rank will remain asserted until arrives.

So, if you have such a well defined assumption, then again, formal tools will be much more efficient. Now, quickly the same assumptions are very useful for constrained random dynamic simulation errors. constrained random basically means that you're going to constrain certain corner of logic and target it to a certain for example, you have 32 by database and you only want to exercise odd bytes, so, you can constrain the 32 by data bus to odd bytes. And you can assume that even bytes will never go out on the bus to show something like that, and this particular two examples, or temporal domain assumptions are also very helpful for constrained random to allow you to narrow down to a certain kind of logic, so, that you can be very effective in finding bugs in that kind of logic. So, as M is useful for setting formal as well as constrained random.

This is a topic which is not quite related to expect or assume, but it's very important all this time all these lectures that I have gone through in the so called action block. As you recall, when you assert a property, there is a section block here, held there's a fail action block and as I've said before these action blocks up, basically very low tasks, you can do anything you like in that very low task. So far, what I've done is I've simply shown you tasks, mostly displays that does not, quote unquote, consume time. It simply goes and says, okay, property, pass or property failed, and he's done with it. But what if you are actually assuming time in the cost, like a very low cost, we can do anything you like. So that's the idea behind what happens if your task is blocking.

Here's a property reg implies two clocks later grant, and we assert the property. If the property fails, we say call failed ask. Now note in the faders. What I'm doing is I'm waiting for one clock, two clocks, three clocks and forks. I'm actually waiting for some time, some time is advancing here. Before I'm done with fate ask.

Now let's see what happens for in the log. So, at time 30 request those high to close rate a grant should go high, but it failed. It does not. So, the property phase, when property fails, it calls failed ask. Okay, now, keeping aside everything else we are in failed tasks and is going to start waiting for four drops. So it's going to wait for one clock.

Okay, from fate as zero is the first statement, then we are going to wait for 1234 clocks. So we're going to wait for one clock, two clocks, three clocks and four clocks. And then we are done with this property. Now see what happened here. When we were Waiting for 1234 clogs, guess what request came again. This request should fire this consequent.

Whenever a request is high we need to know for the consequent. But when we were waiting when the fate is when the actual blog was consuming time requests came again as as you can see here at time 110. We had already waited for one clog we are going to wait for three more clogs, but request came again. Well guess what? The the assertion is simply going to ignore the request because it has not yet exited the failed task. And so, this is something you need to be very careful.

Many people miss this point. They think that the actual blog is non blocking in the sense it is fired, it will continue its job and the property will Continue, it's so environment, not true. And you need to be very careful how you design your action blog if you're going to consume time in it. And so here for example, when request came again, two clocks later, Grant should have come and property would have passed. But grant does not come and property should have fake, but it doesn't show failure, because we are still consuming time in the first invocation of faders. So the second phase has doesn't even come into picture as you can see, nothing happens.

So you may you will miss certain triggers of your property, if you're consuming time, and the trigger happens at that time. So this is a short lecture, just one To expose you to some statements, and also the important part of action block being blocking. Thank you for attending the lecture, and I'll see you 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.