| # Copyright 2023 Google LLC |
| |
| load("@lowrisc_opentitan//rules:opentitan.bzl", "bin_to_vmem") |
| load("//rules:matcha.bzl", "bin_to_c_file") |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| name = "kelvin_model_ml" |
| |
| bin_name = "{}_bin".format(name) |
| |
| # Binary is built from //sw/device/tests/kelvin/hps-c-port |
| bin_to_c_file( |
| name = bin_name, |
| srcs = ["//sw/device/tests/kelvin/hps-c-port:kelvin_hps_model.bin"], |
| var_name = "kelvin_bin", |
| ) |
| |
| vmem_32_name = "{}.32.vmem".format(name) |
| |
| vmem_256_name = "{}.256.vmem".format(name) |
| |
| vmem_name = "{}_vmem".format(name) |
| |
| bin_to_vmem( |
| name = vmem_32_name, |
| bin = "//sw/device/tests/kelvin/hps-c-port:kelvin_hps_model.bin", |
| word_size = 32, |
| ) |
| |
| genrule( |
| name = vmem_name, |
| srcs = [vmem_32_name], |
| outs = [vmem_256_name], |
| cmd = """ |
| $(location //util:gen_vmem_256) \ |
| --input=$< \ |
| --output=$@ |
| """, |
| tools = ["@matcha//util:gen_vmem_256"], |
| ) |
| |
| filegroup( |
| name = name, |
| srcs = [ |
| ":{}".format(bin_name), |
| ":{}".format(vmem_name), |
| ], |
| ) |