added documetation to functions

This commit is contained in:
Jesse Cirimelli-Low 2019-02-07 06:33:39 -08:00
parent e131af2cc3
commit 6cde6beafa
4 changed files with 37 additions and 25 deletions

View File

@ -511,6 +511,7 @@ class lib:
else: else:
with open(os.devnull, 'wb') as devnull: 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) 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()) git_id = str(proc.stdout.read())
@ -519,7 +520,7 @@ class lib:
git_id = git_id[2:-3] git_id = git_id[2:-3]
except: except:
pass pass
# check if git id is valid
if len(git_id) != 40: if len(git_id) != 40:
debug.warning("Failed to retrieve git id") debug.warning("Failed to retrieve git id")
git_id = 'Failed to retruieve' git_id = 'Failed to retruieve'
@ -527,6 +528,7 @@ class lib:
datasheet = open(OPTS.openram_temp +'/datasheet.info', 'a+') datasheet = open(OPTS.openram_temp +'/datasheet.info', 'a+')
current_time = datetime.date.today() 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( datasheet.write("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},".format(
OPTS.output_name, OPTS.output_name,
OPTS.num_words, OPTS.num_words,
@ -558,6 +560,7 @@ class lib:
datasheet.write("{0},{1},".format(DRC, LVS)) datasheet.write("{0},{1},".format(DRC, LVS))
datasheet.write(str(self.sram.width * self.sram.height)+',') datasheet.write(str(self.sram.width * self.sram.height)+',')
# write timing information for all ports
for port in self.all_ports: for port in self.all_ports:
#DIN timings #DIN timings
if port in self.write_ports: if port in self.write_ports:
@ -654,10 +657,12 @@ class lib:
)) ))
# write power information
for port in self.all_ports: for port in self.all_ports:
name = '' name = ''
read_write = '' read_write = ''
# write dynamic power usage
if port in self.read_ports: if port in self.read_ports:
web_name = " & !WEb{0}".format(port) web_name = " & !WEb{0}".format(port)
name = "!CSb{0} & clk{0}{1}".format(port, web_name) name = "!CSb{0} & clk{0}{1}".format(port, web_name)
@ -684,6 +689,7 @@ class lib:
)) ))
# write leakage power
control_str = 'CSb0' control_str = 'CSb0'
for i in range(1, self.total_port_num): for i in range(1, self.total_port_num):
control_str += ' & CSb{0}'.format(i) control_str += ' & CSb{0}'.format(i)

View File

@ -28,11 +28,12 @@ class datasheet():
# for item in self.description: # for item in self.description:
# self.html += item + ',' # self.html += item + ','
self.html += '-->' self.html += '-->'
# Add vlsida logo
vlsi_logo = 0 vlsi_logo = 0
with open(os.path.abspath(os.environ.get("OPENRAM_HOME")) + '/datasheet/assets/vlsi_logo.png', "rb") as image_file: 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()) vlsi_logo = base64.b64encode(image_file.read())
# Add openram logo
openram_logo = 0 openram_logo = 0
with open(os.path.abspath(os.environ.get("OPENRAM_HOME")) + '/datasheet/assets/openram_logo_placeholder.png', "rb") as image_file: 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()) openram_logo = base64.b64encode(image_file.read())
@ -49,32 +50,30 @@ class datasheet():
'LVS errors: ' + str(self.LVS) + '</p>' 'LVS errors: ' + str(self.LVS) + '</p>'
self.html += '<p style="font-size: 18px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">' + \ self.html += '<p style="font-size: 18px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">' + \
'Git commit id: ' + str(self.git_id) + '</p>' 'Git commit id: ' + str(self.git_id) + '</p>'
# print port table
self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Ports and Configuration</p>' self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Ports and Configuration</p>'
# self.html += in_out(self.io,table_id='data').__html__().replace('&lt;','<').replace('&#34;','"').replace('&gt;',">")
self.html += self.io_table.to_html() self.html += self.io_table.to_html()
# print operating condidition information
self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Operating Conditions</p>' self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Operating Conditions</p>'
# self.html += operating_conditions(self.operating,table_id='data').__html__()
self.html += self.operating_table.to_html() self.html += self.operating_table.to_html()
# check if analytical model is being used
self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Timing Data</p>' self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Timing Data</p>'
model = '' model = ''
if self.ANALYTICAL_MODEL: if self.ANALYTICAL_MODEL:
model = "analytical model: results may not be percise" model = "analytical model: results may not be percise"
else: else:
model = "spice characterizer" model = "spice characterizer"
# display timing data
self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Using '+model+'</p>' self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Using '+model+'</p>'
# self.html += timing_and_current_data(self.timing,table_id='data').__html__()
self.html += self.timing_table.to_html() self.html += self.timing_table.to_html()
# display power data
self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Power Data</p>' self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Power Data</p>'
self.html += self.power_table.to_html() self.html += self.power_table.to_html()
# display corner information
self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Characterization Corners</p>' self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Characterization Corners</p>'
# self.html += characterization_corners(self.corners,table_id='data').__html__()
self.html += self.corners_table.to_html() self.html += self.corners_table.to_html()
# display deliverables table
self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Deliverables</p>' self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Deliverables</p>'
# self.html += deliverables(self.dlv,table_id='data').__html__().replace('&lt;','<').replace('&#34;','"').replace('&gt;',">")
self.html += self.dlv_table.to_html() self.html += self.dlv_table.to_html()

