mirror of https://github.com/VLSIDA/OpenRAM.git
Merge branch 'datasheet_gen' into dev
This commit is contained in:
commit
e6311dd44a
|
|
@ -0,0 +1,41 @@
|
|||
from pathlib import Path
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
# This is the path to the directory you would like to search
|
||||
# This directory is searched recursively for .html files
|
||||
|
||||
path_to_files = sys.argv[1]
|
||||
|
||||
|
||||
def get_file_tree(path):
|
||||
return list(Path(path).rglob("*.html"))
|
||||
|
||||
|
||||
def parse_html(file, comment):
|
||||
start_tag = '<!--'+comment
|
||||
end_tag = comment+'-->'
|
||||
|
||||
with open(file, 'r') as f:
|
||||
|
||||
file_string = f.read()
|
||||
|
||||
with open(file, 'w') as f:
|
||||
|
||||
file_string = file_string.replace(start_tag,"")
|
||||
file_string = file_string.replace(end_tag,"")
|
||||
|
||||
f.write(file_string)
|
||||
|
||||
def uncomment(comments):
|
||||
comment_files = []
|
||||
for datasheet in datasheet_list:
|
||||
for comment in comments:
|
||||
if glob.glob(os.path.dirname(datasheet)+'/*' + comment):
|
||||
parse_html(datasheet, comment)
|
||||
|
||||
datasheet_list = get_file_tree(path_to_files)
|
||||
comments = ['.db']
|
||||
uncomment(comments)
|
||||
|
||||
|
|
@ -38,6 +38,9 @@ class datasheet():
|
|||
with open(os.path.abspath(os.environ.get("OPENRAM_HOME")) + '/datasheet/assets/OpenRAM_logo.png', "rb") as image_file:
|
||||
openram_logo = base64.b64encode(image_file.read())
|
||||
|
||||
#comment table rows which we may want to enable after compile time
|
||||
comments = ['.db']
|
||||
|
||||
self.html += '<a href="https://vlsida.soe.ucsc.edu/"><img src="data:image/png;base64,{0}" alt="VLSIDA"></a><a href ="https://github.com/VLSIDA/OpenRAM"><img src ="data:image/png;base64,{1}" alt = "OpenRAM"></a>'.format(str(vlsi_logo)[2:-1], str(openram_logo)[2:-1])
|
||||
|
||||
self.html += '<p style="font-size: 18px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">' + \
|
||||
|
|
@ -51,11 +54,11 @@ class datasheet():
|
|||
'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 += self.io_table.to_html()
|
||||
self.html += self.io_table.to_html(comments)
|
||||
|
||||
# print operating condidition information
|
||||
self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Operating Conditions</p>'
|
||||
self.html += self.operating_table.to_html()
|
||||
self.html += self.operating_table.to_html(comments)
|
||||
|
||||
# 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>'
|
||||
|
|
@ -66,13 +69,14 @@ class datasheet():
|
|||
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 += self.timing_table.to_html()
|
||||
self.html += self.timing_table.to_html(comments)
|
||||
# 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()
|
||||
self.html += self.power_table.to_html(comments)
|
||||
# display corner information
|
||||
self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Characterization Corners</p>'
|
||||
self.html += self.corners_table.to_html()
|
||||
self.html += self.corners_table.to_html(comments)
|
||||
# display deliverables table
|
||||
self.html += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Deliverables</p>'
|
||||
self.html += self.dlv_table.to_html()
|
||||
self.dlv_table.sort()
|
||||
self.html += self.dlv_table.to_html(comments)
|
||||
|
|
|
|||
|
|
@ -386,6 +386,9 @@ def parse_characterizer_csv(f, pages):
|
|||
[PROC, VOLT, TEMP, LIB_NAME.replace(OUT_DIR, '').replace(NAME, '')])
|
||||
new_sheet.dlv_table.add_row(
|
||||
['.lib', 'Synthesis models', '<a href="file://{0}">{1}</a>'.format(LIB_NAME, LIB_NAME.replace(OUT_DIR, ''))])
|
||||
new_sheet.dlv_table.add_row(
|
||||
['.db', 'Compiled .lib', '<a href="{1}">{1}</a>'.format(LIB_NAME[:-3] + 'db', LIB_NAME.replace(OUT_DIR, '')[:-3] + 'db')])
|
||||
|
||||
|
||||
if found == 0:
|
||||
|
||||
|
|
@ -603,6 +606,8 @@ def parse_characterizer_csv(f, pages):
|
|||
['.html', 'This datasheet', '<a href="{0}.{1}">{0}.{1}</a>'.format(OPTS.output_name, 'html')])
|
||||
new_sheet.dlv_table.add_row(
|
||||
['.lib', 'Synthesis models', '<a href="{1}">{1}</a>'.format(LIB_NAME, LIB_NAME.replace(OUT_DIR, ''))])
|
||||
new_sheet.dlv_table.add_row(
|
||||
['.db', 'Compiled .lib', '<a href="{1}">{1}</a>'.format(LIB_NAME[:-3] + 'db', LIB_NAME.replace(OUT_DIR, '')[:-3] + 'db')])
|
||||
new_sheet.dlv_table.add_row(
|
||||
['.py', 'OpenRAM configuration file', '<a href="{0}.{1}">{0}.{1}</a>'.format(OPTS.output_name, 'py')])
|
||||
new_sheet.dlv_table.add_row(
|
||||
|
|
|
|||
|
|
@ -22,27 +22,38 @@ class table_gen:
|
|||
html += '</thead>'
|
||||
return html
|
||||
|
||||
def gen_table_body(self):
|
||||
def gen_table_body(self,comments):
|
||||
"""generate html body (used after gen_table_head)"""
|
||||
html = ''
|
||||
|
||||
html += '<tbody>'
|
||||
html += '<tr>'
|
||||
for row in self.rows[1:]:
|
||||
html += '<tr>'
|
||||
for col in row:
|
||||
html += '<td>' + str(col) + '</td>'
|
||||
html += '</tr>'
|
||||
|
||||
if row[0] not in comments:
|
||||
html += '<tr>'
|
||||
for col in row:
|
||||
html += '<td>' + str(col) + '</td>'
|
||||
html += '</tr>'
|
||||
|
||||
else:
|
||||
html += '<!--'+row[0]+'<tr>'
|
||||
for col in row:
|
||||
html += '<td>' + str(col) + '</td>'
|
||||
html += '</tr>'+row[0]+'-->'
|
||||
|
||||
html += '</tr>'
|
||||
html += '</tbody>'
|
||||
return html
|
||||
def sort(self):
|
||||
self.rows[1:] = sorted(self.rows[1:], key=lambda x : x[0])
|
||||
|
||||
def to_html(self):
|
||||
def to_html(self,comments):
|
||||
"""writes table_gen object to inline html"""
|
||||
html = ''
|
||||
html += '<table id= \"'+self.table_id+'\">'
|
||||
html += self.gen_table_head()
|
||||
html += self.gen_table_body()
|
||||
html += '</table>'
|
||||
html += self.gen_table_body(comments)
|
||||
html += '</table>\n'
|
||||
|
||||
return html
|
||||
|
|
|
|||
Loading…
Reference in New Issue