mirror of
https://github.com/TinyTapeout/tt-support-tools.git
synced 2026-11-03 04:36:09 +01:00
feat(configure): support for brotli-compressed GDS files
Recently, we started compressing GDS files larger than 25 MB due to GitHub REST API blob size limitations.
This commit is contained in:
@@ -3,6 +3,7 @@ name = "tt-support-tools"
|
|||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
dynamic = ["version"]
|
dynamic = ["version"]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"brotli",
|
||||||
"CairoSVG",
|
"CairoSVG",
|
||||||
"chevron",
|
"chevron",
|
||||||
"cocotb",
|
"cocotb",
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#
|
#
|
||||||
anyio==4.4.0
|
anyio==4.4.0
|
||||||
# via httpx
|
# via httpx
|
||||||
|
brotli==1.1.0
|
||||||
|
# via tt-support-tools (pyproject.toml)
|
||||||
cairocffi==1.7.0
|
cairocffi==1.7.0
|
||||||
# via cairosvg
|
# via cairosvg
|
||||||
cairosvg==2.7.1
|
cairosvg==2.7.1
|
||||||
|
|||||||
+16
@@ -5,6 +5,7 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
from typing import List, Set
|
from typing import List, Set
|
||||||
|
|
||||||
|
import brotli # type: ignore
|
||||||
import git
|
import git
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
@@ -19,6 +20,15 @@ def copy_print(src: str, dest: str):
|
|||||||
shutil.copy2(src, dest)
|
shutil.copy2(src, dest)
|
||||||
|
|
||||||
|
|
||||||
|
def copy_print_decompress(src: str, dest: str):
|
||||||
|
os.makedirs(os.path.dirname(dest), exist_ok=True)
|
||||||
|
with open(src, "rb") as f:
|
||||||
|
data = f.read()
|
||||||
|
with open(dest, "wb") as f:
|
||||||
|
f.write(brotli.decompress(data))
|
||||||
|
logging.info(f" -> {dest} (decompressed)")
|
||||||
|
|
||||||
|
|
||||||
def copy_print_glob(pattern: str, dest_dir: str):
|
def copy_print_glob(pattern: str, dest_dir: str):
|
||||||
for file in glob.glob(pattern):
|
for file in glob.glob(pattern):
|
||||||
copy_print(file, os.path.join(dest_dir, os.path.basename(file)))
|
copy_print(file, os.path.join(dest_dir, os.path.basename(file)))
|
||||||
@@ -187,6 +197,12 @@ class ShuttleConfig:
|
|||||||
def copy_macros(self):
|
def copy_macros(self):
|
||||||
logging.info("copying macros to tt_top:")
|
logging.info("copying macros to tt_top:")
|
||||||
copy_print_glob("projects/*/*.gds", "tt-multiplexer/ol2/tt_top/gds")
|
copy_print_glob("projects/*/*.gds", "tt-multiplexer/ol2/tt_top/gds")
|
||||||
|
# Find all the ".gds.br" files, decompress them and copy them to the destination
|
||||||
|
for file in glob.glob("projects/*/*.gds.br"):
|
||||||
|
decompressed_name = os.path.splitext(os.path.basename(file))[0]
|
||||||
|
copy_print_decompress(
|
||||||
|
file, os.path.join("tt-multiplexer/ol2/tt_top/gds", decompressed_name)
|
||||||
|
)
|
||||||
copy_print_glob("projects/*/*.lef", "tt-multiplexer/ol2/tt_top/lef")
|
copy_print_glob("projects/*/*.lef", "tt-multiplexer/ol2/tt_top/lef")
|
||||||
copy_print_glob("projects/*/*.v", "tt-multiplexer/ol2/tt_top/verilog")
|
copy_print_glob("projects/*/*.v", "tt-multiplexer/ol2/tt_top/verilog")
|
||||||
macros = ["tt_um_chip_rom", "tt_ctrl", "tt_mux"]
|
macros = ["tt_um_chip_rom", "tt_ctrl", "tt_mux"]
|
||||||
|
|||||||
Reference in New Issue
Block a user