OpenRAM/compiler/datasheet/datasheet.py

78 lines
4.0 KiB
Python
Raw Normal View History

from table_gen import *
import os
2018-12-06 19:13:28 +01:00
import base64
from globals import OPTS
2018-10-12 01:03:05 +02:00
2019-01-16 04:47:48 +01:00
2018-10-12 01:03:05 +02:00
class datasheet():
"""
Defines the layout,but not the data, of the html datasheet
"""
2019-01-16 04:47:48 +01:00
def __init__(self, identifier):
2018-10-12 01:03:05 +02:00
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:
2019-01-16 04:47:48 +01:00
# css styling is kept in a seperate file
self.html += datasheet_css.read()
with open(OPTS.openram_temp + "/datasheet.info") as info:
self.html += '<!--'
for row in info:
self.html += row
# for item in self.description:
# self.html += item + ','
2019-01-16 04:47:48 +01:00
self.html += '-->'
2018-12-06 19:13:28 +01:00
vlsi_logo = 0
2019-01-16 04:47:48 +01:00
with open(os.path.abspath(os.environ.get("OPENRAM_HOME")) + '/datasheet/assets/vlsi_logo.png', "rb") as image_file:
2018-12-06 19:13:28 +01:00
vlsi_logo = base64.b64encode(image_file.read())
2018-12-06 19:13:28 +01:00
openram_logo = 0
2019-01-16 04:47:48 +01:00
with open(os.path.abspath(os.environ.get("OPENRAM_HOME")) + '/datasheet/assets/openram_logo_placeholder.png', "rb") as image_file:
2018-12-06 19:13:28 +01:00
openram_logo = base64.b64encode(image_file.read())
2019-01-16 04:47:48 +01:00
self.html += '<a href="https://vlsida.soe.ucsc.edu/"><img src="data:image/png;base64,{0}" alt="VLSIDA"></a>'.format(str(vlsi_logo)[
2:-1])
2018-12-06 19:13:28 +01:00
2019-01-16 04:47:48 +01:00
self.html += '<p style="font-size: 18px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">' + \
self.name + '.html' + '</p>'
self.html += '<p style="font-size: 18px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Compiled at: ' + self.time + '</p>'
self.html += '<p style="font-size: 18px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">' + \
'DRC errors: ' + str(self.DRC) + '</p>'
self.html += '<p style="font-size: 18px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">' + \
'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>'
2019-01-16 04:47:48 +01:00
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()
2019-01-16 04:47:48 +01:00
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 += '<p style="font-size: 26px;font-family: Trebuchet MS, Arial, Helvetica, sans-serif;">Timing and Current Data</p>'
model = ''
if self.ANALYTICAL_MODEL:
model = "analytical model: results may not be percise"
else:
model = "spice characterizer"
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 += '<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()
2019-01-16 04:47:48 +01:00
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()