forked from ColsonZhang/VerilogA-Wave-Generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.va
107 lines (72 loc) · 2.71 KB
/
template.va
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
105
106
107
// $TEMPLATE_HEAD_NOTES
`include "constants.vams"
`include "disciplines.vams"
module $TEMPLATE_MODULE_NAME(VDD, GND, CLK, $TEMPLATE_PORT_LIST);
input VDD, GND, CLK ;
electrical VDD, GND, CLK ;
$TEMPLATE_INPUT_DECLARATION
$TEMPLATE_OUTPUT_DECLARATION
$TEMPLATE_SIGNAL_DECLARATION
$TEMPLATE_COUNT_DECLARATION
$TEMPLATE_WAVELIST_DECLARATION
integer count = 0;
integer clock = 0;
integer flag_clk ;
genvar i ;
// ___ __
// /\_ \ /\ \
// ___\//\ \ ___ ___\ \ \/'\ __ __ ___
// /'___\\ \ \ / __`\ /'___\ \ , < _______ /'_ `\ /'__`\/' _ `\
// /\ \__/ \_\ \_/\ \L\ \/\ \__/\ \ \\`\ /\______\/\ \L\ \/\ __//\ \/\ \
// \ \____\/\____\ \____/\ \____\\ \_\ \_\/______/\ \____ \ \____\ \_\ \_\
// \/____/\/____/\/___/ \/____/ \/_/\/_/ \/___L\ \/____/\/_/\/_/
// /\____/
// \_/__/
// Clock-Generator
analog begin
@(initial_step) begin
count = 0 ;
clock = 0 ;
flag_clk = 0 ;
$TEMPLATE_SIGNAL_INITIAL
$TEMPLATE_COUNT_INITIAL
end
@( cross( V(CLK,GND)- V(VDD,GND), +1 ) ) begin
clock = 1 ;
count = count + 1 ;
if(count >= 100 ) count = 0 ;
end
@( cross( clock - 1 , +1) ) begin
if(clock != 0) clock = 0 ;
flag_clk = 1 ;
end
end
// __ __ ____
// /\ \ __/\ \ /\ _`\
// \ \ \/\ \ \ \ __ __ __ __ ____ \ \ \L\_\ __ ___
// \ \ \ \ \ \ \ /'__`\ /\ \/\ \ /'__`\ /',__\ _______\ \ \L_L /'__`\/' _ `\
// \ \ \_/ \_\ \/\ \L\.\_\ \ \_/ |/\ __//\__, `\/\______\\ \ \/, \/\ __//\ \/\ \
// \ `\___x___/\ \__/.\_\\ \___/ \ \____\/\____/\/______/ \ \____/\ \____\ \_\ \_\
// '\/__//__/ \/__/\/_/ \/__/ \/____/\/___/ \/___/ \/____/\/_/\/_/
// Waves-Generator
analog begin
@( cross( flag_clk - 1 , +1) ) begin
flag_clk = 0 ;
$TEMPLATE_SIGNAL_GENERATE
$TEMPLATE_COUNT_GENERATE
end
end
// __ __
// /\ \__ /\ \__
// ___ __ __\ \ ,_\ _____ __ __\ \ ,_\
// / __`\/\ \/\ \\ \ \/ /\ '__`\/\ \/\ \\ \ \/
// /\ \L\ \ \ \_\ \\ \ \_\ \ \L\ \ \ \_\ \\ \ \_
// \ \____/\ \____/ \ \__\\ \ ,__/\ \____/ \ \__\
// \/___/ \/___/ \/__/ \ \ \/ \/___/ \/__/
// \ \_\
// \/_/
// Signal-Output
analog begin
$TEMPLATE_SIGNAL_OUTPUT
end
endmodule