f4pga/xc/xc7/toolchain_wrappers/symbiflow_write_fasm.py

43 lines
949 B
Python
Raw Normal View History

#!/usr/bin/python3
import shutil
import re
from symbiflow_common import *
mypath = my_path()
parser = setup_vpr_arg_parser()
args = parser.parse_args()
vprargs = VprArgs(args)
top = vprargs.eblif
top_ext_match = re.search('.*\\.[^.]*', vprargs.eblif)
if top_ext_match:
top = top[:top_ext_match.pos]
fasm_extra = top + '_fasm_extra.fasm'
noisy_warnings()
sub('genfasm',
vprargs.arch_def,
vprargs.eblif,
'--device', vprargs.device_name,
vprargs.vpr_options,
'--read_rr_graph', vprargs.rr_graph)
print(f'FASM extra: {fasm_extra}\n')
# Concatenate top.fasm with extra.fasm if necessary
if os.path.isfile(fasm_extra):
print('writing final fasm')
with open(top + '.fasm', 'r+<') as top_file, open(fasm_extra) as extra_file:
cat = top_file.read()
cat += '\n'
cat += extra_file.read()
top_file.seek(0)
top_file.write(cat)
top_file.truncate()
save_vpr_log('fasm.log')