OpenCores
URL https://opencores.org/ocsvn/oms8051mini/oms8051mini/trunk

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [example/] [systemverilog/] [assertion/] [test4/] [test.sv] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 dinesha
//+++++++++++++++++++++++++++++++++++++++++++++++++
2
//   DUT With assertions
3
//+++++++++++++++++++++++++++++++++++++++++++++++++
4
module goto_assertion();
5
 
6
logic clk = 0;
7
always #3 clk ++;
8
 
9
logic req,busy,gnt;
10
//=================================================
11
// Sequence Layer
12
//=================================================
13
sequence boring_way_seq;
14
  req ##1 ((!busy ##1 busy) [*3]) ##1 gnt;
15
endsequence
16
 
17
sequence cool_way_seq;
18
  req ##1 (busy [->3]) ##1 gnt;
19
endsequence
20
 
21
//=================================================
22
// Property Specification Layer
23
//=================================================
24
property boring_way_prop;
25
  @ (posedge clk)
26
      req |-> boring_way_seq;
27
endproperty
28
 
29
property cool_way_prop;
30
  @ (posedge clk)
31
      req |-> cool_way_seq;
32
endproperty
33
//=================================================
34
// Assertion Directive Layer
35
//=================================================
36
boring_way_assert : assert property (boring_way_prop);
37
cool_way_assert   : assert property (cool_way_prop);
38
 
39
//=================================================
40
// Generate input vectors
41
//=================================================
42
initial begin
43
  // Pass sequence
44
  gen_seq(3,0);
45
  repeat (20) @ (posedge clk);
46
  // Fail sequence (gnt is not asserted properly)
47
  gen_seq(3,1);
48
  // Terminate the sim
49
  #30 $finish;
50
end
51
//=================================================
52
/// Task to generate input sequence
53
//=================================================
54
task  gen_seq (int busy_delay,int gnt_delay);
55
  req <= 0; busy <= 0;gnt <= 0;
56
  @ (posedge clk);
57
  req <= 1;
58
  @ (posedge clk);
59
  req  <= 0;
60
  repeat (busy_delay) begin
61
   @ (posedge clk);
62
    busy <= 1;
63
   @ (posedge clk);
64
    busy <= 0;
65
  end
66
  repeat (gnt_delay) @ (posedge clk);
67
  gnt <= 1;
68
  @ (posedge clk);
69
  gnt <= 0;
70
endtask
71
 
72
`include "dump.v"
73
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.