Squashed commit of the following:

commit 9a5e1af9b969e3cbacdab1ece7ef25190194b3d5
Author: Joppe Blondel <joppe@blondel.nl>
Date:   Sun Sep 4 19:32:35 2022 +0200

    Cleaned up tree

    Signed-off-by: Joppe Blondel <joppe@blondel.nl>

commit 5f5556409a71afc904bb9df0915cd236d87fccb1
Author: Joppe Blondel <joppe@blondel.nl>
Date:   Sun Sep 4 19:31:20 2022 +0200

    Split up different scripts

    Signed-off-by: Joppe Blondel <joppe@blondel.nl>

commit 6855e9a1e808a99c4a326be7ef49b9b545eaf4bd
Author: Jojojoppe <joppe@blondel.nl>
Date:   Sun Sep 4 14:21:35 2022 +0200

    Client server structure done

    Signed-off-by: Jojojoppe <joppe@blondel.nl>

commit 44923b8b3407adb1f8f1c0d24c016613da68a726
Author: Jojojoppe <joppe@blondel.nl>
Date:   Sat Sep 3 22:35:00 2022 +0200

    Moved basic stuff to exec_class

    Signed-off-by: Jojojoppe <joppe@blondel.nl>

Signed-off-by: Joppe Blondel <joppe@blondel.nl>
This commit is contained in:
2022-09-04 19:34:07 +02:00
parent 162aaf47a0
commit 45eb980984
20 changed files with 698 additions and 231 deletions

86
scripts/rbuild Executable file
View File

@ -0,0 +1,86 @@
#!/usr/bin/env python3
import configparser
import sys
def print_help():
print("Unified FPGA synthesizer frontend\r\n(c) Joppe Blondel - 2022\r\n")
print(f"Usage: {sys.argv[0]} [ OPTIONS ] action [ target ] ...")
print("")
print("Options:")
print(" -h Show this help message")
print(" -c <file> Configuration file, defaults to project.cfg")
print("")
print("Actions:")
print("ip <target> Generate IP files from vendor provided libraries")
print("syn <target> Synthesize design for target")
print("impl <target> Route and place design for target")
print("bit <target> Generate output files and run analysis for target")
print("all <target> Generate IP, synthesize, route and place design for target")
print("floorplan <target> Run floorplan editor, currently only for local execution")
print("sim <simtarget> Run simulation target")
if __name__=="__main__":
# Parse arguments
i = 1
nextarg = None
configpath = 'project.cfg'
actions = []
while i<len(sys.argv):
if nextarg is not None:
if nextarg=='config':
configpath = sys.argv[i]
nextarg = None
else:
actions.append((nextarg, sys.argv[i]))
nextarg = None
elif sys.argv[i]=='-h':
print_help()
exit(0)
elif sys.argv[i]=='-c':
nextarg = 'config'
else:
nextarg = sys.argv[i]
i += 1
if nextarg is not None:
print("ERROR: expected more arguments")
exit(1)
config = configparser.ConfigParser()
config.read(configpath)
subprocesses = []
try:
for action in actions:
target = action[1]
action = action[0]
if not config.has_section(f'build:{target}'):
print("ERROR: config file has no build section for target")
exit(1)
devtarget = f'target:{config.get(f"build:{target}", "target", fallback="")}'
if not config.has_section(devtarget):
print("ERROR: config file has no section for device target")
exit(1)
toolchain = config.get(devtarget, 'toolchain', fallback="NONE")
if toolchain=="NONE":
print("ERROR: no toolchain specified for device target")
exit(1)
try:
exec(f"from remotesyn.{toolchain}.{action} import do")
except ImportError:
print(f"ERROR: Unknown action '{action}' for toolchain '{toolchain}'")
exit(1)
ret = do(config, target, print, subprocesses)
if ret!=0:
exit(ret)
except KeyboardInterrupt:
print("\rStopping rbuild")
for p in subprocesses:
p.kill()
exit(0)