mirror of https://github.com/VLSIDA/OpenRAM.git
added documetation to functions
This commit is contained in:
parent
e131af2cc3
commit
6cde6beafa
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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) + '</p>'
|
||||
self.html += '<p style="font-size: 18px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">' + \
|
||||
'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 += in_out(self.io,table_id='data').__html__().replace('<','<').replace('"','"').replace('>',">")
|
||||
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 += operating_conditions(self.operating,table_id='data').__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>'
|
||||
model = ''
|
||||
if self.ANALYTICAL_MODEL:
|
||||
model = "analytical model: results may not be percise"
|
||||
else:
|
||||
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 += timing_and_current_data(self.timing,table_id='data').__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 += 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 += characterization_corners(self.corners,table_id='data').__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 += deliverables(self.dlv,table_id='data').__html__().replace('<','<').replace('"','"').replace('>',">")
|
||||
self.html += self.dlv_table.to_html()
|
||||
|
|
|
|||
|
|
@ -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)):
|
||||
|
|
|
|||
|
|
@ -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 += '<thead>'
|
||||
html += '<tr>'
|
||||
for col in self.rows[0]:
|
||||
html += '<th>' + str(col) + '</th>'
|
||||
html += '<th>' + str(col) + '</th>'
|
||||
html += '</tr>'
|
||||
html += '</thead>'
|
||||
return html
|
||||
|
||||
def gen_table_body(self):
|
||||
"""generate html body (used after gen_table_head)"""
|
||||
html = ''
|
||||
|
||||
html += '<tbody>'
|
||||
|
|
@ -33,7 +38,7 @@ class table_gen:
|
|||
return html
|
||||
|
||||
def to_html(self):
|
||||
|
||||
"""writes table_gen object to inline html"""
|
||||
html = ''
|
||||
html += '<table id= \"'+self.table_id+'\">'
|
||||
html += self.gen_table_head()
|
||||
|
|
|
|||
Loading…
Reference in New Issue