Skip to main content

veryl_analyzer/
sv_system_function.rs

1use crate::namespace::Namespace;
2use crate::symbol::{
3    ClockDomain, Direction, DocComment, Port, PortProperty, Symbol, SymbolKind,
4    SystemFuncitonProperty, Type, TypeKind,
5};
6use crate::symbol_table::SymbolTable;
7use veryl_parser::token_range::TokenRange;
8use veryl_parser::veryl_token::{Token, TokenSource, VerylToken};
9
10pub struct SvSystemFunction {
11    pub name: String,
12    pub ports: Vec<(String, Direction)>,
13}
14
15impl SvSystemFunction {
16    pub fn new(name: &str, ports: &[(&str, Direction)]) -> Self {
17        Self {
18            name: name.to_string(),
19            ports: ports
20                .iter()
21                .map(|(name, direction)| (name.to_string(), *direction))
22                .collect(),
23        }
24    }
25}
26
27pub fn insert_symbols(symbol_table: &mut SymbolTable, namespace: &Namespace) {
28    let mut namespace = namespace.clone();
29
30    for func in sv_system_functions() {
31        let token = Token::new(&func.name, 0, 0, 0, 0, TokenSource::Builtin);
32        let mut ports = Vec::new();
33
34        namespace.push(token.text);
35        for (name, direction) in &func.ports {
36            let token = Token::new(name, 0, 0, 0, 0, TokenSource::Builtin);
37            let r#type = Type {
38                modifier: vec![],
39                kind: TypeKind::Any,
40                width: vec![],
41                array: vec![],
42                array_type: None,
43                is_const: false,
44                token: TokenRange::default(),
45            };
46            let property = PortProperty {
47                token,
48                r#type,
49                direction: *direction,
50                prefix: None,
51                suffix: None,
52                clock_domain: ClockDomain::None,
53                default_value: None,
54                is_proto: false,
55            };
56            let symbol = Symbol::new(
57                &token,
58                SymbolKind::Port(property),
59                &namespace,
60                false,
61                DocComment::default(),
62            );
63            if let Some(id) = symbol_table.insert(&token, symbol) {
64                let port = Port {
65                    token: VerylToken::new(token),
66                    symbol: id,
67                };
68                ports.push(port);
69            }
70        }
71        namespace.pop();
72
73        let property = SystemFuncitonProperty { ports };
74        let symbol = Symbol::new(
75            &token,
76            SymbolKind::SystemFunction(property),
77            &namespace,
78            false,
79            DocComment::default(),
80        );
81        let _ = symbol_table.insert(&token, symbol);
82    }
83}
84
85// Refer IEEE Std 1800-2023  Clause 20 and 21
86pub fn sv_system_functions() -> Vec<SvSystemFunction> {
87    vec![
88        // Simulation control system tasks
89        SvSystemFunction::new(
90            "$stop",
91            // it has optional args but not supported
92            &[],
93        ),
94        SvSystemFunction::new(
95            "$finish",
96            // it has optional args but not supported
97            &[],
98        ),
99        SvSystemFunction::new("$exit", &[]),
100        // Veryl native testbench system tasks
101        SvSystemFunction::new(
102            "$assert",
103            // it has optional args but not supported
104            &[],
105        ),
106        SvSystemFunction::new(
107            "$assert_continue",
108            // it has optional args but not supported
109            &[],
110        ),
111        // Simulation time system functions
112        SvSystemFunction::new("$time", &[]),
113        SvSystemFunction::new("$stime", &[]),
114        SvSystemFunction::new("$realtime", &[]),
115        // Timescale system tasks and system functions
116        SvSystemFunction::new(
117            "$timeunit",
118            // it has optional args but not supported
119            &[],
120        ),
121        SvSystemFunction::new(
122            "$timeprecision",
123            // it has optional args but not supported
124            &[],
125        ),
126        SvSystemFunction::new(
127            "$printtimescale",
128            // it has optional args but not supported
129            &[],
130        ),
131        SvSystemFunction::new(
132            "$timeformat",
133            // it has optional args but not supported
134            &[],
135        ),
136        // Conversion functions
137        SvSystemFunction::new("$rtoi", &[("real_val", Direction::Input)]),
138        SvSystemFunction::new("$itor", &[("int_val", Direction::Input)]),
139        SvSystemFunction::new("$realtobits", &[("real_val", Direction::Input)]),
140        SvSystemFunction::new("$bitstoreal", &[("bit_val", Direction::Input)]),
141        SvSystemFunction::new("$shortrealtobits", &[("shortreal_val", Direction::Input)]),
142        SvSystemFunction::new("$bitstoshortreal", &[("bit_val", Direction::Input)]),
143        SvSystemFunction::new("$signed", &[("val", Direction::Input)]),
144        SvSystemFunction::new("$unsigned", &[("val", Direction::Input)]),
145        SvSystemFunction::new(
146            "$cast",
147            &[
148                ("dest_variable", Direction::Output),
149                ("source_expression", Direction::Input),
150            ],
151        ),
152        // Data query functions
153        SvSystemFunction::new(
154            "$typename",
155            &[("expression_or_data_type", Direction::Input)],
156        ),
157        SvSystemFunction::new("$bits", &[("expression_or_data_type", Direction::Input)]),
158        SvSystemFunction::new("$isunbounded", &[("identifier", Direction::Input)]),
159        // Array query functions
160        SvSystemFunction::new(
161            "$dimensions",
162            // it has optional args but not supported
163            &[("expression_or_data_type", Direction::Input)],
164        ),
165        SvSystemFunction::new(
166            "$unpacked_dimensions",
167            // it has optional args but not supported
168            &[("expression_or_data_type", Direction::Input)],
169        ),
170        SvSystemFunction::new("$left", &[("expression_or_data_type", Direction::Input)]),
171        SvSystemFunction::new("$right", &[("expression_or_data_type", Direction::Input)]),
172        SvSystemFunction::new("$low", &[("expression_or_data_type", Direction::Input)]),
173        SvSystemFunction::new("$high", &[("expression_or_data_type", Direction::Input)]),
174        SvSystemFunction::new(
175            "$increment",
176            &[("expression_or_data_type", Direction::Input)],
177        ),
178        SvSystemFunction::new("$size", &[("expression_or_data_type", Direction::Input)]),
179        // Math functions
180        SvSystemFunction::new("$clog2", &[("n", Direction::Input)]),
181        SvSystemFunction::new("$ln", &[("x", Direction::Input)]),
182        SvSystemFunction::new("$log10", &[("x", Direction::Input)]),
183        SvSystemFunction::new("$exp", &[("x", Direction::Input)]),
184        SvSystemFunction::new("$sqrt", &[("x", Direction::Input)]),
185        SvSystemFunction::new("$pow", &[("x", Direction::Input), ("y", Direction::Input)]),
186        SvSystemFunction::new("$floor", &[("x", Direction::Input)]),
187        SvSystemFunction::new("$ceil", &[("x", Direction::Input)]),
188        SvSystemFunction::new("$sin", &[("x", Direction::Input)]),
189        SvSystemFunction::new("$cos", &[("x", Direction::Input)]),
190        SvSystemFunction::new("$tan", &[("x", Direction::Input)]),
191        SvSystemFunction::new("$asin", &[("x", Direction::Input)]),
192        SvSystemFunction::new("$acos", &[("x", Direction::Input)]),
193        SvSystemFunction::new("$atan", &[("x", Direction::Input)]),
194        SvSystemFunction::new(
195            "$atan2",
196            &[("x", Direction::Input), ("y", Direction::Input)],
197        ),
198        SvSystemFunction::new(
199            "$hypot",
200            &[("x", Direction::Input), ("y", Direction::Input)],
201        ),
202        SvSystemFunction::new("$sinh", &[("x", Direction::Input)]),
203        SvSystemFunction::new("$cosh", &[("x", Direction::Input)]),
204        SvSystemFunction::new("$tanh", &[("x", Direction::Input)]),
205        SvSystemFunction::new("$asinh", &[("x", Direction::Input)]),
206        SvSystemFunction::new("$acosh", &[("x", Direction::Input)]),
207        SvSystemFunction::new("$atanh", &[("x", Direction::Input)]),
208        // Bit vector system functions
209        SvSystemFunction::new(
210            "$countbits",
211            // it has optional args but not supported
212            &[
213                ("expression", Direction::Input),
214                ("control_bit", Direction::Input),
215            ],
216        ),
217        SvSystemFunction::new("$countones", &[("expression", Direction::Input)]),
218        SvSystemFunction::new("$onehot", &[("expression", Direction::Input)]),
219        SvSystemFunction::new("$onehot0", &[("expression", Direction::Input)]),
220        SvSystemFunction::new("$isunknown", &[("expression", Direction::Input)]),
221        // Severity system tasks
222        SvSystemFunction::new(
223            "$fatal",
224            // it has optional args but not supported
225            &[],
226        ),
227        SvSystemFunction::new(
228            "$error",
229            // it has optional args but not supported
230            &[],
231        ),
232        SvSystemFunction::new(
233            "$warning",
234            // it has optional args but not supported
235            &[],
236        ),
237        SvSystemFunction::new(
238            "$info",
239            // it has optional args but not supported
240            &[],
241        ),
242        // Assertion control system tasks
243        SvSystemFunction::new(
244            "$asserton",
245            // it has optional args but not supported
246            &[],
247        ),
248        SvSystemFunction::new(
249            "$assertoff",
250            // it has optional args but not supported
251            &[],
252        ),
253        SvSystemFunction::new(
254            "$assertkill",
255            // it has optional args but not supported
256            &[],
257        ),
258        SvSystemFunction::new(
259            "$assertpasson",
260            // it has optional args but not supported
261            &[],
262        ),
263        SvSystemFunction::new(
264            "$assertpassoff",
265            // it has optional args but not supported
266            &[],
267        ),
268        SvSystemFunction::new(
269            "$assertfailon",
270            // it has optional args but not supported
271            &[],
272        ),
273        SvSystemFunction::new(
274            "$assertfailoff",
275            // it has optional args but not supported
276            &[],
277        ),
278        SvSystemFunction::new(
279            "$assertnonvacuouson",
280            // it has optional args but not supported
281            &[],
282        ),
283        SvSystemFunction::new(
284            "$assertvacuousoff",
285            // it has optional args but not supported
286            &[],
287        ),
288        SvSystemFunction::new(
289            "$assertcontrol",
290            // it has optional args but not supported
291            &[("control_type", Direction::Input)],
292        ),
293        // Sampled value system functions
294        SvSystemFunction::new("$sampled", &[("expression", Direction::Input)]),
295        SvSystemFunction::new(
296            "$rose",
297            // it has optional args but not supported
298            &[("expression", Direction::Input)],
299        ),
300        SvSystemFunction::new(
301            "$fell",
302            // it has optional args but not supported
303            &[("expression", Direction::Input)],
304        ),
305        SvSystemFunction::new(
306            "$stable",
307            // it has optional args but not supported
308            &[("expression", Direction::Input)],
309        ),
310        SvSystemFunction::new(
311            "$changed",
312            // it has optional args but not supported
313            &[("expression", Direction::Input)],
314        ),
315        SvSystemFunction::new(
316            "$past",
317            // it has optional args but not supported
318            &[("expression", Direction::Input)],
319        ),
320        SvSystemFunction::new("$past_gclk", &[("expression", Direction::Input)]),
321        SvSystemFunction::new("$rose_gclk", &[("expression", Direction::Input)]),
322        SvSystemFunction::new("$fell_gclk", &[("expression", Direction::Input)]),
323        SvSystemFunction::new("$stable_gclk", &[("expression", Direction::Input)]),
324        SvSystemFunction::new("$changed_gclk", &[("expression", Direction::Input)]),
325        SvSystemFunction::new("$future_gclk", &[("expression", Direction::Input)]),
326        SvSystemFunction::new("$rising_gclk", &[("expression", Direction::Input)]),
327        SvSystemFunction::new("$falling_gclk", &[("expression", Direction::Input)]),
328        SvSystemFunction::new("$steady_gclk", &[("expression", Direction::Input)]),
329        SvSystemFunction::new("$changing_gclk", &[("expression", Direction::Input)]),
330        // Built-in coverage access system functions
331        SvSystemFunction::new(
332            "$coverage_control",
333            &[
334                ("control_constant,", Direction::Input),
335                ("coverage_type", Direction::Input),
336                ("scope_def", Direction::Input),
337                ("modules_or_instance,", Direction::Input),
338            ],
339        ),
340        SvSystemFunction::new(
341            "$coverage_get_max",
342            &[
343                ("coverage_type", Direction::Input),
344                ("scope_def", Direction::Input),
345                ("modules_or_instance,", Direction::Input),
346            ],
347        ),
348        SvSystemFunction::new(
349            "$coverage_get",
350            &[
351                ("coverage_type", Direction::Input),
352                ("scope_def", Direction::Input),
353                ("modules_or_instance,", Direction::Input),
354            ],
355        ),
356        SvSystemFunction::new(
357            "$coverage_merge",
358            &[
359                ("coverage_type", Direction::Input),
360                ("name", Direction::Input),
361            ],
362        ),
363        SvSystemFunction::new(
364            "$coverage_save",
365            &[
366                ("coverage_type", Direction::Input),
367                ("name", Direction::Input),
368            ],
369        ),
370        // Predefined coverage system tasks and system functions
371        SvSystemFunction::new("$set_coverage_db_name", &[("filename", Direction::Input)]),
372        SvSystemFunction::new("$load_coverage_db", &[("filename", Direction::Input)]),
373        SvSystemFunction::new("$get_coverage", &[]),
374        // Probabilistic distribution functions
375        SvSystemFunction::new(
376            "$random",
377            // it has optional args but not supported
378            &[],
379        ),
380        SvSystemFunction::new(
381            "$urandom",
382            // it has optional args but not supported
383            &[],
384        ),
385        SvSystemFunction::new(
386            "$random_range",
387            // it has optional args but not supported
388            &[("maxval", Direction::Input)],
389        ),
390        SvSystemFunction::new(
391            "$dist_uniform",
392            &[
393                ("seed", Direction::Input),
394                ("start", Direction::Input),
395                ("end", Direction::Input),
396            ],
397        ),
398        SvSystemFunction::new(
399            "$dist_normal",
400            &[
401                ("seed", Direction::Input),
402                ("mean", Direction::Input),
403                ("standard_deviation", Direction::Input),
404            ],
405        ),
406        SvSystemFunction::new(
407            "$dist_exponential",
408            &[("seed", Direction::Input), ("mean", Direction::Input)],
409        ),
410        SvSystemFunction::new(
411            "$dist_poisson",
412            &[("seed", Direction::Input), ("mean", Direction::Input)],
413        ),
414        SvSystemFunction::new(
415            "$dist_chi_square",
416            &[
417                ("seed", Direction::Input),
418                ("degree_of_freedom", Direction::Input),
419            ],
420        ),
421        SvSystemFunction::new(
422            "$dist_t",
423            &[
424                ("seed", Direction::Input),
425                ("degree_of_freedom", Direction::Input),
426            ],
427        ),
428        SvSystemFunction::new(
429            "$dist_erlang",
430            &[
431                ("seed", Direction::Input),
432                ("k_stage", Direction::Input),
433                ("mean", Direction::Input),
434            ],
435        ),
436        // Stochastic analysis tasks and functions
437        SvSystemFunction::new(
438            "$q_initialize",
439            &[
440                ("q_id", Direction::Input),
441                ("q_type", Direction::Input),
442                ("max_length", Direction::Input),
443                ("status", Direction::Output),
444            ],
445        ),
446        SvSystemFunction::new(
447            "$q_add",
448            &[
449                ("q_id", Direction::Input),
450                ("job_id", Direction::Input),
451                ("inform_id", Direction::Input),
452                ("status", Direction::Output),
453            ],
454        ),
455        SvSystemFunction::new(
456            "$q_remove",
457            &[
458                ("q_id", Direction::Input),
459                ("job_id", Direction::Input),
460                ("inform_id", Direction::Input),
461                ("status", Direction::Output),
462            ],
463        ),
464        SvSystemFunction::new(
465            "$q_full",
466            &[("q_id", Direction::Input), ("status", Direction::Output)],
467        ),
468        SvSystemFunction::new(
469            "$q_exam",
470            &[
471                ("q_id", Direction::Input),
472                ("q_stat_code", Direction::Input),
473                ("q_stat_value", Direction::Input),
474                ("status", Direction::Output),
475            ],
476        ),
477        // Programmable logic array modeling system tasks
478        SvSystemFunction::new(
479            "$async$and$array",
480            &[
481                ("memory_identifier", Direction::Input),
482                ("input_terms", Direction::Input),
483                ("output_terms", Direction::Output),
484            ],
485        ),
486        SvSystemFunction::new(
487            "$sync$and$array",
488            &[
489                ("memory_identifier", Direction::Input),
490                ("input_terms", Direction::Input),
491                ("output_terms", Direction::Output),
492            ],
493        ),
494        SvSystemFunction::new(
495            "$async$and$plane",
496            &[
497                ("memory_identifier", Direction::Input),
498                ("input_terms", Direction::Input),
499                ("output_terms", Direction::Output),
500            ],
501        ),
502        SvSystemFunction::new(
503            "$sync$and$plane",
504            &[
505                ("memory_identifier", Direction::Input),
506                ("input_terms", Direction::Input),
507                ("output_terms", Direction::Output),
508            ],
509        ),
510        SvSystemFunction::new(
511            "$async$nand$array",
512            &[
513                ("memory_identifier", Direction::Input),
514                ("input_terms", Direction::Input),
515                ("output_terms", Direction::Output),
516            ],
517        ),
518        SvSystemFunction::new(
519            "$sync$nand$array",
520            &[
521                ("memory_identifier", Direction::Input),
522                ("input_terms", Direction::Input),
523                ("output_terms", Direction::Output),
524            ],
525        ),
526        SvSystemFunction::new(
527            "$async$nand$plane",
528            &[
529                ("memory_identifier", Direction::Input),
530                ("input_terms", Direction::Input),
531                ("output_terms", Direction::Output),
532            ],
533        ),
534        SvSystemFunction::new(
535            "$sync$nand$plane",
536            &[
537                ("memory_identifier", Direction::Input),
538                ("input_terms", Direction::Input),
539                ("output_terms", Direction::Output),
540            ],
541        ),
542        SvSystemFunction::new(
543            "$async$or$array",
544            &[
545                ("memory_identifier", Direction::Input),
546                ("input_terms", Direction::Input),
547                ("output_terms", Direction::Output),
548            ],
549        ),
550        SvSystemFunction::new(
551            "$sync$or$array",
552            &[
553                ("memory_identifier", Direction::Input),
554                ("input_terms", Direction::Input),
555                ("output_terms", Direction::Output),
556            ],
557        ),
558        SvSystemFunction::new(
559            "$async$or$plane",
560            &[
561                ("memory_identifier", Direction::Input),
562                ("input_terms", Direction::Input),
563                ("output_terms", Direction::Output),
564            ],
565        ),
566        SvSystemFunction::new(
567            "$sync$or$plane",
568            &[
569                ("memory_identifier", Direction::Input),
570                ("input_terms", Direction::Input),
571                ("output_terms", Direction::Output),
572            ],
573        ),
574        SvSystemFunction::new(
575            "$async$nor$array",
576            &[
577                ("memory_identifier", Direction::Input),
578                ("input_terms", Direction::Input),
579                ("output_terms", Direction::Output),
580            ],
581        ),
582        SvSystemFunction::new(
583            "$sync$nor$array",
584            &[
585                ("memory_identifier", Direction::Input),
586                ("input_terms", Direction::Input),
587                ("output_terms", Direction::Output),
588            ],
589        ),
590        SvSystemFunction::new(
591            "$async$nor$plane",
592            &[
593                ("memory_identifier", Direction::Input),
594                ("input_terms", Direction::Input),
595                ("output_terms", Direction::Output),
596            ],
597        ),
598        SvSystemFunction::new(
599            "$sync$nor$plane",
600            &[
601                ("memory_identifier", Direction::Input),
602                ("input_terms", Direction::Input),
603                ("output_terms", Direction::Output),
604            ],
605        ),
606        // Miscellaneous tasks and functions
607        SvSystemFunction::new("$system", &[("terminal_command_line", Direction::Input)]),
608        SvSystemFunction::new("$stacktrace;", &[]),
609        // Input/output system tasks and system functions
610        SvSystemFunction::new(
611            "$display",
612            // it has optional args but not supported
613            &[],
614        ),
615        SvSystemFunction::new(
616            "$displayb",
617            // it has optional args but not supported
618            &[],
619        ),
620        SvSystemFunction::new(
621            "$displayo",
622            // it has optional args but not supported
623            &[],
624        ),
625        SvSystemFunction::new(
626            "$displayh",
627            // it has optional args but not supported
628            &[],
629        ),
630        SvSystemFunction::new(
631            "$write",
632            // it has optional args but not supported
633            &[],
634        ),
635        SvSystemFunction::new(
636            "$writeb",
637            // it has optional args but not supported
638            &[],
639        ),
640        SvSystemFunction::new(
641            "$writeo",
642            // it has optional args but not supported
643            &[],
644        ),
645        SvSystemFunction::new(
646            "$writeh",
647            // it has optional args but not supported
648            &[],
649        ),
650        SvSystemFunction::new(
651            "$strobe",
652            // it has optional args but not supported
653            &[],
654        ),
655        SvSystemFunction::new(
656            "$strobeb",
657            // it has optional args but not supported
658            &[],
659        ),
660        SvSystemFunction::new(
661            "$strobeo",
662            // it has optional args but not supported
663            &[],
664        ),
665        SvSystemFunction::new(
666            "$strobeh",
667            // it has optional args but not supported
668            &[],
669        ),
670        SvSystemFunction::new(
671            "$monitor",
672            // it has optional args but not supported
673            &[],
674        ),
675        SvSystemFunction::new(
676            "$monitorb",
677            // it has optional args but not supported
678            &[],
679        ),
680        SvSystemFunction::new(
681            "$monitoro",
682            // it has optional args but not supported
683            &[],
684        ),
685        SvSystemFunction::new(
686            "$monitorh",
687            // it has optional args but not supported
688            &[],
689        ),
690        SvSystemFunction::new("$monitoron", &[]),
691        SvSystemFunction::new("$monitoroff", &[]),
692        SvSystemFunction::new(
693            "$fopen",
694            // it has optional args but not supported
695            &[("filename", Direction::Input)],
696        ),
697        SvSystemFunction::new("$fclose", &[("fd", Direction::Input)]),
698        SvSystemFunction::new(
699            "$fdisplay",
700            // it has optional args but not supported
701            &[("fd", Direction::Input)],
702        ),
703        SvSystemFunction::new(
704            "$fdisplayb",
705            // it has optional args but not supported
706            &[("fd", Direction::Input)],
707        ),
708        SvSystemFunction::new(
709            "$fdisplayo",
710            // it has optional args but not supported
711            &[("fd", Direction::Input)],
712        ),
713        SvSystemFunction::new(
714            "$fdisplayh",
715            // it has optional args but not supported
716            &[("fd", Direction::Input)],
717        ),
718        SvSystemFunction::new(
719            "$fwrite",
720            // it has optional args but not supported
721            &[("fd", Direction::Input)],
722        ),
723        SvSystemFunction::new(
724            "$fwriteb",
725            // it has optional args but not supported
726            &[("fd", Direction::Input)],
727        ),
728        SvSystemFunction::new(
729            "$fwriteo",
730            // it has optional args but not supported
731            &[("fd", Direction::Input)],
732        ),
733        SvSystemFunction::new(
734            "$fwriteh",
735            // it has optional args but not supported
736            &[("fd", Direction::Input)],
737        ),
738        SvSystemFunction::new(
739            "$fstrobe",
740            // it has optional args but not supported
741            &[("fd", Direction::Input)],
742        ),
743        SvSystemFunction::new(
744            "$fstrobeb",
745            // it has optional args but not supported
746            &[("fd", Direction::Input)],
747        ),
748        SvSystemFunction::new(
749            "$fstrobeo",
750            // it has optional args but not supported
751            &[("fd", Direction::Input)],
752        ),
753        SvSystemFunction::new(
754            "$fstrobeh",
755            // it has optional args but not supported
756            &[("fd", Direction::Input)],
757        ),
758        SvSystemFunction::new(
759            "$fmonitor",
760            // it has optional args but not supported
761            &[("fd", Direction::Input)],
762        ),
763        SvSystemFunction::new(
764            "$fmonitorb",
765            // it has optional args but not supported
766            &[("fd", Direction::Input)],
767        ),
768        SvSystemFunction::new(
769            "$fmonitoro",
770            // it has optional args but not supported
771            &[("fd", Direction::Input)],
772        ),
773        SvSystemFunction::new(
774            "$fmonitorh",
775            // it has optional args but not supported
776            &[("fd", Direction::Input)],
777        ),
778        SvSystemFunction::new(
779            "$swrite",
780            // it has optional args but not supported
781            &[("output_var", Direction::Output)],
782        ),
783        SvSystemFunction::new(
784            "$swriteb",
785            // it has optional args but not supported
786            &[("output_var", Direction::Output)],
787        ),
788        SvSystemFunction::new(
789            "$swriteo",
790            // it has optional args but not supported
791            &[("output_var", Direction::Output)],
792        ),
793        SvSystemFunction::new(
794            "$swriteh",
795            // it has optional args but not supported
796            &[("output_var", Direction::Output)],
797        ),
798        SvSystemFunction::new(
799            "$sformat",
800            // it has optional args but not supported
801            &[
802                ("output_var", Direction::Output),
803                ("format_string", Direction::Input),
804            ],
805        ),
806        SvSystemFunction::new(
807            "$sformatf",
808            // it has optional args but not supported
809            &[("format_string", Direction::Input)],
810        ),
811        SvSystemFunction::new("$fgetc", &[("fd", Direction::Input)]),
812        SvSystemFunction::new(
813            "$ungetc",
814            &[("c", Direction::Output), ("fd", Direction::Input)],
815        ),
816        SvSystemFunction::new(
817            "$fgets",
818            &[("str", Direction::Output), ("fd", Direction::Input)],
819        ),
820        SvSystemFunction::new(
821            "$fscanf",
822            // it has optional args but not supported
823            &[("fd", Direction::Input), ("format", Direction::Input)],
824        ),
825        SvSystemFunction::new(
826            "$sscanf",
827            // it has optional args but not supported
828            &[("str", Direction::Input), ("format", Direction::Input)],
829        ),
830        SvSystemFunction::new(
831            "$fread",
832            // it has optional args but not supported
833            &[
834                ("integral_va_or_memory", Direction::Input),
835                ("fd", Direction::Input),
836            ],
837        ),
838        SvSystemFunction::new("$ftell", &[("fd", Direction::Input)]),
839        SvSystemFunction::new(
840            "$fseek",
841            &[
842                ("fd", Direction::Input),
843                ("offset", Direction::Input),
844                ("operation", Direction::Input),
845            ],
846        ),
847        SvSystemFunction::new("$rewind", &[("fd", Direction::Input)]),
848        SvSystemFunction::new(
849            "$fflush",
850            // it has optional args but not supported
851            &[],
852        ),
853        SvSystemFunction::new(
854            "$ferror",
855            // it has optional args but not supported
856            &[("fd", Direction::Input), ("str", Direction::Output)],
857        ),
858        SvSystemFunction::new("$feof", &[("fd", Direction::Input)]),
859        // Loading memory array data from a file
860        SvSystemFunction::new(
861            "$readmemb",
862            // it has optional args but not supported
863            &[
864                ("filename", Direction::Input),
865                ("memory_name", Direction::Output),
866            ],
867        ),
868        SvSystemFunction::new(
869            "$readmemh",
870            // it has optional args but not supported
871            &[
872                ("filename", Direction::Input),
873                ("memory_name", Direction::Output),
874            ],
875        ),
876        // Writing memory array data to a file
877        SvSystemFunction::new(
878            "$writememb",
879            // it has optional args but not supported
880            &[
881                ("filename", Direction::Input),
882                ("memory_name", Direction::Input),
883            ],
884        ),
885        SvSystemFunction::new(
886            "$writememh",
887            // it has optional args but not supported
888            &[
889                ("filename", Direction::Input),
890                ("memory_name", Direction::Input),
891            ],
892        ),
893        // Command line input
894        SvSystemFunction::new("$test$plusargs", &[("string", Direction::Input)]),
895        SvSystemFunction::new(
896            "$value$plusargs",
897            &[
898                ("user_string", Direction::Input),
899                ("variable", Direction::Output),
900            ],
901        ),
902        // Value change dump (VCD) files
903        SvSystemFunction::new("$dumpfile", &[("filename", Direction::Input)]),
904        SvSystemFunction::new(
905            "$dumpvars",
906            // it has optional args but not supported
907            &[],
908        ),
909        SvSystemFunction::new("$dumpoff", &[]),
910        SvSystemFunction::new("$dumpon", &[]),
911        SvSystemFunction::new("$dumpall", &[]),
912        SvSystemFunction::new("$dumplimit", &[("filesize", Direction::Input)]),
913        SvSystemFunction::new("$dumpflush", &[]),
914        SvSystemFunction::new(
915            "$dumpports",
916            // it has optional args but not supported
917            &[],
918        ),
919        SvSystemFunction::new("$dumpportsoff", &[("filename", Direction::Input)]),
920        SvSystemFunction::new("$dumpportson", &[("filename", Direction::Input)]),
921        SvSystemFunction::new("$dumpportsall", &[("filename", Direction::Input)]),
922        SvSystemFunction::new(
923            "$dumpportslimit",
924            &[
925                ("filelimit", Direction::Input),
926                ("filename", Direction::Input),
927            ],
928        ),
929        SvSystemFunction::new("$dumpportsflush", &[("filename", Direction::Input)]),
930    ]
931}