forked from verilator/verilator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
verilator_includer
executable file
·29 lines (24 loc) · 960 Bytes
/
verilator_includer
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
#!/usr/bin/env python3
# pylint: disable=C0114,C0209
#
# Copyright 2003-2023 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify the Verilator internals under the terms
# of either the GNU Lesser General Public License Version 3 or the Perl
# Artistic License Version 2.0.
#
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
######################################################################
import re
import sys
print("// DESCR" + "IPTION: Generated by verilator_includer via makefile")
re_arg_d = re.compile(r'^-D([^=]+)=(.*)')
for arg in sys.argv[1:]:
match_d = re_arg_d.match(arg)
if match_d:
print("#define %s %s" % (match_d.group(1), match_d.group(2)))
else:
print("#include \"%s\"" % (arg))
######################################################################
# Local Variables:
# compile-command: "./verilator_includer -Ddef=value -Ddef2=value2 file1.h file2.h"
# End: