SystemVerilog / / 2019. 12. 6. 16:23

Automatic/Ref/Inout 에 대한 고찰

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
`timescale 1ns/100ps
 
`define VCS
 
module tb_de;
 
logic A,B;
task automatic mytask(inout logic arg1, ref logic arg2);
 
  //절대시간 #11
  #10  
    $display ( "%c[1;33m"27);
    $display("%0t %m //seetting 1 -> arg1 : %b arg2 : %b",$time,arg1,arg2);
    $display ( "%c[0m"27); 
  //절대시간 #21에 동작하는 행위이다
  #10  
    arg1 = 1; arg2 = 1;    
    $display ( "%c[1;33m"27);
    $display("%0t %m //seetting 4 ->  arg1 : %b arg2 : %b",$time,arg1,arg2);
    $display ( "%c[0m"27);    
    
  /*(initial이 #1에 초기화 되어있기 때문에 #10을 더해주면 31에 동작하는 디스플레이가 된다) + */
  #10 
    $display ( "%c[1;33m"27);
    $display("%0t %m //seetting 2 -> arg1 : %b arg2 : %b",$time,arg1,arg2);    
    $display ( "%c[0m"27);        
    
    //41
  #10       
    $display ( "%c[1;33m"27);
    $display("%0t %m //seetting 4 ->  arg1 : %b arg2 : %b",$time,arg1,arg2);
    $display ( "%c[0m"27);        
    
    arg1 = 1; arg2 = 0;    
    
    $display ( "%c[1;33m"27);
    $display("%0t %m //seetting 4 ->  arg1 : %b arg2 : %b",$time,arg1,arg2);
    $display ( "%c[0m"27);        
 
    //51
   #10 //inout의 아풋풋 타임을 결정하기위해 일부러 딜레이를 주었다
    $display ( "%c[1;33m"27);
    $display("%0t %m //seetting 4 ->  arg1 : %b arg2 : %b",$time,arg1,arg2);
    $display ( "%c[0m"27);        
  
    
    
endtask
 
initial #1 mytask(A,B);
//initial #23 mytask(B,A);
 
initial begin
 
       A = 'z; B ='z;
       $display ( "%c[1;31m"27);
       $display("%0t %m // A : %b, B : %b",$time,A ,B);       
       $display ( "%c[0m"27);
       
       //#5에 세팅된 A,B는 0,0
       #5 A = 0; B = 0;
       
       $display ( "%c[1;31m"27);
       //#20에 A,B는 0,0 로 디스플레잉 된다.
       #15 $display("%0t %m // A : %b, B : %b",$time,A ,B);       
       $display ( "%c[0m"27);
       
       //#21에 A,B가 무엇으로 디스플레잉 될지는 mytask의 인자로 확인할 수 있다.
       $display ( "%c[1;31m"27);
       #1 $display("%0t %m // A : %b, B : %b",$time,A ,B);
       $display ( "%c[0m"27);
       
       //31
       #10
       $display("%0t %m // A : %b, B : %b",$time,A ,B);
       
       //41 <= 이떄는 task가 다 끝나지 않았기에 inout의 값이 업데이트 되지 않는다.
       #11
       $display("%0t %m // A : %b, B : %b",$time,A ,B);
       
       //52
       #11
       $display("%0t %m // A : %b, B : %b",$time,A ,B);
       
end
 
 
initial begin
`ifdef NC
    $shm_open("./tb_de.shm");
    $shm_probe(tb_de, "ACTM");
`elsif VCS
    $dumpfile("./tb_de.vcd");
    $dumpvars;
`elsif VERDI
    $fsdbAutoSwitchDumpfile(1024"./tb_de.fsdb"20);
    $fsdbDumpvars(0, tb_de, "+mda");
`endif
end
 
 
 
endmodule
 
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

'SystemVerilog' 카테고리의 다른 글

Gemmini - DNN hardware performance evaluation review  (0) 2022.11.11
  • 네이버 블로그 공유
  • 네이버 밴드 공유
  • 페이스북 공유
  • 카카오스토리 공유