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

16 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:  €137.98
You save:  €101.22
List Price:  £117.55
You save:  £86.23
List Price:  CA$204.73
You save:  CA$150.19
List Price:  A$225.67
You save:  A$165.54
List Price:  S$202.27
You save:  S$148.38
List Price:  HK$1,170.71
You save:  HK$858.81
CHF 36.49
List Price:  CHF 136.98
You save:  CHF 100.48
NOK kr420.44
List Price:  NOK kr1,578.10
You save:  NOK kr1,157.66
DKK kr274.31
List Price:  DKK kr1,029.63
You save:  DKK kr755.31
List Price:  NZ$244.19
You save:  NZ$179.13
List Price:  د.إ550.76
You save:  د.إ404.02
List Price:  ৳17,575.64
You save:  ৳12,893.10
List Price:  RM704.46
You save:  RM516.78
List Price:  ₦220,945.32
You save:  ₦162,080.60
List Price:  ₨41,684.82
You save:  ₨30,579.06
List Price:  ฿5,492.24
You save:  ฿4,028.98
List Price:  ₺4,825.84
You save:  ₺3,540.13
List Price:  B$775.42
You save:  B$568.83
List Price:  R2,754.89
You save:  R2,020.93
List Price:  Лв270.34
You save:  Лв198.31
List Price:  ₩204,052.76
You save:  ₩149,688.58
List Price:  ₪552.05
You save:  ₪404.97
List Price:  ₱8,719.66
You save:  ₱6,396.55
List Price:  ¥23,526.50
You save:  ¥17,258.52
List Price:  MX$2,502.30
You save:  MX$1,835.63
List Price:  QR546.39
You save:  QR400.82
List Price:  P2,035.86
You save:  P1,493.46
List Price:  KSh19,943.35
You save:  KSh14,630
List Price:  E£7,069.34
You save:  E£5,185.91
List Price:  ብር8,609.67
You save:  ብር6,315.86
List Price:  Kz127,368.42
You save:  Kz93,434.66
List Price:  CLP$135,090.09
You save:  CLP$99,099.09
List Price:  CN¥1,086.25
You save:  CN¥796.85
List Price:  RD$8,824.08
You save:  RD$6,473.15
List Price:  DA20,184.20
You save:  DA14,806.68
List Price:  FJ$334.11
You save:  FJ$245.10
List Price:  Q1,163.96
You save:  Q853.85
List Price:  GY$31,349.08
You save:  GY$22,996.99
ISK kr5,511.10
List Price:  ISK kr20,685.60
You save:  ISK kr15,174.50
List Price:  DH1,494.60
You save:  DH1,096.41
List Price:  L2,657.05
You save:  L1,949.15
List Price:  ден8,494.38
You save:  ден6,231.29
List Price:  MOP$1,205.79
You save:  MOP$884.54
List Price:  N$2,753.81
You save:  N$2,020.13
List Price:  C$5,515.05
You save:  C$4,045.72
List Price:  रु19,927.17
You save:  रु14,618.13
List Price:  S/560.16
You save:  S/410.92
List Price:  K582.32
You save:  K427.18
List Price:  SAR562.40
You save:  SAR412.56
List Price:  ZK3,999.31
You save:  ZK2,933.80
List Price:  L686.75
You save:  L503.78
List Price:  Kč3,413.76
You save:  Kč2,504.26
List Price:  Ft53,074.75
You save:  Ft38,934.46
SEK kr424.47
List Price:  SEK kr1,593.24
You save:  SEK kr1,168.76
List Price:  ARS$133,567.96
You save:  ARS$97,982.50
List Price:  Bs1,035.38
You save:  Bs759.53
List Price:  COP$578,816.40
You save:  COP$424,606.89
List Price:  ₡76,823.72
You save:  ₡56,356.18
List Price:  L3,702.96
You save:  L2,716.41
List Price:  ₲1,127,056.51
You save:  ₲826,783.70
List Price:  $U5,772.73
You save:  $U4,234.75
List Price:  zł586.80
You save:  zł430.46
per week
Payment Plan
per week
4 payments
Already have an account? Log In


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 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.