changes for scan order, GLB routing adj and allow congestion

This commit is contained in:
Matt Venn
2023-04-20 16:26:30 +02:00
parent 2f1783b8b0
commit 9b3adc4756
3 changed files with 58 additions and 47 deletions
+53 -46
View File
@@ -11,68 +11,75 @@ class CaravelConfig():
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__))
# co-ords are bottom left corner
def place_macro(self, x, y, instance, rotate, fh):
c = self.config['layout']
if not rotate:
# scanchain first
orientation = 'N'
macro_instance = self.projects[instance].get_scanchain_instance()
fh.write(f"{macro_instance} {x:<4} {y:<4} {orientation}\n")
macro_instance = self.projects[instance].get_macro_instance()
x = x + c['scanchain_w'] + c['scanchain_spc']
fh.write(f"{macro_instance} {x:<4} {y:<4} {orientation}\n")
else:
# macro first
orientation = 'S'
macro_instance = self.projects[instance].get_macro_instance()
fh.write(f"{macro_instance} {x:<4} {y:<4} {orientation}\n")
macro_instance = self.projects[instance].get_scanchain_instance()
x = x + c['module_w'] + c['scanchain_spc']
y = y + c['module_h'] - c['scanchain_h']
fh.write(f"{macro_instance} {x:<4} {y:<4} {orientation}\n")
# 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
c = self.config['layout'] c = self.config['layout']
# step sizes pos_x = 2
step_x = c['scanchain_w'] + c['module_w'] + c['scanchain_spc'] + c['space_x'] pos_y = 0
step_y = c['module_h'] + c['space_y'] dir_x = 1
dir_y = 1
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
# 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(f"scan_controller {c['scan_control_x']} {c['scan_control_y']} N\n") fh.write(f"scan_controller {c['scan_control_x']} {c['scan_control_y']} N\n")
for row in range(c['rows']): for i in range(self.num_projects):
if row % 2 == 0: logging.debug(f"Block {i:d} at ({pos_x:d}, {pos_y:d})")
col_order = range(c['cols']) # calculate 0, 0 point
orientation = 'N' macro_x = c['start_x'] + pos_x * (c['module_w'] + c['scanchain_w'] + c['scanchain_spc'] + c['space_x'])
macro_y = c['start_y'] + pos_y * (c['module_h'] + c['space_y'])
# rotated?
if dir_x == 1:
rotate = False
else: else:
# reverse odd rows to place instances in a zig zag pattern, shortening the scan chain wires rotate = True
col_order = range(c['cols'] - 1, -1, -1)
orientation = 'S'
for col in col_order:
# skip the space where the scan controller goes on the first row
if row == 0 and col <= 1:
continue
if num_macros_placed < self.num_projects: self.place_macro(macro_x, macro_y, i, rotate, fh)
if orientation == 'N':
# scanchain first
# co-ords are bottom left corner
macro_instance = self.projects[num_macros_placed].get_scanchain_instance()
instance = "{} {:<4} {:<4} {}\n".format(
macro_instance, c['start_x'] + col * step_x, c['start_y'] + row * step_y, orientation
)
fh.write(instance)
macro_instance = self.projects[num_macros_placed].get_macro_instance() # next position
instance = "{} {:<4} {:<4} {}\n".format( pos_x += 2 * dir_x
macro_instance, c['start_x'] + c['scanchain_spc'] + c['scanchain_w'] + col * step_x, c['start_y'] + row * step_y, orientation
)
fh.write(instance)
else:
# macro first
macro_instance = self.projects[num_macros_placed].get_macro_instance()
instance = "{} {:<4} {:<4} {}\n".format(
macro_instance, c['start_x'] + col * step_x, c['start_y'] + row * step_y, orientation
)
fh.write(instance)
macro_instance = self.projects[num_macros_placed].get_scanchain_instance() if pos_x >= c['cols']:
instance = "{} {:<4} {:<4} {}\n".format( pos_x = c['cols'] - 1
macro_instance, c['start_x'] + c['module_w'] + c['scanchain_spc'] + col * step_x, c['start_y'] + row * step_y, orientation pos_y += dir_y
) dir_x = - dir_x
fh.write(instance)
num_macros_placed += 1 elif pos_x < 0:
pos_x = 0
pos_y += dir_y
dir_x = - dir_x
logging.info(f"total user macros placed: {num_macros_placed}") if pos_y >= c['rows']:
pos_y = c['rows'] - 1
dir_y = - dir_y
logging.info(f"total user macros placed: {self.num_projects}")
with open(os.path.join(self.script_dir, 'caravel_template', 'upw_config.json')) as fh: with open(os.path.join(self.script_dir, 'caravel_template', 'upw_config.json')) as fh:
caravel_config = json.load(fh) caravel_config = json.load(fh)
+3 -1
View File
@@ -24,6 +24,8 @@
"RUN_MAGIC_DRC": 0, "RUN_MAGIC_DRC": 0,
"IO_SYNC": 0, "IO_SYNC": 0,
"FP_PDN_CHECK_NODES": 0, "FP_PDN_CHECK_NODES": 0,
"GRT_ALLOW_CONGESTION": 1,
"GRT_LAYER_ADJUSTMENTS": "1,0.99,0.99,0,0,0",
"SYNTH_ELABORATE_ONLY": 1, "SYNTH_ELABORATE_ONLY": 1,
"PL_RANDOM_GLB_PLACEMENT": 1, "PL_RANDOM_GLB_PLACEMENT": 1,
"PL_RESIZER_DESIGN_OPTIMIZATIONS": 0, "PL_RESIZER_DESIGN_OPTIMIZATIONS": 0,
@@ -36,7 +38,7 @@
"FP_PDN_VPITCH": 140, "FP_PDN_VPITCH": 140,
"FP_PDN_VOFFSET": 186, "FP_PDN_VOFFSET": 186,
"FP_PDN_HPITCH": 185, "FP_PDN_HPITCH": 185,
"FP_PDN_HOFFSET": 130, "FP_PDN_HOFFSET": 160,
"CLOCK_TREE_SYNTH": 0, "CLOCK_TREE_SYNTH": 0,
"MAGIC_ZEROIZE_ORIGIN": 0, "MAGIC_ZEROIZE_ORIGIN": 0,
"FP_SIZING": "absolute", "FP_SIZING": "absolute",
+2
View File
@@ -196,6 +196,8 @@ if __name__ == '__main__':
with open('config.yaml') as fh: with open('config.yaml') as fh:
config = yaml.safe_load(fh) config = yaml.safe_load(fh)
# default max projects is row * col - 2 (scan controller takes first 2 slots)
config['num_projects'] = config['layout']['rows'] * config['layout']['cols'] - 2
parser.add_argument('--update-orders', help="update the order config file", action="store_const", const=True) parser.add_argument('--update-orders', help="update the order config file", action="store_const", const=True)
parser.add_argument('--list', help="list projects", action='store_const', const=True) parser.add_argument('--list', help="list projects", action='store_const', const=True)