Edit code - EDA Playground
Warning! This exercise has been opened in another tab; autosave has been disabled. Close this tab or refresh to reactivate.

 Languages & Libraries

 Tools & Simulators

 Examples

204


45
 
1
// Code your testbench here
2
// or browse Examples
3
module top;
4
  bit clk,reset;
5
  bit sig1,sig2,sig3;
6
  int data_load=0;
7
  always #5 clk=!clk; 
8
 
9
  // If new sig1 then data_load will be stable starting from the next clock 
10
  // until sig2. At sig2 data_load is changed in value and in the next cycle sig3==1
11
  /*property p_with_sig2;
12
    int v; 
13
    @(posedge clk) disable iff(reset)
14
    ($rose(sig1), v=data_load) |-> ##1 first_match(data_load==v[*1:$] ##1 sig2) 
15
                                  ##0 data_load !=v ##1 sig3;
16
  endproperty
17
  ap_with_sig2: assert property (p_with_sig2);*/
18
 
19
  //  if data_load changes between Sig1 and Sig2 posedges,
20
  // then Sig3 must get asserted within let's say 1 to 10 clocks
21
  property p_with_no_sig2;
22
    int v; 
23
    @(posedge clk) disable iff(reset)
24
    ($rose(sig1), v=data_load) ##1 (data_load!=v && !sig2)[->1] |-> ##[1:30] sig3;
25
  endproperty
26
  ap_with_no_sig2: assert property (p_with_no_sig2);
27
 
28
  initial begin
29
    $dumpfile("dump.vcd");
30
    $dumpvars(0);
31
    #200 $finish;
32
  end
33
    
34
  initial begin
35
    fork 
36
       
37
       #10 sig1<=1;  
38
       #25 sig2<=1;
39
       #20 data_load<=10;
40
      // #26 sig3<=1; 
41
    join
42
    
43
  end
44
 
45
    endmodule
xxxxxxxxxx
1
 
1
// Code your design here
2
69 views and 0 likes     
A short description will be helpful for you to remember your playground's details
 
100:0