diff --git a/compiler/characterizer/lib.py b/compiler/characterizer/lib.py index 76d8e3d8..60452d76 100644 --- a/compiler/characterizer/lib.py +++ b/compiler/characterizer/lib.py @@ -511,6 +511,7 @@ class lib: else: with open(os.devnull, 'wb') as devnull: + # parses the mose recent git commit id - requres git is installed proc = subprocess.Popen(['git','rev-parse','HEAD'], cwd=os.path.abspath(os.environ.get("OPENRAM_HOME")) + '/', stdout=subprocess.PIPE) git_id = str(proc.stdout.read()) @@ -519,7 +520,7 @@ class lib: git_id = git_id[2:-3] except: pass - + # check if git id is valid if len(git_id) != 40: debug.warning("Failed to retrieve git id") git_id = 'Failed to retruieve' @@ -527,6 +528,7 @@ class lib: datasheet = open(OPTS.openram_temp +'/datasheet.info', 'a+') current_time = datetime.date.today() + # write static information to be parser later datasheet.write("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},".format( OPTS.output_name, OPTS.num_words, @@ -558,6 +560,7 @@ class lib: datasheet.write("{0},{1},".format(DRC, LVS)) datasheet.write(str(self.sram.width * self.sram.height)+',') + # write timing information for all ports for port in self.all_ports: #DIN timings if port in self.write_ports: @@ -654,10 +657,12 @@ class lib: )) - + # write power information for port in self.all_ports: name = '' read_write = '' + + # write dynamic power usage if port in self.read_ports: web_name = " & !WEb{0}".format(port) name = "!CSb{0} & clk{0}{1}".format(port, web_name) @@ -684,6 +689,7 @@ class lib: )) + # write leakage power control_str = 'CSb0' for i in range(1, self.total_port_num): control_str += ' & CSb{0}'.format(i) diff --git a/compiler/datasheet/datasheet.py b/compiler/datasheet/datasheet.py index 84a6eafc..4b5cb741 100644 --- a/compiler/datasheet/datasheet.py +++ b/compiler/datasheet/datasheet.py @@ -28,11 +28,12 @@ class datasheet(): # for item in self.description: # self.html += item + ',' self.html += '-->' - + # Add vlsida logo vlsi_logo = 0 with open(os.path.abspath(os.environ.get("OPENRAM_HOME")) + '/datasheet/assets/vlsi_logo.png', "rb") as image_file: vlsi_logo = base64.b64encode(image_file.read()) + # Add openram logo openram_logo = 0 with open(os.path.abspath(os.environ.get("OPENRAM_HOME")) + '/datasheet/assets/openram_logo_placeholder.png', "rb") as image_file: openram_logo = base64.b64encode(image_file.read()) @@ -49,32 +50,30 @@ class datasheet(): 'LVS errors: ' + str(self.LVS) + '

' self.html += '

' + \ 'Git commit id: ' + str(self.git_id) + '

' - + # print port table self.html += '

Ports and Configuration

' -# self.html += in_out(self.io,table_id='data').__html__().replace('<','<').replace('"','"').replace('>',">") self.html += self.io_table.to_html() - + + # print operating condidition information self.html += '

Operating Conditions

' -# self.html += operating_conditions(self.operating,table_id='data').__html__() self.html += self.operating_table.to_html() + # check if analytical model is being used self.html += '

Timing Data

' model = '' if self.ANALYTICAL_MODEL: model = "analytical model: results may not be percise" else: model = "spice characterizer" + # display timing data self.html += '

Using '+model+'

' -# self.html += timing_and_current_data(self.timing,table_id='data').__html__() self.html += self.timing_table.to_html() - + # display power data self.html += '

Power Data

' self.html += self.power_table.to_html() - + # display corner information self.html += '

Characterization Corners

' -# self.html += characterization_corners(self.corners,table_id='data').__html__() self.html += self.corners_table.to_html() - + # display deliverables table self.html += '

Deliverables

' -# self.html += deliverables(self.dlv,table_id='data').__html__().replace('<','<').replace('"','"').replace('>',">") self.html += self.dlv_table.to_html() diff --git a/compiler/datasheet/datasheet_gen.py b/compiler/datasheet/datasheet_gen.py index 51c636c8..44db3f9b 100644 --- a/compiler/datasheet/datasheet_gen.py +++ b/compiler/datasheet/datasheet_gen.py @@ -4,7 +4,6 @@ This is a script to load data from the characterization and layout processes int a web friendly html datasheet. """ # TODO: -# include power # Diagram generation # Improve css @@ -152,7 +151,7 @@ def parse_characterizer_csv(f, pages): 1000/float(MIN_PERIOD))) except Exception: pass - + # check current .lib file produces the slowest timing results while(True): col_start = col if(row[col].startswith('DIN')): @@ -354,6 +353,8 @@ def parse_characterizer_csv(f, pages): for element in row[col_start: col - 1]: sheet.description.append(str(element)) break + + #check if new power is worse the previous while(True): col_start = col if row[col] == 'power': @@ -368,7 +369,7 @@ def parse_characterizer_csv(f, pages): col += 4 else: break - + # check if new leakge is worse the previous while(True): col_start = col if row[col] == 'leak': @@ -380,7 +381,7 @@ def parse_characterizer_csv(f, pages): else: break - + # add new corner information new_sheet.corners_table.add_row( [PROC, VOLT, TEMP, LIB_NAME.replace(OUT_DIR, '').replace(NAME, '')]) new_sheet.dlv_table.add_row( @@ -427,6 +428,7 @@ def parse_characterizer_csv(f, pages): new_sheet.timing_table = table_gen.table_gen("timing") new_sheet.timing_table.add_row( ['Parameter', 'Min', 'Max', 'Units']) + # parse initial timing information while(True): col_start = col if(row[col].startswith('DIN')): @@ -553,7 +555,7 @@ def parse_characterizer_csv(f, pages): for element in row[col_start:col-1]: sheet.description.append(str(element)) break - + # parse initial power and leakage information while(True): start = col if(row[col].startswith('power')): @@ -618,7 +620,7 @@ def parse_characterizer_csv(f, pages): class datasheet_gen(): def datasheet_write(name): - + """writes the datasheet to a file""" in_dir = OPTS.openram_temp if not (os.path.isdir(in_dir)): diff --git a/compiler/datasheet/table_gen.py b/compiler/datasheet/table_gen.py index 18590739..8f94e896 100644 --- a/compiler/datasheet/table_gen.py +++ b/compiler/datasheet/table_gen.py @@ -1,24 +1,29 @@ class table_gen: - def __init__(self,name): + """small library of functions to generate the html tables""" + + def __init__(self, name): self.name = name self.rows = [] self.table_id = 'data' - def add_row(self,row): + def add_row(self, row): + """add a row to table_gen object""" self.rows.append(row) def gen_table_head(self): + """generate html table header""" html = '' html += '' html += '' for col in self.rows[0]: - html += '' + str(col) + '' + html += '' + str(col) + '' html += '' html += '' return html def gen_table_body(self): + """generate html body (used after gen_table_head)""" html = '' html += '' @@ -31,13 +36,13 @@ class table_gen: html += '' html += '' return html - + def to_html(self): - + """writes table_gen object to inline html""" html = '' html += '' html += self.gen_table_head() html += self.gen_table_body() html += '
' - + return html