From 6f171ad14713d3f14ed74c593dc1c1dd6f5d968c Mon Sep 17 00:00:00 2001 From: Matt Guthaus Date: Fri, 7 Dec 2018 13:54:18 -0800 Subject: [PATCH] Added router timing code. Commented combine adjacent pins due to run-time complexity --- compiler/globals.py | 5 ++-- compiler/router/router.py | 42 ++++++++++++++++++++------------ compiler/router/supply_router.py | 11 +++++++-- 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/compiler/globals.py b/compiler/globals.py index 5886d726..a62c041f 100644 --- a/compiler/globals.py +++ b/compiler/globals.py @@ -387,13 +387,13 @@ def import_tech(): OPTS.temperatures = tech.spice["temperatures"] -def print_time(name, now_time, last_time=None): +def print_time(name, now_time, last_time=None, indentation=2): """ Print a statement about the time delta. """ if last_time: time = str(round((now_time-last_time).total_seconds(),1)) + " seconds" else: time = now_time.strftime('%m/%d/%Y %H:%M:%S') - print("** {0}: {1}".format(name,time)) + print("{0} {1}: {2}".format("*"*indentation,name,time)) def report_status(): @@ -410,6 +410,7 @@ def report_status(): debug.error("Tech name must be specified in config file.") print("Technology: {0}".format(OPTS.tech_name)) + print("Total size: {} kbits".format(OPTS.word_size*OPTS.num_words*OPTS.num_banks)) print("Word size: {0}\nWords: {1}\nBanks: {2}".format(OPTS.word_size, OPTS.num_words, OPTS.num_banks)) diff --git a/compiler/router/router.py b/compiler/router/router.py index 6b1a1535..35650994 100644 --- a/compiler/router/router.py +++ b/compiler/router/router.py @@ -123,16 +123,6 @@ class router(router_tech): debug.info(3,"Retrieved pin {}".format(str(pin))) - - def find_pins(self,pin_name): - """ - Finds the pin shapes and converts to tracks. - Pin can either be a label or a location,layer pair: [[x,y],layer]. - """ - debug.info(1,"Finding pins for {}.".format(pin_name)) - self.retrieve_pins(pin_name) - self.analyze_pins(pin_name) - def find_blockages(self): """ Iterate through all the layers and write the obstacles to the routing grid. @@ -143,7 +133,6 @@ class router(router_tech): for layer in [self.vert_layer_number,self.horiz_layer_number]: self.retrieve_blockages(layer) - def find_pins_and_blockages(self, pin_list): """ Find the pins and blockages in the design @@ -151,32 +140,53 @@ class router(router_tech): # This finds the pin shapes and sorts them into "groups" that are connected # This must come before the blockages, so we can not count the pins themselves # as blockages. - for pin in pin_list: - self.find_pins(pin) + start_time = datetime.now() + for pin_name in pin_list: + self.retrieve_pins(pin_name) + print_time("Retrieving pins",datetime.now(), start_time, 4) + + start_time = datetime.now() + for pin_name in pin_list: + self.analyze_pins(pin_name) + print_time("Analyzing pins",datetime.now(), start_time, 4) # This will get all shapes as blockages and convert to grid units # This ignores shapes that were pins + start_time = datetime.now() self.find_blockages() + print_time("Finding blockages",datetime.now(), start_time, 4) # Convert the blockages to grid units + start_time = datetime.now() self.convert_blockages() + print_time("Converting blockages",datetime.now(), start_time, 4) # This will convert the pins to grid units # It must be done after blockages to ensure no DRCs between expanded pins and blocked grids + start_time = datetime.now() for pin in pin_list: self.convert_pins(pin) + print_time("Converting pins",datetime.now(), start_time, 4) # Combine adjacent pins into pin groups to reduce run-time - for pin in pin_list: - self.combine_adjacent_pins(pin) + # by reducing the number of maze routes. + # This algorithm is > O(n^2) so remove it for now + # start_time = datetime.now() + # for pin in pin_list: + # self.combine_adjacent_pins(pin) + # print_time("Combining adjacent pins",datetime.now(), start_time, 4) + # Separate any adjacent grids of differing net names that overlap # Must be done before enclosing pins + start_time = datetime.now() self.separate_adjacent_pins(0) + print_time("Separating adjacent pins",datetime.now(), start_time, 4) # Enclose the continguous grid units in a metal rectangle to fix some DRCs + start_time = datetime.now() self.enclose_pins() - + print_time("Enclosing pins",datetime.now(), start_time, 4) def combine_adjacent_pins(self, pin_name): """ diff --git a/compiler/router/supply_router.py b/compiler/router/supply_router.py index 3106decd..9f2ddf57 100644 --- a/compiler/router/supply_router.py +++ b/compiler/router/supply_router.py @@ -65,9 +65,12 @@ class supply_router(router): self.create_routing_grid() # Get the pin shapes + start_time = datetime.now() self.find_pins_and_blockages([self.vdd_name, self.gnd_name]) + print_time("Finding pins and blockages",datetime.now(), start_time, 3) # Add the supply rails in a mesh network and connect H/V with vias + start_time = datetime.now() # Block everything self.prepare_blockages(self.gnd_name) # Determine the rail locations @@ -77,15 +80,19 @@ class supply_router(router): self.prepare_blockages(self.vdd_name) # Determine the rail locations self.route_supply_rails(self.vdd_name,1) - + print_time("Routing supply rails",datetime.now(), start_time, 3) + + start_time = datetime.now() self.route_simple_overlaps(vdd_name) self.route_simple_overlaps(gnd_name) + print_time("Simple overlap routing",datetime.now(), start_time, 3) # Route the supply pins to the supply rails # Route vdd first since we want it to be shorter + start_time = datetime.now() self.route_pins_to_rails(vdd_name) self.route_pins_to_rails(gnd_name) - + print_time("Maze routing supplies",datetime.now(), start_time, 3) #self.write_debug_gds("final.gds",False) return True