Start modeling chip die
This commit is contained in:
parent
fe8e82cdd7
commit
5520da160e
|
|
@ -0,0 +1,3 @@
|
|||
#python
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPT_PATH=$(readlink -f "${BASH_SOURCE:-$0}")
|
||||
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
|
||||
PYTHONLIBS_DIR="${SCRIPT_DIR}/gatemate"
|
||||
export PYTHONPATH="${PYTHONLIBS_DIR}:${PYTHONPATH}"
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
def max_row():
|
||||
return 131
|
||||
|
||||
def max_col():
|
||||
return 163
|
||||
|
||||
def is_sb_big(x,y):
|
||||
if (x>=-1 and x<=162 and y>=-1 and y<=130):
|
||||
if (x+1) % 2 == 1 and (y+1) % 2 == 1:
|
||||
return False if (x+1) % 4 == (y+1) % 4 else True
|
||||
if (x+1) % 2 == 0 and (y+1) % 2 == 0:
|
||||
return False if (x+1) % 4 != (y+1) % 4 else True
|
||||
return False
|
||||
|
||||
def is_sb_sml(x,y):
|
||||
if (x>=-1 and x<=162 and y>=-1 and y<=130):
|
||||
if (x+1) % 2 == 1 and (y+1) % 2 == 1:
|
||||
return True if (x+1) % 4 == (y+1) % 4 else False
|
||||
if (x+1) % 2 == 0 and (y+1) % 2 == 0:
|
||||
return True if (x+1) % 4 != (y+1) % 4 else False
|
||||
return False
|
||||
|
||||
def is_cpe(x,y):
|
||||
return x>=1 and x<=160 and y>=1 and y<=128
|
||||
|
||||
def is_outmux(x,y):
|
||||
return is_cpe(x,y) and (x+1) % 2 == (y+1) % 2
|
||||
|
||||
def is_edge_left(x,y):
|
||||
return x==-2 and y>=1 and y<=130
|
||||
|
||||
def is_edge_right(x,y):
|
||||
return x==max_col() and y>=1 and y<=128
|
||||
|
||||
def is_edge_bottom(x,y):
|
||||
return y==-2 and x>=-1 and x<=162
|
||||
|
||||
def is_edge_top(x,y):
|
||||
return y==max_row() and x>=1 and x<=162
|
||||
|
||||
def is_edge_io(x,y):
|
||||
if (y==-2 and x>=5 and x<=40): # GPIO_S3
|
||||
return True
|
||||
if (y==-2 and x>=57 and x<=92): # GPIO_S1
|
||||
return True
|
||||
if (y==-2 and x>=101 and x<=136): # GPIO_S2
|
||||
return True
|
||||
if (x==-2 and y>=25 and y<=60): # GPIO_W1
|
||||
return True
|
||||
if (x==-2 and y>=69 and y<=104): # GPIO_W2
|
||||
return True
|
||||
if (x==max_col() and y>=25 and y<=50): # GPIO_E1
|
||||
return True
|
||||
if (x==max_col() and y>=69 and y<=104): # GPIO_E2
|
||||
return True
|
||||
if (y==max_row() and x>=57 and x<=92): # GPIO_N1
|
||||
return True
|
||||
if (y==max_row() and x>=101 and x<=136): # GPIO_N2
|
||||
return True
|
||||
|
||||
def is_gpio(x,y):
|
||||
if is_edge_io(x,y):
|
||||
if (y==-2 or y==max_row()):
|
||||
return x % 2==1
|
||||
if (x==-2 or x==max_col()):
|
||||
return y % 2==1
|
||||
return False
|
||||
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os, time
|
||||
from os import path
|
||||
from string import Template
|
||||
import html_tilegrid
|
||||
import shutil
|
||||
|
||||
GM_DOCS_INDEX = """
|
||||
<html>
|
||||
<head>
|
||||
<title>Project Peppercorn HTML Documentation</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Project Peppercorn HTML Documentation</h1>
|
||||
<p>Project Peppercorn is a project to document the GateMate bitstream and internal architecture.</p>
|
||||
<p>This repository contains HTML documentation automatically generated from the
|
||||
<a href="https://github.com/YosysHQ/prjpeppercorn">Project Peppercorn</a> database.
|
||||
Data generated includes tilemap data and bitstream data for many tile types. Click on any tile to see its bitstream
|
||||
documentation.
|
||||
</p>
|
||||
<hr/>
|
||||
$docs_toc
|
||||
<hr/>
|
||||
<p>Licensed under a very permissive <a href="COPYING">CC0 1.0 Universal</a> license.</p>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
def main():
|
||||
shutil.rmtree("work_html", ignore_errors=True)
|
||||
os.mkdir("work_html")
|
||||
commit_hash = "" #database.get_db_commit()
|
||||
build_dt = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
docs_toc = ""
|
||||
family = "CCGM1"
|
||||
print("Family: " + family)
|
||||
docs_toc += f"<h3>{family.upper()} Family</h3>"
|
||||
docs_toc += "<h4>Bitstream Documentation</h4>"
|
||||
docs_toc += "<ul>"
|
||||
for device in ["A1"]:
|
||||
print("Device: " + device)
|
||||
docs_toc += f'<li><a href="{device}.html">{device} Documentation</a></li>'
|
||||
html_tilegrid.main(["html_tilegrid", family, device, path.join("work_html",device + ".html")])
|
||||
docs_toc += "</ul>"
|
||||
index_html = Template(GM_DOCS_INDEX).substitute(
|
||||
datetime=build_dt,
|
||||
commit=commit_hash,
|
||||
docs_toc=docs_toc
|
||||
)
|
||||
with open(path.join("work_html", "index.html"), 'w') as f:
|
||||
f.write(index_html)
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import argparse
|
||||
import die
|
||||
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('family', type=str,
|
||||
help="FPGA family (e.g. CCGM1)")
|
||||
parser.add_argument('device', type=str,
|
||||
help="FPGA device (e.g. A1)")
|
||||
parser.add_argument('outfile', type=argparse.FileType('w'),
|
||||
help="output HTML file")
|
||||
|
||||
|
||||
def get_colour(ttype):
|
||||
colour = "#FFFFFF"
|
||||
if ttype.startswith("SB_BIG"):
|
||||
colour = "#73fc03"
|
||||
elif ttype.startswith("SB_SML"):
|
||||
colour = "#F0FC03"
|
||||
elif ttype.startswith("GPIO"):
|
||||
colour = "#88FFFF"
|
||||
elif ttype.startswith("INMUX"):
|
||||
colour = "#FF9040"
|
||||
elif ttype.startswith("OUTMUX"):
|
||||
colour = "#9040FF"
|
||||
elif ttype.startswith("EDGE_IO"):
|
||||
colour = "#6d6d6d"
|
||||
elif ttype.startswith("EDGE_"):
|
||||
colour = "#DDDDDD"
|
||||
else:
|
||||
colour = "#888888"
|
||||
return colour
|
||||
|
||||
def main(argv):
|
||||
args = parser.parse_args(argv[1:])
|
||||
|
||||
max_row = die.max_row()
|
||||
max_col = die.max_col()
|
||||
tiles = []
|
||||
|
||||
for i in range(-2, max_row+1):
|
||||
row = []
|
||||
for j in range(-2, max_col+1):
|
||||
row.append([])
|
||||
tiles.append(row)
|
||||
|
||||
for y in range(-2, max_row+1):
|
||||
for x in range(-2, max_col+1):
|
||||
if die.is_sb_big(x,y):
|
||||
tiles[max_row-y][x+2].append((f"{x},{y}", "SB_BIG"))
|
||||
if die.is_sb_sml(x,y):
|
||||
tiles[max_row-y][x+2].append((f"{x},{y}", "SB_SML"))
|
||||
if die.is_cpe(x,y):
|
||||
tiles[max_row-y][x+2].append((f"{x},{y}", "CPE"))
|
||||
tiles[max_row-y][x+2].append((f"{x},{y}", "INMUX"))
|
||||
if die.is_outmux(x,y):
|
||||
tiles[max_row-y][x+2].append((f"{x},{y}", "OUTMUX"))
|
||||
if die.is_edge_left(x,y):
|
||||
tiles[max_row-y][x+2].append((f"{x},{y}", "EDGE_L"))
|
||||
if die.is_edge_right(x,y):
|
||||
tiles[max_row-y][x+2].append((f"{x},{y}", "EDGE_R"))
|
||||
if die.is_edge_bottom(x,y):
|
||||
tiles[max_row-y][x+2].append((f"{x},{y}", "EDGE_B"))
|
||||
if die.is_edge_top(x,y):
|
||||
tiles[max_row-y][x+2].append((f"{x},{y}", "EDGE_T"))
|
||||
|
||||
if die.is_gpio(x,y):
|
||||
tiles[max_row-y][x+2].append((f"{x},{y}", "GPIO"))
|
||||
if die.is_edge_io(x,y):
|
||||
tiles[max_row-y][x+2].append((f"{x},{y}", "EDGE_IO"))
|
||||
|
||||
f = args.outfile
|
||||
print(
|
||||
f"""<html>
|
||||
<head><title>{args.family} Tiles</title></head>
|
||||
<body>
|
||||
<h1>{args.device} Tilegrid</h1>
|
||||
<table style='font-size: 8pt; border: 2px solid black; text-align: center'>
|
||||
""", file=f)
|
||||
for trow in tiles:
|
||||
print("<tr>", file=f)
|
||||
row_max_height = 0
|
||||
for tloc in trow:
|
||||
row_max_height = max(row_max_height, len(tloc))
|
||||
row_height = max(75, 30 * row_max_height)
|
||||
for tloc in trow:
|
||||
print(f"<td style='border: 2px solid black; height: {row_height}px'>", file=f)
|
||||
for tile in tloc:
|
||||
print(f"<div style='height: {100 / len(tloc)}%; background-color: {get_colour(tile[1])}'><em>{tile[0]}</em><br/><strong>{tile[1]}</strong></div>", file=f)
|
||||
print("</td>", file=f)
|
||||
print("</tr>", file=f)
|
||||
print("</table></body></html>", file=f)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
||||
Loading…
Reference in New Issue