| # Copyright Google LLC, 2022 |
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| load("@ot_python_deps//:requirements.bzl", "requirement") |
| load("@rules_python//python:defs.bzl", "py_binary") |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| exports_files(glob(["**"])) |
| |
| genrule( |
| name = "matcha_version_file", |
| outs = ["matcha_version.txt"], |
| cmd = """awk '/MATCHA_BUILD_GIT_VERSION/ { print $$2 }' bazel-out/volatile-status.txt > $@""", |
| stamp = 1, # this provides volatile-status.txt |
| ) |
| |
| # 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/ip:all_hjson_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", |
| ], |
| ) |
| |
| py_binary( |
| name = "image_to_c", |
| srcs = [ |
| "image_to_c.py", |
| ], |
| data = [ |
| "//sw/device/examples/testdata/hps_images:image_files", |
| ], |
| deps = [ |
| requirement("Pillow"), |
| ], |
| ) |
| |
| py_binary( |
| name = "run_live_cam", |
| srcs = [ |
| "run_live_cam.py", |
| ], |
| args = [ |
| "--opentitantool_bin=$(location @lowrisc_opentitan//sw/host/opentitantool)", |
| "--opentitantool_conf=$(location @lowrisc_opentitan//sw/host/opentitanlib:src/app/config/nexus.json)", |
| ], |
| data = [ |
| "@lowrisc_opentitan//sw/host/opentitanlib:src/app/config/nexus.json", |
| "@lowrisc_opentitan//sw/host/opentitantool", |
| ], |
| deps = [ |
| requirement("Pillow"), |
| requirement("pyserial"), |
| ], |
| ) |
| |
| py_binary( |
| name = "gen_vmem_256", |
| srcs = [ |
| "gen_vmem_256.py", |
| ], |
| ) |
| |
| filegroup( |
| name = "topgen_tpl_files", |
| srcs = glob(["topgen/**/*.tpl"]) + [ |
| "@lowrisc_opentitan//util/reggen:tpl_files", |
| "@lowrisc_opentitan//util/tlgen:tpl_files", |
| "@lowrisc_opentitan//util/topgen:tpl_files", |
| ], |
| ) |