Line 20... |
Line 20... |
|
|
with open('../top-level-files.txt') as f:
|
with open('../top-level-files.txt') as f:
|
files = f.read().splitlines()
|
files = f.read().splitlines()
|
|
|
# Create a file that should be included in the top-level source
|
# Create a file that should be included in the top-level source
|
with open('globals.i', 'w') as file1:
|
with open('globals.vh', 'w') as file1:
|
file1.write("// Automatically generated by genglobals.py\n")
|
file1.write("// Automatically generated by genglobals.py\n")
|
|
|
# Keep track of duplicated symbols across all files
|
# Keep track of duplicated symbols across all files
|
globals = []
|
globals = []
|
|
|
Line 44... |
Line 44... |
wires.append(info[2] + ' ' + info[3].translate(None, ';,'))
|
wires.append(info[2] + ' ' + info[3].translate(None, ';,'))
|
else:
|
else:
|
wires.append(info[2].translate(None, ';,'))
|
wires.append(info[2].translate(None, ';,'))
|
|
|
if len(wires)>0:
|
if len(wires)>0:
|
with open('globals.i', 'a') as file1:
|
with open('globals.vh', 'a') as file1:
|
file1.write("\n// Module: " + infile + "\n")
|
file1.write("\n// Module: " + infile + "\n")
|
for wire in wires:
|
for wire in wires:
|
# Everything in globals is a wire
|
# Everything in globals is a wire
|
# (Can't use 'logic' since some buses are bidirectional)
|
# (Can't use 'logic' since some buses are bidirectional)
|
if wire in globals:
|
if wire in globals:
|
file1.write("// wire " + wire + "; (previously defined)\n")
|
file1.write("// wire " + wire + "; (previously defined)\n")
|
else:
|
else:
|
file1.write("wire " + wire + ";\n")
|
file1.write("wire " + wire + ";\n")
|
globals.append(wire)
|
globals.append(wire)
|
|
|
# Touch files that include 'globals.i' to ensure it will recompile correctly
|
# Touch files that include 'globals.vh' to ensure it will recompile correctly
|
os.utime("core.i", None)
|
os.utime("core.vh", None)
|
os.utime("z80_top_direct_n.sv", None)
|
os.utime("z80_top_direct_n.sv", None)
|
os.utime("z80_top_ifc_n.sv", None)
|
os.utime("z80_top_ifc_n.sv", None)
|
|
|
No newline at end of file
|
No newline at end of file
|