from table_gen import *
import os
import base64
from globals import OPTS
class datasheet():
"""
Defines the layout,but not the data, of the html datasheet
"""
def __init__(self, identifier):
self.name = identifier
self.html = ""
def generate_html(self):
"""
Generates html tables using flask-table
"""
with open(os.path.abspath(os.environ.get("OPENRAM_HOME")) + '/datasheet/assets/datasheet.css', 'r') as datasheet_css:
# css styling is kept in a seperate file
self.html += datasheet_css.read()
with open(OPTS.openram_temp + "/datasheet.info") as info:
self.html += ''
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())
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())
self.html += ''.format(str(vlsi_logo)[
2:-1])
self.html += '
' + \ self.name + '.html' + '
' self.html += 'Compiled at: ' + self.time + '
' self.html += '' + \ 'DRC errors: ' + str(self.DRC) + '
' self.html += '' + \ 'LVS errors: ' + str(self.LVS) + '
' self.html += '' + \ 'Git commit id: ' + str(self.git_id) + '
' 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() self.html += 'Operating Conditions
' # self.html += operating_conditions(self.operating,table_id='data').__html__() self.html += self.operating_table.to_html() self.html += 'Timing and Current Data
' model = '' if self.ANALYTICAL_MODEL: model = "analytical model: results may not be percise" else: model = "spice characterizer" self.html += 'Using '+model+'
' # self.html += timing_and_current_data(self.timing,table_id='data').__html__() self.html += self.timing_table.to_html() self.html += 'Characterization Corners
' # self.html += characterization_corners(self.corners,table_id='data').__html__() self.html += self.corners_table.to_html() self.html += 'Deliverables
' # self.html += deliverables(self.dlv,table_id='data').__html__().replace('<','<').replace('"','"').replace('>',">") self.html += self.dlv_table.to_html()