| # Copyright Google LLC, 2022 |
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| load("@rules_python//python:defs.bzl", "py_binary") |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| exports_files(glob(["**"])) |
| |
| # To execute this binary: |
| # bazel run //util:topgen_matcha -- -t <top hjson> [-r] -o <output dir> [other flags] |
| py_binary( |
| name = "topgen_matcha", |
| srcs = [ |
| "topgen_matcha.py", |
| "topgen_utils/toputils.py", |
| ], |
| # This target assumes all the top_matcha hjson files are already up-to-date. |
| # The goal is to generate the rtl, dv, reg files. |
| data = [ |
| ":topgen_tpl_files", |
| "//hw/top_matcha/ip:all_hjson_files", |
| "@lowrisc_opentitan//hw/ip:all_files", |
| "@lowrisc_opentitan//util:BUILD", |
| ], |
| env = {"OPENTITAN_TOP": "$(location @lowrisc_opentitan//util:BUILD)/../.."}, |
| imports = ["../external/lowrisc_opentitan/util/"], |
| deps = [ |
| "@lowrisc_opentitan//util/design/mubi:prim_mubi", |
| "@lowrisc_opentitan//util/ipgen", |
| "@lowrisc_opentitan//util/reggen:gen_cheader", |
| "@lowrisc_opentitan//util/reggen:gen_rtl", |
| "@lowrisc_opentitan//util/reggen:gen_sec_cm_testplan", |
| "@lowrisc_opentitan//util/tlgen", |
| "@lowrisc_opentitan//util/topgen", |
| "@lowrisc_opentitan//util/topgen:c_test", |
| "@lowrisc_opentitan//util/topgen:gen_dv", |
| ], |
| ) |
| |
| filegroup( |
| name = "topgen_tpl_files", |
| srcs = glob(["topgen/**/*.tpl"]) + [ |
| "@lowrisc_opentitan//util/reggen:tpl_files", |
| "@lowrisc_opentitan//util/topgen:tpl_files", |
| "@lowrisc_opentitan//util/tlgen:tpl_files", |
| ], |
| ) |