feat(datasheet): automatically determine appropriate pinout table

This is determined by looking at the `pdk` key in the config. If `pdk` doesn't exist, `id` will be used (assuming that the structure of the shuttle ID follows ttX where X=[sky, ihp, gf]). If any part fails, it will fall back to `openframe_sky130`.

The pinout can also be manually controlled by setting the `datasheet_config.pinout` key in the shuttle config, and that will be used verbatim. Note that `datasheet_config.pinout` is not checked, so it *must* be exact, otherwise it will cause the datasheet build to fail.
This commit is contained in:
Kristaps Jurkans
2025-12-03 19:24:47 +00:00
parent 6d483e5574
commit ae3f9b2f44
2 changed files with 52 additions and 3 deletions
+7 -1
View File
@@ -13,7 +13,13 @@ class ArtworkEntryType(TypedDict):
class DatasheetConfig(TypedDict): class DatasheetConfig(TypedDict):
"""TypedDict for the datasheet config within Tiny Tapeout's config.yaml file""" """TypedDict for the datasheet config within Tiny Tapeout's config.yaml file"""
pinout: Literal["caravel", "openframe"] pinout: Literal[
"caravel",
"openframe",
"openframe_sky130",
"customframe_ihp_sg13g2",
"customframe_gf180mcud",
]
theme_override_colour: str theme_override_colour: str
show_chip_viewer: bool show_chip_viewer: bool
link_disable_colour: bool link_disable_colour: bool
+45 -2
View File
@@ -335,7 +335,7 @@ class DocsHelper:
Prepare the datasheet.typ file with info from `config.yaml` Prepare the datasheet.typ file with info from `config.yaml`
The following keys can be used to configure the datasheet: The following keys can be used to configure the datasheet:
- `pinout`: set what pinout table is shown in multiplexer chapter (caravel or openframe) - `pinout`: set what pinout table is shown in multiplexer chapter (see DatasheetConfig.pinout in config.py)
- `theme_override_colour`: set a custom colour for the datasheet (rgb object) - `theme_override_colour`: set a custom colour for the datasheet (rgb object)
- `show_chip_viewer`*: toggle the chip viewer QR code (boolean) - `show_chip_viewer`*: toggle the chip viewer QR code (boolean)
- `link_disable_colour`: disable link colouring (boolean) - `link_disable_colour`: disable link colouring (boolean)
@@ -399,9 +399,52 @@ class DocsHelper:
) )
else: else:
if "pinout" in datasheet_config:
content["if_pinout"] = True content["if_pinout"] = True
if "pinout" in datasheet_config:
content["pinout"] = shuttle_config["datasheet_config"]["pinout"] content["pinout"] = shuttle_config["datasheet_config"]["pinout"]
logging.info(
f"using pinout config verbatim ('{content['pinout']}')"
)
else:
# determine appropriate pinout table from pdk first, otherwise fall back to shuttle id
if "pdk" in shuttle_config:
match shuttle_config["pdk"]:
case "sky130A":
content["pinout"] = "openframe_sky130"
case "ihp-sg13g2":
content["pinout"] = "customframe_ihp_sg13g2"
case "gf180mcuD":
content["pinout"] = "customframe_gf180mcud"
case _:
logging.warning(
f"unable to determine appropriate pinout from PDK, falling back to 'openframe_sky130'"
)
content["pinout"] = "openframe_sky130"
logging.info(f"PDK defined, using pinout '{content['pinout']}'")
else:
if shuttle_config["id"].startswith("ttsky"):
content["pinout"] = "openframe_sky130"
elif shuttle_config["id"].startswith("ttihp"):
content["pinout"] = "customframe_ihp_sg13g2"
elif shuttle_config["id"].startswith("ttgf"):
content["pinout"] = "customframe_gf180mcud"
else:
logging.warning(
f"unable to determine appropriate pinout, falling back to 'openframe_sky130'"
)
logging.warning(
f"either define 'pinout' or 'pdk' in shuttle config"
)
content["pinout"] = "openframe_sky130"
logging.info(
f"PDK not defined, using '{content['pinout']}' pinout"
)
if "theme_override_colour" in datasheet_config: if "theme_override_colour" in datasheet_config:
content["if_theme_override_colour"] = True content["if_theme_override_colour"] = True