quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../images/main/bullet_star_pink.gif Sequence Arguments

A sequence can be declared with optional arguments, When a sequence is instantiated, actual arguments can be passed to the sequence. The sequence gets expanded with the actual arguments by replacing the formal arguments with the actual arguments.

   

space.gif

There are type of arguments declaration.

   

space.gif

  • No Type : Here input arguments are not typed.
  • With Type : Here input arguments are typed.
   

space.gif

One of the big advantage of using sequence with argument, is it can be reused as shown in below example.

   

space.gif

   

space.gif

  ../images/main/4blue_dots_bullets.gif Example : Sequence Arguments
   

space.gif


  1 //+++++++++++++++++++++++++++++++++++++++++++++++++
  2 //   DUT With assertions
  3 //+++++++++++++++++++++++++++++++++++++++++++++++++
  4 module propargs_assertion();
  5 logic clk = 0;
  6 logic req,gnt;
  7 logic a,b;
  8 //=================================================
  9 // Sequence Layer with args (NO TYPE)
 10 //=================================================
 11 sequence notype_seq (X, Y);
 12   (~X & Y)  ##1  (~X & ~Y);
 13 endsequence
 14 //=================================================
 15 // Sequence Layer with args (NO TYPE)
 16 //=================================================
 17 sequence withtype_seq (logic X, logic Y);
 18   (~X & Y)  ##1  (~X & ~Y);
 19 endsequence
 20 //=================================================
 21 // Property Specification Layer
 22 //=================================================
 23 property req_gnt_notype_prop(M,N);
 24   @ (posedge clk) 
 25       req |=> notype_seq(M,N);
 26 endproperty
 27 
 28 property a_b_type_prop(logic M, logic N;
 29   @ (posedge clk) 
 30       a |=> withtype_seq(M,N);
 31 endproperty
 32 //=================================================
 33 // Assertion Directive Layer
 34 //=================================================
 35 req_gnt_notype_assert : assert property (req_gnt_notype_prop(req,gnt));
 36 a_b_type_assert       : assert property (a_b_type_prop(a,b));
 37 //=================================================
 38 // Actual DUT RTL
 39 //=================================================
 40 always @ (posedge clk)
 41   gnt <= req;
 42 
 43 always @ (posedge clk)
 44   b <= a;
 45 
 46 //+++++++++++++++++++++++++++++++++++++++++++++++++
 47 //  Assertion testing code
 48 //+++++++++++++++++++++++++++++++++++++++++++++++++
 49 always  #3  clk ++;
 50 
 51 initial begin
 52   // Make the assertion pass
 53    #100  @ (posedge clk) req  <= 1;
 54   @ (posedge clk) req <= 0;
 55   // Make the assertion fail
 56    #100  @ (posedge clk) req  <= 1;
 57   repeat (2) @ (posedge clk);
 58   req <= 0;
 59 
 60   // Make the assertion pass
 61    #100  @ (posedge clk) a  <= 1;
 62   @ (posedge clk) a <= 0;
 63   // Make the assertion fail
 64    #100  @ (posedge clk) a  <= 1;
 65   repeat (2) @ (posedge clk);
 66   a <= 0;
 67    #10  $finish;
 68 end
 69 
 70 endmodule
You could download file args_assertion.sv here
   

space.gif

  ../images/main/4blue_dots_bullets.gif Simulation : Sequence Arguments
   

space.gif

   (~X & Y) ##1 (~X & ~Y);
       |
 ERROR (args_assertion.sv,46): (time 225 NS) 
 Assertion args_assertion.req_gnt_type_assert 
 has failed (2 cycles, starting 219 NS)
   (~X & Y) ##1 (~X & ~Y);
       |
 ERROR (args_assertion.sv,45): (time 225 NS)
  Assertion args_assertion.req_gnt_notype_assert 
 has failed (2 cycles, starting 219 NS)
   (~X & Y) ##1 (~X & ~Y);
       |
 ERROR (args_assertion.sv,48): (time 447 NS) 
 Assertion args_assertion.a_b_type_assert 
 has failed (2 cycles, starting 441 NS)
   (~X & Y) ##1 (~X & ~Y);
       |
 ERROR (args_assertion.sv,47): (time 447 NS) 
 Assertion args_assertion.a_b_notype_assert 
 has failed (2 cycles, starting 441 NS)
   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright © 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com