Merge branch 'submission-tools' of github.com:tinytapeout/tt-support-tools into submission-tools

This commit is contained in:
matt venn
2023-03-17 10:07:27 +01:00
3 changed files with 36 additions and 29 deletions
+14 -28
View File
@@ -5,7 +5,8 @@ import os
class CaravelConfig(): class CaravelConfig():
def __init__(self, projects, num_projects): def __init__(self, config, projects, num_projects):
self.config = config
self.projects = projects self.projects = projects
self.num_projects = num_projects self.num_projects = num_projects
self.script_dir = os.path.dirname(os.path.realpath(__file__)) self.script_dir = os.path.dirname(os.path.realpath(__file__))
@@ -13,42 +14,27 @@ class CaravelConfig():
# create macro file & positions, power hooks # create macro file & positions, power hooks
def create_macro_config(self): def create_macro_config(self):
# array size # array size
rows = 18 c = self.config['layout']
cols = 14
# start point (lower left)
start_x = 50
start_y = 95
# module block sizes
scanchain_w = 30
scanchain_spc = 6
module_w = 150
module_h = 170
# how much x & y space to leave between blocks
space_x = 15
space_y = 15
# step sizes # step sizes
step_x = scanchain_w + module_w + scanchain_spc + space_x step_x = c['scanchain_w'] + c['module_w'] + c['scanchain_spc'] +c['space_x']
step_y = module_h + space_y step_y = c['module_h'] + c['space_y']
logging.info(f"start_x {start_x} start_y {start_y} step_x {step_x} step_y {step_y }") logging.info(f"start_x {c['start_x']} start_y {c['start_y']} step_x {step_x} step_y {step_y}")
num_macros_placed = 0 num_macros_placed = 0
# macro.cfg: where macros are placed # macro.cfg: where macros are placed
logging.info("creating macro.cfg") logging.info("creating macro.cfg")
with open("openlane/user_project_wrapper/macro.cfg", 'w') as fh: with open("openlane/user_project_wrapper/macro.cfg", 'w') as fh:
fh.write("scan_controller 100 100 N\n") fh.write(f"scan_controller {c['scan_control_x']} {c['scan_control_y']} N\n")
for row in range(rows): for row in range(c['rows']):
if row % 2 == 0: if row % 2 == 0:
col_order = range(cols) col_order = range(c['cols'])
orientation = 'N' orientation = 'N'
else: else:
# reverse odd rows to place instances in a zig zag pattern, shortening the scan chain wires # reverse odd rows to place instances in a zig zag pattern, shortening the scan chain wires
col_order = range(cols - 1, -1, -1) col_order = range(c['cols'] - 1, -1, -1)
orientation = 'S' orientation = 'S'
for col in col_order: for col in col_order:
# skip the space where the scan controller goes on the first row # skip the space where the scan controller goes on the first row
@@ -62,26 +48,26 @@ class CaravelConfig():
# co-ords are bottom left corner # co-ords are bottom left corner
macro_instance = self.projects[num_macros_placed].get_scanchain_instance() macro_instance = self.projects[num_macros_placed].get_scanchain_instance()
instance = "{} {:<4} {:<4} {}\n".format( instance = "{} {:<4} {:<4} {}\n".format(
macro_instance, start_x + col * step_x, start_y + row * step_y, orientation macro_instance, c['start_x'] + col * step_x, c['start_y'] + row * step_y, orientation
) )
fh.write(instance) fh.write(instance)
macro_instance = self.projects[num_macros_placed].get_macro_instance() macro_instance = self.projects[num_macros_placed].get_macro_instance()
instance = "{} {:<4} {:<4} {}\n".format( instance = "{} {:<4} {:<4} {}\n".format(
macro_instance, start_x + scanchain_spc + scanchain_w + col * step_x, start_y + row * step_y, orientation macro_instance, c['start_x'] + c['scanchain_spc'] + c['scanchain_w'] + col * step_x, c['start_y'] + row * step_y, orientation
) )
fh.write(instance) fh.write(instance)
else: else:
# macro first # macro first
macro_instance = self.projects[num_macros_placed].get_macro_instance() macro_instance = self.projects[num_macros_placed].get_macro_instance()
instance = "{} {:<4} {:<4} {}\n".format( instance = "{} {:<4} {:<4} {}\n".format(
macro_instance, start_x + col * step_x, start_y + row * step_y, orientation macro_instance, c['start_x'] + col * step_x, c['start_y'] + row * step_y, orientation
) )
fh.write(instance) fh.write(instance)
macro_instance = self.projects[num_macros_placed].get_scanchain_instance() macro_instance = self.projects[num_macros_placed].get_scanchain_instance()
instance = "{} {:<4} {:<4} {}\n".format( instance = "{} {:<4} {:<4} {}\n".format(
macro_instance, start_x + module_w + scanchain_spc + col * step_x, start_y + row * step_y, orientation macro_instance, c['start_x'] + c['module_w'] + c['scanchain_spc'] + col * step_x, c['start_y'] + row * step_y, orientation
) )
fh.write(instance) fh.write(instance)
+21
View File
@@ -4,3 +4,24 @@ filler_project: https://github.com/TinyTapeout/tt03-test-invert
project_dir: 'projects' project_dir: 'projects'
tmp_dir: '/tmp/tt' tmp_dir: '/tmp/tt'
num_projects: 250 num_projects: 250
layout:
rows: 18
cols: 14
# start point (lower left)
start_x: 50
start_y: 95
# module block sizes
scanchain_w: 30
scanchain_spc: 6
module_w: 150
module_h: 170
# how much x & y space to leave between blocks
space_x: 15
space_y: 15
scan_control_x: 100
scan_control_y: 100
+1 -1
View File
@@ -229,7 +229,7 @@ if __name__ == '__main__':
projects = Projects(config, args) projects = Projects(config, args)
docs = Docs(projects.projects, args=args) docs = Docs(projects.projects, args=args)
caravel = CaravelConfig(projects.projects, num_projects=args.limit_num_projects) caravel = CaravelConfig(config, projects.projects, num_projects=args.limit_num_projects)
if args.list: if args.list:
caravel.list() caravel.list()