diff --git a/scgallery/designs/aes/aes.py b/scgallery/designs/aes/aes.py index f85b6cc..af560c1 100755 --- a/scgallery/designs/aes/aes.py +++ b/scgallery/designs/aes/aes.py @@ -19,6 +19,8 @@ def setup(target=asap7_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) src_root = os.path.join('aes', 'src') sdc_root = os.path.join('aes', 'constraints') @@ -33,9 +35,6 @@ def setup(target=asap7_demo): chip.add('option', 'idir', src_root, package='scgallery-designs') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/ariane/ariane.py b/scgallery/designs/ariane/ariane.py index b2d6f6b..561d10d 100755 --- a/scgallery/designs/ariane/ariane.py +++ b/scgallery/designs/ariane/ariane.py @@ -19,6 +19,8 @@ def setup(target=freepdk45_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) src_root = os.path.join('ariane', 'src') sdc_root = os.path.join('ariane', 'constraints') @@ -26,9 +28,6 @@ def setup(target=freepdk45_demo): for src in ('ariane.sv2v.v', 'macros.v'): chip.input(os.path.join(src_root, src), package='scgallery-designs') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/black_parrot/black_parrot.py b/scgallery/designs/black_parrot/black_parrot.py index c2c8a61..f1ae80e 100755 --- a/scgallery/designs/black_parrot/black_parrot.py +++ b/scgallery/designs/black_parrot/black_parrot.py @@ -17,6 +17,8 @@ def setup(target=freepdk45_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) src_root = os.path.join('black_parrot', 'src') extra_root = os.path.join('black_parrot', 'extra') @@ -25,9 +27,6 @@ def setup(target=freepdk45_demo): for src in ('pickled.v',): chip.input(os.path.join(src_root, src), package='scgallery-designs') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/caliptra/datavault.py b/scgallery/designs/caliptra/datavault.py index 37e9b1c..54ce17b 100755 --- a/scgallery/designs/caliptra/datavault.py +++ b/scgallery/designs/caliptra/datavault.py @@ -19,6 +19,8 @@ def setup(target=freepdk45_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) sdc_root = os.path.join('caliptra', 'constraints', 'datavault') @@ -26,9 +28,6 @@ def setup(target=freepdk45_demo): chip.set('option', 'entrypoint', 'dv') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/caliptra/keyvault.py b/scgallery/designs/caliptra/keyvault.py index 03e3df7..ec32a82 100755 --- a/scgallery/designs/caliptra/keyvault.py +++ b/scgallery/designs/caliptra/keyvault.py @@ -19,6 +19,8 @@ def setup(target=freepdk45_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) sdc_root = os.path.join('caliptra', 'constraints', 'keyvault') @@ -26,9 +28,6 @@ def setup(target=freepdk45_demo): chip.set('option', 'entrypoint', 'kv') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/caliptra/sha512.py b/scgallery/designs/caliptra/sha512.py index 5c63508..5c1b5c2 100755 --- a/scgallery/designs/caliptra/sha512.py +++ b/scgallery/designs/caliptra/sha512.py @@ -19,6 +19,8 @@ def setup(target=freepdk45_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) sdc_root = os.path.join('caliptra', 'constraints', 'sha512') @@ -26,9 +28,6 @@ def setup(target=freepdk45_demo): chip.set('option', 'entrypoint', 'sha512_ctrl') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/dynamic_node/dynamic_node.py b/scgallery/designs/dynamic_node/dynamic_node.py index 0eea150..aecb8d3 100755 --- a/scgallery/designs/dynamic_node/dynamic_node.py +++ b/scgallery/designs/dynamic_node/dynamic_node.py @@ -13,6 +13,8 @@ def setup(target=asap7_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) sdc_root = os.path.join('dynamic_node', 'constraints') @@ -23,9 +25,6 @@ def setup(target=asap7_demo): chip.input('modules/dynamic_node_2dmesh/NETWORK_2dmesh/dynamic_node_2dmesh.pickle.v', package='OPDB') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/ethmac/ethmac.py b/scgallery/designs/ethmac/ethmac.py index 70708a4..6d597f5 100755 --- a/scgallery/designs/ethmac/ethmac.py +++ b/scgallery/designs/ethmac/ethmac.py @@ -13,6 +13,8 @@ def setup(target=asap7_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) src_root = os.path.join('ethmac', 'src') sdc_root = os.path.join('ethmac', 'constraints') @@ -47,9 +49,6 @@ def setup(target=asap7_demo): chip.add('option', 'idir', src_root, package='scgallery-designs') - if not chip.get('option', 'target'): - chip.load_target(target) - _common.add_lambdalib_memory(chip) chip.add('option', 'define', 'ETH_VIRTUAL_SILICON_RAM') chip.input(os.path.join('ethmac', 'extra', 'lambda.v'), package='scgallery-designs') diff --git a/scgallery/designs/gcd/gcd.py b/scgallery/designs/gcd/gcd.py index b48b111..18328ac 100755 --- a/scgallery/designs/gcd/gcd.py +++ b/scgallery/designs/gcd/gcd.py @@ -4,6 +4,7 @@ from siliconcompiler import Chip from siliconcompiler.targets import asap7_demo +from siliconcompiler.tools._common.asic import get_mainlib from scgallery import Gallery @@ -12,6 +13,8 @@ def setup(target=asap7_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) src_root = os.path.join('gcd', 'src') sdc_root = os.path.join('gcd', 'constraints') @@ -19,10 +22,7 @@ def setup(target=asap7_demo): for src in ('gcd.v',): chip.input(os.path.join(src_root, src), package='scgallery-designs') - if not chip.get('option', 'target'): - chip.load_target(target) - - mainlib = chip.get('asic', 'logiclib')[0] + mainlib = get_mainlib(chip) chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') chip.set('tool', 'yosys', 'task', 'syn_asic', 'var', 'strategy', 'AREA3') diff --git a/scgallery/designs/heartbeat/heartbeat.py b/scgallery/designs/heartbeat/heartbeat.py index 9c87af1..7a64d28 100755 --- a/scgallery/designs/heartbeat/heartbeat.py +++ b/scgallery/designs/heartbeat/heartbeat.py @@ -12,6 +12,8 @@ def setup(target=asap7_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) src_root = os.path.join('heartbeat', 'src') sdc_root = os.path.join('heartbeat', 'constraints') @@ -19,9 +21,6 @@ def setup(target=asap7_demo): for src in ('heartbeat.v',): chip.input(os.path.join(src_root, src), package='scgallery-designs') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/ibex/ibex.py b/scgallery/designs/ibex/ibex.py index 304e741..86e646a 100755 --- a/scgallery/designs/ibex/ibex.py +++ b/scgallery/designs/ibex/ibex.py @@ -13,6 +13,8 @@ def setup(target=asap7_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) sdc_root = os.path.join('ibex', 'constraints') @@ -53,9 +55,6 @@ def setup(target=asap7_demo): chip.add('option', 'define', 'SYNTHESIS') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/jpeg/jpeg.py b/scgallery/designs/jpeg/jpeg.py index 91d0a36..73725a6 100755 --- a/scgallery/designs/jpeg/jpeg.py +++ b/scgallery/designs/jpeg/jpeg.py @@ -13,6 +13,8 @@ def setup(target=asap7_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) src_root = os.path.join('jpeg', 'src') sdc_root = os.path.join('jpeg', 'constraints') @@ -34,9 +36,6 @@ def setup(target=asap7_demo): 'zigzag.v'): chip.input(os.path.join(src_root, src), package='scgallery-designs') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/mock_alu/mock_alu.py b/scgallery/designs/mock_alu/mock_alu.py index e59bf81..8fa3eae 100755 --- a/scgallery/designs/mock_alu/mock_alu.py +++ b/scgallery/designs/mock_alu/mock_alu.py @@ -13,6 +13,8 @@ def setup(target=asap7_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) src_root = os.path.join('mock_alu', 'src') sdc_root = os.path.join('mock_alu', 'constraints') @@ -42,9 +44,6 @@ def setup(target=asap7_demo): chip.add('tool', 'chisel', 'task', 'convert', 'var', 'argument', f'--operations {",".join(operations)}') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/openmsp430/openmsp430.py b/scgallery/designs/openmsp430/openmsp430.py index 0c53017..7e23e10 100755 --- a/scgallery/designs/openmsp430/openmsp430.py +++ b/scgallery/designs/openmsp430/openmsp430.py @@ -13,6 +13,8 @@ def setup(target=skywater130_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) src_root = os.path.join('core', 'rtl', 'verilog') sdc_root = os.path.join('openmsp430', 'constraints') @@ -44,9 +46,6 @@ def setup(target=skywater130_demo): 'omsp_clock_mux.v'): chip.input(os.path.join(src_root, src), package='openmsp430') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/picorv32/picorv32.py b/scgallery/designs/picorv32/picorv32.py index a0a5367..9fb6ba9 100755 --- a/scgallery/designs/picorv32/picorv32.py +++ b/scgallery/designs/picorv32/picorv32.py @@ -12,6 +12,8 @@ def setup(target=skywater130_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) sdc_root = os.path.join('picorv32', 'constraints') @@ -22,9 +24,6 @@ def setup(target=skywater130_demo): for src in ('picorv32.v',): chip.input(src, package='picorv32') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/riscv32i/riscv32i.py b/scgallery/designs/riscv32i/riscv32i.py index 8a329b7..f1a86cb 100755 --- a/scgallery/designs/riscv32i/riscv32i.py +++ b/scgallery/designs/riscv32i/riscv32i.py @@ -13,6 +13,8 @@ def setup(target=skywater130_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) src_root = os.path.join('riscv32i', 'src') sdc_root = os.path.join('riscv32i', 'constraints') @@ -44,9 +46,6 @@ def setup(target=skywater130_demo): 'top.v'): chip.input(os.path.join(src_root, src), package='scgallery-designs') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/spi/spi.py b/scgallery/designs/spi/spi.py index da2fc71..dea1539 100755 --- a/scgallery/designs/spi/spi.py +++ b/scgallery/designs/spi/spi.py @@ -12,6 +12,8 @@ def setup(target=asap7_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) src_root = os.path.join('spi', 'src') sdc_root = os.path.join('spi', 'constraints') @@ -19,9 +21,6 @@ def setup(target=asap7_demo): for src in ('spi.v',): chip.input(os.path.join(src_root, src), package='scgallery-designs') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/swerv/swerv.py b/scgallery/designs/swerv/swerv.py index 4df5668..97fccaf 100755 --- a/scgallery/designs/swerv/swerv.py +++ b/scgallery/designs/swerv/swerv.py @@ -12,6 +12,8 @@ def setup(target=asap7_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) sdc_root = os.path.join('swerv', 'constraints') lint_root = os.path.join('swerv', 'lint') @@ -75,9 +77,6 @@ def setup(target=asap7_demo): chip.add('option', 'define', 'PHYSICAL') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/tiny_rocket/tiny_rocket.py b/scgallery/designs/tiny_rocket/tiny_rocket.py index 48a8951..8fd73a7 100755 --- a/scgallery/designs/tiny_rocket/tiny_rocket.py +++ b/scgallery/designs/tiny_rocket/tiny_rocket.py @@ -14,6 +14,8 @@ def setup(target=freepdk45_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) src_root = os.path.join('tiny_rocket', 'src') extra_root = os.path.join('tiny_rocket', 'extra') @@ -25,9 +27,6 @@ def setup(target=freepdk45_demo): 'plusarg_reader.v'): chip.input(os.path.join(src_root, src), package='scgallery-designs') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/designs/uart/uart.py b/scgallery/designs/uart/uart.py index b1e66bf..b39f630 100755 --- a/scgallery/designs/uart/uart.py +++ b/scgallery/designs/uart/uart.py @@ -12,6 +12,8 @@ def setup(target=asap7_demo): if __name__ == '__main__': Gallery.design_commandline(chip) + else: + chip.load_target(target) src_root = os.path.join('uart', 'src') sdc_root = os.path.join('uart', 'constraints') @@ -22,9 +24,6 @@ def setup(target=asap7_demo): 'uart_rx.v'): chip.input(os.path.join(src_root, src), package='scgallery-designs') - if not chip.get('option', 'target'): - chip.load_target(target) - mainlib = chip.get('asic', 'logiclib')[0] chip.input(os.path.join(sdc_root, f'{mainlib}.sdc'), package='scgallery-designs') diff --git a/scgallery/gallery.py b/scgallery/gallery.py index 8e07681..bb9d66f 100755 --- a/scgallery/gallery.py +++ b/scgallery/gallery.py @@ -14,6 +14,7 @@ from siliconcompiler import Schema from siliconcompiler.utils import default_credentials_file from siliconcompiler.tools._common import has_input_files +from siliconcompiler.tools._common.asic import get_mainlib from siliconcompiler.targets import \ asap7_demo, \ freepdk45_demo, \ @@ -468,7 +469,7 @@ def __setup_design(self, design, target): return chip, is_valid def __setup_run_chip(self, chip, name, jobsuffix=None): - jobname = chip.get('option', 'target').split('.')[-1] + jobname = f"{chip.get('option', 'pdk')}_{get_mainlib(chip)}" if self.__jobname: jobname += f"_{self.__jobname}" if jobsuffix: