Sequence as Event control(2) - 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

205


36
 
1
// Code your testbench here
2
// or browse Examples
3
4
module top;
5
  
6
  bit clk , a , b , c, f ;
7
  
8
  bit [3:0] length , len ;
9
  
10
  always #5 clk = !clk;
11
  
12
  function void Length( input bit [3:0] L );
13
    length = L;
14
  endfunction
15
  
16
  sequence seq;
17
    bit [3:0] data;
18
    @(posedge clk) a ##1 b ##1 c ##0 (1, data = len , Length( data ) );  
19
  endsequence
20
  
21
  always@( seq )
22
    $display("T:%0t Length == %0d  f=%d",$time,length, $sampled(f));
23
  
24
  always @(posedge clk) f<=!f;
25
    
26
  initial begin
27
     $dumpfile("dump.vcd"); $dumpvars;
28
     #5 ; a = 1 ;
29
    #10 ; a = 0 ; b = 1 ;
30
    #10 ; b = 0 ; c = 1 ; 
31
    #10 len = 10 ;
32
    #10 ;
33
    #2; $finish();
34
  end  
35
  
36
endmodule  
xxxxxxxxxx
1
 
1
// Code your design here
2
38 views and 0 likes     
 
We assign a non-local ( i.e module level variable ) as part of sequence_match_item.

We assign a non-local ( i.e module level variable ) as part of sequence_match_item.

1140:0