forked from zufuliu/notepad4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Verilog.v
330 lines (309 loc) · 8.8 KB
/
Verilog.v
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
// Verilog 2005
//! keywords =======================================================
always assign automatic
cell
deassign default defparam design disable
edge else event
for force forever
genvar
highz0 highz1
if ifnone incdir include initial inout input instance
large liblist library localparam
medium
negedge noshowcancelled
output
parameter posedge pull0 pull1 pulldown pullup pulsestyle_onevent pulsestyle_ondetect
release repeat
scalared showcancelled small specparam strong0 strong1
use
vectored
wait weak0 weak1 while
//! data types =======================================================
// net_type
supply0 supply1 tri triand trireg trior tri0 tri1 uwire wire wand wor
// variables type
integer real realtime reg signed time unsigned
// gate and switch types
cmos rcmos
bufif0 bufif1 notif0 notif1
nmos pmos rnmos rpmos
and nand or nor xor xnor
buf not
tranif0 tranif1 rtranif1 rtranif0
tran rtran
//! code folding test =======================================================
; // clear declaration state
module ram_model(address, write, chip_select, data);
endmodule
instance top.a2 use work.cfg5:config; // Using hierarchical config
$scope // four-state VCD file
module name;
$end
//! code folding =======================================================
begin [:block_identifier]
end
case
endcase
casex
endcase
casez
endcase
config config_identifier
endconfig
function [automatic] [function_range_or_type] function_identifier
endfunction
fork [:block_identifier]
join
generate
endgenerate
module module_identifier
endmodule
macromodule module_identifier
endmodule
primitive udp_identifier(udp_port_list)
endprimitive
specify
endspecify
table
endtable
task [automatic] task_identifier
endtask
//! System task and function ===========================================
// Timing checks
$setup(data_event, reference_event, timing_check_limit [, [notifier]])
$hold(reference_event, data_event, timing_check_limit [, [notifier]])
$setuphold(reference_event, data_event, timing_check_limit, timing_check_limit [, [notifier] [, [stamptime_condition] [, [checktime_condition] [, [delayed_reference] [, [delayed_data]]]]]])
$recovery(reference_event, data_event, timing_check_limit [, [notifier]])
$removal(reference_event, data_event, timing_check_limit [, [notifier]])
$recrem(reference_event, data_event, timing_check_limit, timing_check_limit [, [notifier] [, [stamptime_condition] [, [checktime_condition] [, [delayed_reference] [, [delayed_data]]]]]])
$skew(reference_event, data_event, timing_check_limit [, [notifier]] )
$timeskew(reference_event, data_event, timing_check_limit [, [notifier] [, [event_based_flag] [, [remain_active_flag]]]])
$fullskew(reference_event, data_event, timing_check_limit, timing_check_limit [, [notifier] [, [event_based_flag] [, [remain_active_flag]]]])
$period(controlled_reference_event, timing_check_limit [, [notifier]])
$width(controlled_reference_event, timing_check_limit [, threshold [, notifier]])
$nochange(reference_event, data_event, start_edge_offset, end_edge_offset [, [notifier]])
// Display tasks
$display(arguments)
$displayb(arguments)
$displayh(arguments)
$displayo(arguments)
$write(arguments)
$writeb(arguments)
$writeh(arguments)
$writeo(arguments)
// Strobed monitoring
$strobe(arguments)
$strobeb(arguments)
$strobeh(arguments)
$strobeo(arguments)
// Continuous monitoring
$monitor(arguments)
$monitorb(arguments)
$monitorh(arguments)
$monitoro(arguments)
$monitoroff
$monitoron
// File I/O tasks
$fopen("file_name", type)
$fclose(fd)
// File output system tasks
$fdisplay(fd [, arguments])
$fdisplayb(fd [, arguments])
$fdisplayh(fd [, arguments])
$fdisplayo(fd [, arguments])
$fwrite(fd [, arguments])
$fwriteb(fd [, arguments])
$fwriteh(fd [, arguments])
$fwriteo(fd [, arguments])
$fstrobe(fd [, arguments])
$fstrobeb(fd [, arguments])
$fstrobeh(fd [, arguments])
$fstrobeo(fd [, arguments])
$fmonitor(fd [, arguments])
$fmonitorb(fd [, arguments])
$fmonitorh(fd [, arguments])
$fmonitoro(fd [, arguments])
// Formatting data to a string
$swrite(output_reg, arguments)
$swriteb(output_reg, arguments)
$swriteh(output_reg, arguments)
$swriteo(output_reg, arguments)
$sformat(output_reg, format_string, arguments)
// Reading data from a file
$fgetc(fd)
$ungetc(c, fd)
$fgets(str, fd)
$fscanf(fd, format, args)
$sscanf(str, format, args)
$fread(mem, fd, start, count)
$ftell(fd)
$fseek(fd, offset, operation)
$rewind(fd)
$fflush(fd)
$ferror(fd, str)
$feof(fd)
// Loading memory data from a file
$readmemb("file_name", memory_name [, start_addr [, finish_addr]])
$readmemh("file_name", memory_name [, start_addr [, finish_addr]])
$sdf_annotate("sdf_file" [, [module_instance] [, ["config_file"] [, ["log_file"] [, ["mtm_spec"] [, ["scale_factors"] [, ["scale_type"]]]]]]])
// Timescale tasks
$printtimescale(hierarchical_identifier)
$timeformat(units_number, precision_number, suffix_string, minimum_field_width)
// Simulation control tasks
$finish(n)
$stop(n)
// PLA modeling tasks
$async$and$array(memory_identifier, input_terms, output_terms)
$async$and$plane(memory_identifier, input_terms, output_terms)
$async$nand$array(memory_identifier, input_terms, output_terms)
$async$nand$plane(memory_identifier, input_terms, output_terms)
$async$nor$array(memory_identifier, input_terms, output_terms)
$async$nor$plane(memory_identifier, input_terms, output_terms)
$async$or$array(memory_identifier, input_terms, output_terms)
$async$or$plane(memory_identifier, input_terms, output_terms)
$sync$and$array(memory_identifier, input_terms, output_terms)
$sync$and$plane(memory_identifier, input_terms, output_terms)
$sync$nand$array(memory_identifier, input_terms, output_terms)
$sync$nand$plane(memory_identifier, input_terms, output_terms)
$sync$nor$array(memory_identifier, input_terms, output_terms)
$sync$nor$plane(memory_identifier, input_terms, output_terms)
$sync$or$array(memory_identifier, input_terms, output_terms)
$sync$or$plane(memory_identifier, input_terms, output_terms)
// Stochastic analysis tasks
$q_initialize(q_id, q_type, max_length, status)
$q_add(q_id, job_id, inform_id, status)
$q_remove(q_id, job_id, inform_id, status)
$q_full(q_id, status)
$q_exam(q_id, q_stat_code, q_stat_value, status)
// Simulation time functions
$time
$stime
$realtime
// Conversion functions
$itor(real_val)
$rtoi(int_val)
$realtobits(real_val)
$bitstoreal(bit_val)
$signed()
$unsigned()
// Probabilistic distribution functions
$random
$random(seed)
$dist_uniform( seed, start, end)
$dist_normal(seed, mean, standard_deviation)
$dist_exponential(seed, mean)
$dist_poisson(seed, mean)
$dist_chi_square(seed, degree_of_freedom)
$dist_t(seed, degree_of_freedom)
$dist_erlang(seed, k_stage, mean)
// Command line input
$test$plusargs(string)
$value$plusargs(user_string, variable)
// Math functions
$clog2(n)
$ln(x)
$log10(x)
$exp(x)
$sqrt(x)
$pow(x)
$floor(x)
$ceil(x)
$sin(x)
$cos(x)
$tan(x)
$asin(x)
$acos(x)
$atan(x)
$atan2(x, y)
$hypot(x, y)
$sinh(x)
$cosh(x)
$tanh(x)
$asinh(x)
$acosh(x)
$atanh(x)
// Value change dump (VCD) files
$dumpfile(filename)
$dumpvars
$dumpvars(levels [, list_of_modules_or_variables])
$dumpoff
$dumpon
$dumpall
$dumplimit(filesize)
$dumpflush
$comment comment_text
$end
$date
$end
$enddefinitions
$end
$scope
$end
$timescale
$end
$upscope
$end
$var
$end
$version
$end
// Creating extended VCD file
$dumpports(scope_list, file_pathname)
$dumpportsoff(file_pathname)
$dumpportson(file_pathname)
$dumpportsall(file_pathname)
$dumpportslimit(filesize, file_pathname)
$dumpportsflush(file_pathname)
$vcdclose
$end
// Annex
$countdrivers(net, [net_is_forced, number_of_01x_drivers, number_of_0_drivers, number_of_1_drivers, number_of_x_drivers])
$getpattern(mem_element)
$input("filename")
$key("filename")
$nokey
$list(hierarchical_name)
$log("filename")
$nolog
$reset(stop_value [, reset_value, [diagnostics_value]])
$reset_count
$reset_value
$save("file_name")
$restart("file_name")
$incsave("incremental_file_name")
$scale(hierarchical_name)
$scope(hierarchical_name)
$showscopes(n)
$showvars(list_of_variables)
$sreadmemb(mem_name, start_address, finish_address, string {, string })
$sreadmemh(mem_name, start_address, finish_address, string {, string })
//! directives =======================================================
`celldefine
`endcelldefine
`default_nettype
`define
`undef
`ifdef
`else
`elsif
`endif
`ifndef
`endif
`include
`resetall
`line
`timescale
`nounconnected_drive
`unconnected_drive
`pragma
`begin_keywords
`end_keywords
`default_decay_time
`default_trireg_strength
`delay_mode_distributed
`delay_mode_path
`delay_mode_unit
`delay_mode_zero
//! misc =======================================================
PATHPULSE$
STDIN STDOUT STDERR