From 6617b034064029bb8386bfbb4e80428825135ab7 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Wed, 8 Jan 2025 14:42:30 +0100 Subject: [PATCH] [topgen] Introduce an OPENTITAN_IS_ define per top This define is available as soon as one includes the top's library. Signed-off-by: Amaury Pouly --- hw/top_darjeeling/sw/autogen/BUILD | 1 + hw/top_earlgrey/sw/autogen/BUILD | 1 + util/topgen/templates/toplevel_BUILD.tpl | 1 + 3 files changed, 3 insertions(+) diff --git a/hw/top_darjeeling/sw/autogen/BUILD b/hw/top_darjeeling/sw/autogen/BUILD index 55cf1f5cf8126..ac18ff2ef2972 100644 --- a/hw/top_darjeeling/sw/autogen/BUILD +++ b/hw/top_darjeeling/sw/autogen/BUILD @@ -21,6 +21,7 @@ cc_library( "top_darjeeling.h", "top_darjeeling_memory.h", ], + defines = ["OPENTITAN_IS_DARJEELING"], target_compatible_with = opentitan_require_top("darjeeling"), ) diff --git a/hw/top_earlgrey/sw/autogen/BUILD b/hw/top_earlgrey/sw/autogen/BUILD index 230cec35bb565..5f7cd4b43ce54 100644 --- a/hw/top_earlgrey/sw/autogen/BUILD +++ b/hw/top_earlgrey/sw/autogen/BUILD @@ -21,6 +21,7 @@ cc_library( "top_earlgrey.h", "top_earlgrey_memory.h", ], + defines = ["OPENTITAN_IS_EARLGREY"], target_compatible_with = opentitan_require_top("earlgrey"), ) diff --git a/util/topgen/templates/toplevel_BUILD.tpl b/util/topgen/templates/toplevel_BUILD.tpl index e0f040f52c5f1..c0fb9b30f8bc9 100644 --- a/util/topgen/templates/toplevel_BUILD.tpl +++ b/util/topgen/templates/toplevel_BUILD.tpl @@ -20,6 +20,7 @@ cc_library( "${top_name}.h", "${top_name}_memory.h", ], + defines = ["OPENTITAN_IS_${top["name"].upper()}"], target_compatible_with = opentitan_require_top("${top["name"]}"), )