blob: 8c5b5f281a77ef15fe6f75592945b519c212e177 [file] [log] [blame]
# Copyright 2023 Google LLC
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
load("@lowrisc_opentitan//rules:fusesoc.bzl", "fusesoc_build")
load("@lowrisc_opentitan//rules:splice.bzl", "bitstream_splice")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
package(default_visibility = ["//visibility:public"])
# The readmem directives in the fusesoc-ized build tree will be in the subdir
# ${build_root}/src/lowrisc_prim_util_memload_0/rtl/prim_util_memload.svh,
# and ${build_root} will be a subdirectory called `build.fpga_nexus` inside of
# bazel-out/k8-{configname}/bin/hw/bitstream/vivado.
# Therefore, the relative path between prim_util_memload.svh and the project-root
# relative $(location ...) resolved labels is up 10 subdirectories.
_PREFIX = "../../../../../../../../../.."
_FPGA_NEXUS_TESTROM = "//sw/device/lib/testing/test_rom:test_rom_fpga_nexus_scr_vmem"
_FPGA_NEXUS_OTP_RMA = "//hw/top_matcha/data:otp_img_rma"
_FPGA_NEXUS_TESTROM_PATH = "{}/$(location {})".format(_PREFIX, _FPGA_NEXUS_TESTROM)
_FPGA_NEXUS_OTP_RMA_PATH = "{}/$(location {})".format(_PREFIX, _FPGA_NEXUS_OTP_RMA)
# Note: all of the targets are tagged with "manual" to prevent them from being
# matched by bazel wildcards like "//...". In order to build the bitstream,
# you need to ask for it directly or by dependency via another rule, such as
# a functest.
fusesoc_build(
name = "fpga_nexus",
testonly = True,
srcs = [
"//hw:all_files",
_FPGA_NEXUS_TESTROM,
_FPGA_NEXUS_OTP_RMA,
],
cores = ["//:cores"],
data = ["@lowrisc_opentitan//hw/ip/otbn:all_files"],
flags = [
"--BootRomInitFile=" + _FPGA_NEXUS_TESTROM_PATH,
"--OtpCtrlMemInitFile=" + _FPGA_NEXUS_OTP_RMA_PATH,
],
output_groups = {
"bitstream": ["synth-vivado/google_systems_chip_matcha_nexus_0.1.bit"],
"rom_mmi": ["synth-vivado/rom.mmi"],
"otp_mmi": ["synth-vivado/otp.mmi"],
"logs": [
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/synth_1/runme.log",
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/impl_1/runme.log",
"synth-vivado/vivado.log",
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/synth_1/chip_matcha_nexus_utilization_synth.rpt",
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/impl_1/chip_matcha_nexus_power_routed.rpt",
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/impl_1/chip_matcha_nexus_utilization_placed.rpt",
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/impl_1/chip_matcha_nexus_bus_skew_routed.rpt",
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/impl_1/chip_matcha_nexus_drc_routed.rpt",
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/impl_1/chip_matcha_nexus_io_placed.rpt",
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/impl_1/chip_matcha_nexus_timing_summary_routed.rpt",
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/impl_1/chip_matcha_nexus_control_sets_placed.rpt",
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/impl_1/chip_matcha_nexus_methodology_drc_routed.rpt",
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/impl_1/chip_matcha_nexus_drc_opted.rpt",
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/impl_1/chip_matcha_nexus_clock_utilization_routed.rpt",
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/impl_1/chip_matcha_nexus_route_status.rpt",
"synth-vivado/google_systems_chip_matcha_nexus_0.1.runs/impl_1/utilization_kelvin.rpt",
],
},
systems = ["google:systems:chip_matcha_nexus"],
tags = ["manual"],
target = "synth",
use_system_fusesoc = True,
)
filegroup(
name = "fpga_nexus_test_rom",
testonly = True,
srcs = [":fpga_nexus"],
output_group = "bitstream",
tags = ["manual"],
)
filegroup(
name = "rom_mmi",
testonly = True,
srcs = [":fpga_nexus"],
output_group = "rom_mmi",
tags = ["manual"],
)
filegroup(
name = "otp_mmi",
testonly = True,
srcs = [":fpga_nexus"],
output_group = "otp_mmi",
tags = ["manual"],
)
filegroup(
name = "logs",
testonly = True,
srcs = [":fpga_nexus"],
output_group = "logs",
tags = ["manual"],
)
bitstream_splice(
name = "fpga_nexus_mask_test_rom",
testonly = True,
src = ":fpga_nexus_test_rom",
data = "//sw/device/lib/testing/test_rom:test_rom_fpga_nexus_scr_vmem",
meminfo = ":rom_mmi",
tags = ["manual"],
)
bitstream_splice(
name = "fpga_nexus_mask_puppeteer_rom",
testonly = True,
src = ":fpga_nexus_test_rom",
data = "//sw/device/lib/testing/test_rom:puppeteer_rom_fpga_nexus_scr_vmem",
meminfo = ":rom_mmi",
tags = ["manual"],
)
bitstream_splice(
name = "fpga_nexus_mask_test_rom_no_otp",
testonly = True,
src = ":fpga_nexus_test_rom",
data = "//sw/device/lib/testing/test_rom:test_rom_no_otp_fpga_nexus_scr_vmem",
meminfo = ":rom_mmi",
tags = ["manual"],
)
bitstream_splice(
name = "fpga_nexus_mask_test_rom_no_otp_empty",
testonly = True,
src = ":fpga_nexus_mask_test_rom_no_otp",
data = "//hw/top_matcha/data:otp_img_empty",
meminfo = ":otp_mmi",
tags = ["manual"],
)
pkg_tar(
name = "fpga_nexus_smoketest",
testonly = True,
srcs = [
":fpga_nexus_mask_test_rom",
":fpga_nexus_mask_test_rom_no_otp_empty",
":logs",
":otp_mmi",
":rom_mmi",
"//sw/device/examples/hello_world_multicore:hello_world_multicore_sc_embedded_fpga_nexus_bin",
],
extension = "tar.gz",
mode = "0755",
strip_prefix = "/",
tags = ["manual"],
)