#!/usr/bin/env python3 # # prjpeppercorn -- GateMate FPGAs Bitstream Documentation and Tools # # Copyright (C) 2024 The Project Peppercorn Authors. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # import sys import argparse import chip 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): match ttype: case "CPE": colour = "#ACC8E6" case "SB_BIG": colour = "#9CC763" case "SB_SML": colour = "#F8EA56" case "GPIO": colour = "#B699D4" case "IM": colour = "#FFC51F" case "OM": colour = "#D19537" case "IOES": colour = "#6D6D6D" case "LES" | "RES" | "TES" | "BES": colour = "#FDD3D3" case "PLL": colour = "#FF7ABE" case "SERDES": colour = "#64FF65" case "CFG_CTRL": colour = "#999999" case _: colour = "#FFFFFF" return colour def main(argv): args = parser.parse_args(argv[1:]) ch = chip.get_device(args.device) max_row = ch.max_row() max_col = ch.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): for type in ch.get_tile_types(x,y): tiles[max_row-y][x+2].append((f"{x},{y}", type)) f = args.outfile print( f"""
| ", file=f)
for tile in tloc:
print(f" {tile[0]} ", file=f)
print("{tile[1]} | ", file=f)
print("