# See LICENSE for licensing information.
#
# Copyright (c) 2016-2024 Regents of the University of California and The Board
# of Regents for the Oklahoma Agricultural and Mechanical College
# (acting for and on behalf of Oklahoma State University)
# All rights reserved.
#
import os
import base64
from openram import OPTS
from .table_gen import *
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()
if OPTS.output_datasheet_info:
datasheet_path = OPTS.output_path
else:
datasheet_path = OPTS.openram_temp
with open(datasheet_path + "/datasheet.info") as info:
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.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 += ''.format(str(vlsi_logo)[2:-1], str(openram_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) + '
' # print port table self.html += 'Ports and Configuration
' self.html += self.io_table.to_html(comments) # print operating condidition information self.html += 'Operating Conditions
' self.html += self.operating_table.to_html(comments) # check if analytical model is being used self.html += 'Timing Data
' model = '' if self.ANALYTICAL_MODEL == 'True': model = "analytical model: results may not be precise" else: model = "spice characterizer" # display timing data self.html += 'Using '+model+'
' self.html += self.timing_table.to_html(comments) # display power data self.html += 'Power Data
' self.html += self.power_table.to_html(comments) # display corner information self.html += 'Characterization Corners
' self.html += self.corners_table.to_html(comments) # display deliverables table self.html += 'Deliverables
' self.dlv_table.sort() self.html += self.dlv_table.to_html(comments)