View File

@ -4,7 +4,6 @@ This is a script to load data from the characterization and layout processes int
a web friendly html datasheet. a web friendly html datasheet.
""" """
# TODO: # TODO:
# include power
# Diagram generation # Diagram generation
# Improve css # Improve css
@ -152,7 +151,7 @@ def parse_characterizer_csv(f, pages):
1000/float(MIN_PERIOD))) 1000/float(MIN_PERIOD)))
except Exception: except Exception:
pass pass
# check current .lib file produces the slowest timing results
while(True): while(True):
col_start = col col_start = col
if(row[col].startswith('DIN')): if(row[col].startswith('DIN')):
@ -354,6 +353,8 @@ def parse_characterizer_csv(f, pages):
for element in row[col_start: col - 1]: for element in row[col_start: col - 1]:
sheet.description.append(str(element)) sheet.description.append(str(element))
break break
#check if new power is worse the previous
while(True): while(True):
col_start = col col_start = col
if row[col] == 'power': if row[col] == 'power':
@ -368,7 +369,7 @@ def parse_characterizer_csv(f, pages):
col += 4 col += 4
else: else:
break break
# check if new leakge is worse the previous
while(True): while(True):
col_start = col col_start = col
if row[col] == 'leak': if row[col] == 'leak':
@ -380,7 +381,7 @@ def parse_characterizer_csv(f, pages):
else: else:
break break
# add new corner information
new_sheet.corners_table.add_row( new_sheet.corners_table.add_row(
[PROC, VOLT, TEMP, LIB_NAME.replace(OUT_DIR, '').replace(NAME, '')]) [PROC, VOLT, TEMP, LIB_NAME.replace(OUT_DIR, '').replace(NAME, '')])
new_sheet.dlv_table.add_row( 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 = table_gen.table_gen("timing")
new_sheet.timing_table.add_row( new_sheet.timing_table.add_row(
['Parameter', 'Min', 'Max', 'Units']) ['Parameter', 'Min', 'Max', 'Units'])
# parse initial timing information
while(True): while(True):
col_start = col col_start = col
if(row[col].startswith('DIN')): if(row[col].startswith('DIN')):
@ -553,7 +555,7 @@ def parse_characterizer_csv(f, pages):
for element in row[col_start:col-1]: for element in row[col_start:col-1]:
sheet.description.append(str(element)) sheet.description.append(str(element))
break break
# parse initial power and leakage information
while(True): while(True):
start = col start = col
if(row[col].startswith('power')): if(row[col].startswith('power')):
@ -618,7 +620,7 @@ def parse_characterizer_csv(f, pages):
class datasheet_gen(): class datasheet_gen():
def datasheet_write(name): def datasheet_write(name):
"""writes the datasheet to a file"""
in_dir = OPTS.openram_temp in_dir = OPTS.openram_temp
if not (os.path.isdir(in_dir)): if not (os.path.isdir(in_dir)):

View File

@ -1,13 +1,17 @@
class table_gen: class table_gen:
"""small library of functions to generate the html tables"""
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
self.rows = [] self.rows = []
self.table_id = 'data' 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) self.rows.append(row)
def gen_table_head(self): def gen_table_head(self):
"""generate html table header"""
html = '' html = ''
html += '<thead>' html += '<thead>'
@ -19,6 +23,7 @@ class table_gen:
return html return html
def gen_table_body(self): def gen_table_body(self):
"""generate html body (used after gen_table_head)"""
html = '' html = ''
html += '<tbody>' html += '<tbody>'
@ -33,7 +38,7 @@ class table_gen:
return html return html
def to_html(self): def to_html(self):
"""writes table_gen object to inline html"""
html = '' html = ''
html += '<table id= \"'+self.table_id+'\">' html += '<table id= \"'+self.table_id+'\">'
html += self.gen_table_head() html += self.gen_table_head()