Modeling Variable Delay Using Local Variables

SystemVerilog Assertions and Functional Coverage From Scratch Local Variables and Endpoint Sequence Methods
5 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.91
You save:  £86.50
List Price:  CA$204.40
You save:  CA$149.94
List Price:  A$224.81
You save:  A$164.91
List Price:  S$201.96
You save:  S$148.15
List Price:  HK$1,170.14
You save:  HK$858.38
CHF 36.33
List Price:  CHF 136.38
You save:  CHF 100.04
NOK kr426.11
List Price:  NOK kr1,599.41
You save:  NOK kr1,173.29
DKK kr274.31
List Price:  DKK kr1,029.63
You save:  DKK kr755.31
List Price:  NZ$245.75
You save:  NZ$180.27
List Price:  د.إ550.75
You save:  د.إ404.02
List Price:  ৳17,574.58
You save:  ৳12,892.32
List Price:  RM703.64
You save:  RM516.17
List Price:  ₦225,419.99
You save:  ₦165,363.11
List Price:  ₨41,766.35
You save:  ₨30,638.87
List Price:  ฿5,444.42
You save:  ฿3,993.90
List Price:  ₺4,828.42
You save:  ₺3,542.02
List Price:  B$765.44
You save:  B$561.51
List Price:  R2,717.55
You save:  R1,993.53
List Price:  Лв269.84
You save:  Лв197.94
List Price:  ₩204,230.37
You save:  ₩149,818.87
List Price:  ₪551
You save:  ₪404.20
List Price:  ₱8,729.56
You save:  ₱6,403.81
List Price:  ¥23,425.26
You save:  ¥17,184.25
List Price:  MX$2,478.82
You save:  MX$1,818.41
List Price:  QR547.31
You save:  QR401.49
List Price:  P2,028.06
You save:  P1,487.74
List Price:  KSh19,755.91
You save:  KSh14,492.50
List Price:  E£6,996.69
You save:  E£5,132.62
List Price:  ብር8,621.10
You save:  ብር6,324.25
List Price:  Kz127,232.57
You save:  Kz93,335
List Price:  CLP$133,560.46
You save:  CLP$97,977
List Price:  CN¥1,062.64
You save:  CN¥779.53
List Price:  RD$8,780.39
You save:  RD$6,441.09
List Price:  DA20,157.84
You save:  DA14,787.34
List Price:  FJ$338.80
You save:  FJ$248.53
List Price:  Q1,166.03
You save:  Q855.37
List Price:  GY$31,398.17
You save:  GY$23,033
ISK kr5,525.48
List Price:  ISK kr20,739.58
You save:  ISK kr15,214.10
List Price:  DH1,487.06
You save:  DH1,090.87
List Price:  L2,643.70
You save:  L1,939.36
List Price:  ден8,491.95
You save:  ден6,229.50
List Price:  MOP$1,205.67
You save:  MOP$884.45
List Price:  N$2,733.14
You save:  N$2,004.97
List Price:  C$5,523.68
You save:  C$4,052.05
List Price:  रु19,999.82
You save:  रु14,671.43
List Price:  S/560.97
You save:  S/411.52
List Price:  K583.01
You save:  K427.68
List Price:  SAR562.38
You save:  SAR412.55
List Price:  ZK3,875.67
You save:  ZK2,843.11
List Price:  L686.21
You save:  L503.39
List Price:  Kč3,405.61
You save:  Kč2,498.28
List Price:  Ft53,116.42
You save:  Ft38,965.03
SEK kr425.77
List Price:  SEK kr1,598.12
You save:  SEK kr1,172.35
List Price:  ARS$133,268.21
You save:  ARS$97,762.61
List Price:  Bs1,037.07
You save:  Bs760.77
List Price:  COP$574,438.85
You save:  COP$421,395.62
List Price:  ₡76,814.59
You save:  ₡56,349.48
List Price:  L3,709.33
You save:  L2,721.08
List Price:  ₲1,123,507.72
You save:  ₲824,180.38
List Price:  $U5,774.95
You save:  $U4,236.38
List Price:  zł587
You save:  zł430.61
per week
Payment Plan
per week
4 payments
Already have an account? Log In


Hello and welcome to this lecture where I will show you a how to model variable delay. As you know, and the bond bound delay delay can not be a variable, it must be constant. So there are a couple of ways you may attempt to make this delay variable, for example, and this property I'm showing a local variable. And then what I'm saying is whatever data delay that I pass, store it in the local variable Lv, and then wait from zero to that value stored in AD V and then go read data. Now, this will give you an elaboration time error combined will pass because during elaboration, the simulator needs to know the delay. And if he's variable, it does not know that delay.

So it has to be a function. So this will give you an The other way you may try to model days is by simply saying that, when read falls, wait for the read latency which I have passed into the property. And then to read data equal to expected, this also will give an error. Because read latency is a variable, and it must be a constant. This is what the semantic specify. So what if you do want variable delay?

Let's look at this example. This is an example from CPU system, where the level two cache can have different read latencies. So if the range is at the end of the queue, then the data will come with maximum latency. If the read is at the beginning of the read queue, data will arrive with minimum latency and anything in between. data will come with that in between latency Now we know that we cannot write a property where I can pass a variable latency and let it wait as long as it's supposed to wait. So, I mean, there are ways that you can handle this variable latency one is simply creating, you know, let's say there are 100, latencies hundred different properties, each with a constant delay from one to 100.

Would you do that? I don't think so. That's a that's not a clean solution at all. Or someone can say, Well, I don't care for in between latencies I will create a property with min latency and Max latency, when in mission critical applications. This will not work because in between latency also is just as important. So how would you solve this problem?

Well, local variable again comes to rescue and this is how it works. So what I'm doing is in Property read latency check, I passing it a variable latency real latency, then I'm creating a local variable called l delay, then I'm saying that every part of claw, whenever read falls, store the read latency that have passed in this property and stored it in the local variable l delay. Then at every clock, I'm going to decrement this latency and delay by doing this particular small sequence here, saying that always because it's always true, at every passage of claw decrement the local variable add delay, and keep repeating this keep recommending add delay at every claw, with the conjugative reputation operator meaning keep deleting, keep subtracting add delay forever. Until add delay is equal to zero. So for example, as every latency is three, and the next was edge of clock eight will become two, then at the next clock, it will become one, and then at the next law, it becomes zero, and this particular sequence will end.

So, this is the way you can easily create a small property where you can check for read data equal to expected data based on variable latency. This is a very good use of local variables. So, do visit this slide again. And make sure you understand this because this will be a very useful application when you can indeed how variable delays in system Verilog assertions. So, that's all for this lecture. Thank you

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.