Transcript for:
SystemVerilog Functional Coverage and Bins

hello and welcome in this video I just walk you through how to define bins with respect to system verilog functional coverage so in the last video we already had a discussion about the definition of Ben's definition of cover point cover group how to define them end up now here in this particular video we will try to understand what are different ways of specifying bins and we will try to take one simple example of Auto pins Okay so yesterday also we uh saw this definitions right about the bins so what is bins bins are used to keep the track or you can say record of number of times user hits specific value of cover Point expression so let's say for example if we have a variable of 2-bit a which is the logic type so as you know 2 raised to power 2 will be 4. so we can apply 0 to 3 value fit for this particular variable and for this uh variable if we want to define the cover point so the simulator will automatically Define the pins for this particular variable and if you are not explicitly defined then simulator will Define bins like bin 0 to 3 for this particular thing so this is what the auto bin okay implicit mean if you are not defining the bins explicitly simulator itself Define the bins for the variable and there is a concept called Auto bin Max so by default this Auto bin Max will be 64. we will try to see this sort of in Max in the later videos so for example if a variable size is less than 64. uh the simulator will create the bins and there will not be any grouping okay but if the variable size is greater than 64 let's say for example if we have a 7 down to zero eight bit of variable so 2 raised to Power 8 to 56 right so grouping will be there for that let's see here itself so we have a variable a which is of 8 bit so 2 raised to Power 8 6 260 256 right 0 to 255 values we can apply for this particular value and the grouping will uh happen for this particular variable and how the grouping will be there 256 the maximum size divided by the 64 which is the default Auto bin Max and the value will be 4 so the pins uh you can see for this particular variable will be like Auto 0 to 3 then 4 to 7 and so on which c will explore in the later video for to understand this out of index and we can ah explicitly Define this Auto bin Max we can overwrite a sort of index value also so this is a sample cover group let's say we have a variable 7 down to zero eight bit X and Y so how to define the cover group for that cover group CG and group you can give any you know name for the coverable I am giving CG in group CG and for this cover group we can Define the option dot Auto bin Max is equal to if you want to overwrite that we can Define any any value okay then the cover point for these two variables will be cover point for this text variable cover point for this y variable and optionally you can Define labels for them for these two cover points so if you are not defining bins here simulator itself will create the pins and those bins refer ADS Auto pins or implicit bits so as we can Define this Auto bin Max option dot Auto bin max if you are defining this outside of this cover point or in the cover group so this option dot photo bin Max is equal to user defined value will be there for entire coverable and we can Define this option dot Auto bin Max for particular you know cover point also so for this cover Point as you can see within the curly place we can Define option dot Auto bin Max for this particular variable X and for this particular variable y we will explore more about this in the later way now if we want to define the explicit means how we can Define let's say we have a variable X and Y the size of those two variables is 2-bit so 2 raised to power 2 4 bins will be there for each so we can Define the cover group and side disk cover group we can Define cover points for this particular variable a and for this sorry but a variable X and variable Y and in the curly brings we can Define the pins for this X variable how to define the scalar bin you can see these are the scalar bits and in the below you can see the vector okay so let me explain what is six scalar and Vector being here so the Syntax for that is bins b i n s and you can give any name I'm giving b0 is equal to in the you know curly press we have to give let's say 0 so this b0 will be there for covering the zero value similarly for p B1 for covering a one value B2 for covering two value and B3 for covering third if you want to define the vector bin we can define something like this bins you can give any name I am giving B and empty square brackets is equal to the values or for this particular variable so 0 1 2 3 I can give or you can give you know in the bracket in the brackets 0 down to 3 so it will create 0.23 how it will create B of 0 to cover 0 B of 1 for covering this one B of 2 for this 2 and so on we'll see that vector in Creation in the next video this is what the summary whatever things we have discussed till now so the default Auto bin Max will be 64. and if we have so if we have the values of the variables less than 64 then independent bins will be there less than or equal to Independent principle with it if the size of a variable is greater than 64 then grouping will be there the maximum size divided by 64. based on that grouping will be and we discussed this scalar bin sine Vector bins so how to define scalar wins bins is a keyword and variable is equal to you know in the curly place the value so this is a single pin to cover zero value similarly a single bin you can Define to cover 0 and 1 and you can define a single bins let's say a to cover zero one two three now in the vector bin as I just showed you that in the empty empty square bracket we have to Define so bins so you can give any name here an empty square bracket so how it will be there a of 0 a of 2 a of three and so on now here if we are giving a vector pin 2 and we are defining the range something like zero down to you know dollar symbol it will take the lowest value to the maximum highest value so for example if a variable size is 3 down to 0 so 2 raised to power 4 is equal to 16 so 0 to 15 right so minimum value is 0 and the maximum value 15 will be similarly you can Define the you know minimum range is dollar so it will take the minimum range to the maximum feel and so on now let me show you how to uh you know Define bins how to write a code for that if you are not defining bins implicitly how the simulator will able to create depends next no implicitly Auto bench let me jump to the Ed playground so as you can see on this screen I have written a very simple code module example 10 module inside this I have defining I am defining two you know variables like X which is of 4 bit and Y which is of 2B so as you can see for X 0 to 15 business will be there and for y 0 to 3 wins will be 2 raised to power 2 4 right and 2 raised to power 460 0 to 50. so for that I am defining a cover group name is CG and group inside that I am giving option dot per instance is equal to 1 in order to get the detailed analysis of the coverage and coverage input we have to give in Ed playground option dot for instance is equal to okay and it is for the entire cover group we cannot Define this option dot per instance is equal to one for the cover remember this one now I am defining a cover point for this particular variable X and the cover point for this variable Y and optionally I am giving a label X and Y and I am not defining pins here explicitly so simulator will implicitly create depends name is orthopics within initial begin block I am allocating the memory for this cover Group C G instance is C right for them and I am just repeating 50 times giving a repeat Loop for 50 times to generate the random values for this X and Y variables and just I am calling a sample method in order to sample the query and within an another initial begin block after 500 time unit I am calling Dollar Stop to suspend this simulation very simple example now if you run this code you will able to see the simulator will create 15 pins for x and 4 pins for this y value let me show you after running this [Music] so as you can see here it is creating Auto bin 0 to 15 okay and for variable X then for variable white is creating Auto pin 0 to 3. and at least it should cover one and here we are giving repeat 50. hence as you can see it is hitting more than once so this particular value 0 is hitting uh you know three times the one is hitting six times and so on that's why we are getting the hundred percent coverage for this x value similarly for this wipe variable all the values you know are covered all the values are hitting multiple times that's where we are getting covered hundred percent let's say if you just uh make it like 10. [Music] then you will see the coverage will reduce okay [Music] so if you just run this code you will see so as you can see here this bin 3 auto bin right is 3 is there which is not hitting zero times it is 18 so rest of three you know wins or bin zero one and two are hitting multiple times that's why we are getting 75 percent similarly here you can give uh you can see we are getting 50 percent coverage for this x variable so you can you know understand something like this and the weighted coverage we'll try to understand this weighted coverage in the later video what is the advantage weightage average for the coverage you try to say in the name so with this I hope you have understood if you are not defining bins explicitly how the simulator is itself able to create the pins and so those means we can refer as auto wins or implicit and also I hope you enjoyed this video so thanks for watching thank you