diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..304f4c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +#python +__pycache__/ +*.pyc diff --git a/environment.sh b/environment.sh new file mode 100644 index 0000000..25448fe --- /dev/null +++ b/environment.sh @@ -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}" diff --git a/gatemate/__init__.py b/gatemate/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/gatemate/die.py b/gatemate/die.py new file mode 100644 index 0000000..b73f0fd --- /dev/null +++ b/gatemate/die.py @@ -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 + diff --git a/tools/__init__.py b/tools/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tools/html_all.py b/tools/html_all.py new file mode 100644 index 0000000..697aa80 --- /dev/null +++ b/tools/html_all.py @@ -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 = """ + +
+Project Peppercorn is a project to document the GateMate bitstream and internal architecture.
+This repository contains HTML documentation automatically generated from the +Project Peppercorn database. +Data generated includes tilemap data and bitstream data for many tile types. Click on any tile to see its bitstream +documentation. +
+Licensed under a very permissive CC0 1.0 Universal license.
+ + +""" + +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"| ", file=f)
+ for tile in tloc:
+ print(f" {tile[0]} ", file=f)
+ print("{tile[1]} | ", file=f)
+ print("