From 7cf1a1a1c5c5f7f2851b0d21786ddc7d02fdd68b Mon Sep 17 00:00:00 2001 From: Jade Philipoom Date: Fri, 19 Jan 2024 11:01:08 +0100 Subject: [PATCH 1/2] [lib/base] Move CRC32 library into lib/base. Signed-off-by: Jade Philipoom --- sw/device/{silicon_creator/lib => lib/base}/crc32.c | 0 sw/device/{silicon_creator/lib => lib/base}/crc32.h | 0 sw/device/{silicon_creator/lib => lib/base}/crc32_functest.c | 0 sw/device/{silicon_creator/lib => lib/base}/crc32_perftest.c | 0 sw/device/{silicon_creator/lib => lib/base}/crc32_unittest.cc | 0 sw/device/{silicon_creator/lib => lib/base}/mock_crc32.cc | 0 sw/device/{silicon_creator/lib => lib/base}/mock_crc32.h | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename sw/device/{silicon_creator/lib => lib/base}/crc32.c (100%) rename sw/device/{silicon_creator/lib => lib/base}/crc32.h (100%) rename sw/device/{silicon_creator/lib => lib/base}/crc32_functest.c (100%) rename sw/device/{silicon_creator/lib => lib/base}/crc32_perftest.c (100%) rename sw/device/{silicon_creator/lib => lib/base}/crc32_unittest.cc (100%) rename sw/device/{silicon_creator/lib => lib/base}/mock_crc32.cc (100%) rename sw/device/{silicon_creator/lib => lib/base}/mock_crc32.h (100%) diff --git a/sw/device/silicon_creator/lib/crc32.c b/sw/device/lib/base/crc32.c similarity index 100% rename from sw/device/silicon_creator/lib/crc32.c rename to sw/device/lib/base/crc32.c diff --git a/sw/device/silicon_creator/lib/crc32.h b/sw/device/lib/base/crc32.h similarity index 100% rename from sw/device/silicon_creator/lib/crc32.h rename to sw/device/lib/base/crc32.h diff --git a/sw/device/silicon_creator/lib/crc32_functest.c b/sw/device/lib/base/crc32_functest.c similarity index 100% rename from sw/device/silicon_creator/lib/crc32_functest.c rename to sw/device/lib/base/crc32_functest.c diff --git a/sw/device/silicon_creator/lib/crc32_perftest.c b/sw/device/lib/base/crc32_perftest.c similarity index 100% rename from sw/device/silicon_creator/lib/crc32_perftest.c rename to sw/device/lib/base/crc32_perftest.c diff --git a/sw/device/silicon_creator/lib/crc32_unittest.cc b/sw/device/lib/base/crc32_unittest.cc similarity index 100% rename from sw/device/silicon_creator/lib/crc32_unittest.cc rename to sw/device/lib/base/crc32_unittest.cc diff --git a/sw/device/silicon_creator/lib/mock_crc32.cc b/sw/device/lib/base/mock_crc32.cc similarity index 100% rename from sw/device/silicon_creator/lib/mock_crc32.cc rename to sw/device/lib/base/mock_crc32.cc diff --git a/sw/device/silicon_creator/lib/mock_crc32.h b/sw/device/lib/base/mock_crc32.h similarity index 100% rename from sw/device/silicon_creator/lib/mock_crc32.h rename to sw/device/lib/base/mock_crc32.h From 1b290a2e4e3e81def2f2a258cb127b9fe57cc6b3 Mon Sep 17 00:00:00 2001 From: Jade Philipoom Date: Fri, 19 Jan 2024 11:15:29 +0100 Subject: [PATCH 2/2] [lib/base] Adjust callers of crc32 to use the new location. After moving the CRC32 library out of `silicon_creator`, replace references to it with the new location and fix include guards and BUILD files. Signed-off-by: Jade Philipoom --- sw/device/lib/base/BUILD | 71 ++++++++++++++++++- sw/device/lib/base/crc32.c | 2 +- sw/device/lib/base/crc32.h | 6 +- sw/device/lib/base/crc32_functest.c | 37 +++++----- sw/device/lib/base/crc32_perftest.c | 2 +- sw/device/lib/base/crc32_unittest.cc | 2 +- sw/device/lib/base/mock_crc32.cc | 2 +- sw/device/lib/base/mock_crc32.h | 8 +-- sw/device/lib/testing/test_framework/BUILD | 2 +- .../testing/test_framework/coverage_llvm.c | 2 +- sw/device/lib/ujson/BUILD | 2 +- sw/device/lib/ujson/example_roundtrip.c | 2 +- sw/device/lib/ujson/ujson.c | 2 +- sw/device/silicon_creator/lib/BUILD | 69 ------------------ sw/device/silicon_creator/lib/drivers/BUILD | 8 +-- sw/device/silicon_creator/lib/drivers/alert.c | 2 +- .../lib/drivers/alert_unittest.cc | 2 +- sw/device/silicon_creator/lib/drivers/rnd.c | 2 +- .../lib/drivers/rnd_functest.c | 2 +- .../lib/drivers/rnd_unittest.cc | 2 +- sw/device/silicon_creator/manuf/lib/BUILD | 2 +- .../manuf/lib/ast_program_functest.c | 2 +- sw/host/opentitanlib/src/otp/alert_handler.rs | 2 +- 23 files changed, 116 insertions(+), 117 deletions(-) diff --git a/sw/device/lib/base/BUILD b/sw/device/lib/base/BUILD index 8f36cfdc93bdb..10bc23bb2a31b 100644 --- a/sw/device/lib/base/BUILD +++ b/sw/device/lib/base/BUILD @@ -2,16 +2,85 @@ # Licensed under the Apache License, Version 2.0, see LICENSE for details. # SPDX-License-Identifier: Apache-2.0 -load("//rules:cross_platform.bzl", "dual_cc_library", "dual_inputs") +load("//rules:cross_platform.bzl", "dual_cc_device_library_of", "dual_cc_library", "dual_inputs") load( "//rules/opentitan:defs.bzl", "EARLGREY_TEST_ENVS", "cw310_params", "opentitan_test", + "verilator_params", ) package(default_visibility = ["//visibility:public"]) +dual_cc_library( + name = "crc32", + srcs = dual_inputs( + device = ["crc32.c"], + host = ["mock_crc32.cc"], + ), + hdrs = dual_inputs( + host = ["mock_crc32.h"], + shared = ["crc32.h"], + ), + # This library is a dependancy of the ujson library. + visibility = ["//sw/device/lib/ujson:__pkg__"], + deps = dual_inputs( + host = [ + ":global_mock", + "@googletest//:gtest", + ], + shared = [ + ":memory", + ":macros", + ], + ), +) + +cc_test( + name = "crc32_unittest", + srcs = ["crc32_unittest.cc"], + deps = [ + dual_cc_device_library_of(":crc32"), + "@googletest//:gtest_main", + ], +) + +opentitan_test( + name = "crc32_functest", + srcs = ["crc32_functest.c"], + exec_env = EARLGREY_TEST_ENVS, + verilator = verilator_params( + timeout = "long", + ), + deps = [ + ":crc32", + "//sw/device/lib/testing/test_framework:ottf_main", + ], +) + +opentitan_test( + name = "crc32_perftest", + srcs = ["crc32_perftest.c"], + cw310 = cw310_params( + tags = [ + "manual", + ], + ), + exec_env = { + "//hw/top_earlgrey:fpga_cw310_test_rom": None, + }, + deps = [ + ":crc32", + ":macros", + "//sw/device/lib/runtime:ibex", + "//sw/device/lib/runtime:log", + "//sw/device/lib/testing/test_framework:check", + "//sw/device/lib/testing/test_framework:ottf_main", + "//sw/device/lib/testing/test_framework:ottf_test_config", + ], +) + cc_library( name = "global_mock", hdrs = ["global_mock.h"], diff --git a/sw/device/lib/base/crc32.c b/sw/device/lib/base/crc32.c index f9418a69b2fae..ec9144788e48c 100644 --- a/sw/device/lib/base/crc32.c +++ b/sw/device/lib/base/crc32.c @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 -#include "sw/device/silicon_creator/lib/crc32.h" +#include "sw/device/lib/base/crc32.h" #include diff --git a/sw/device/lib/base/crc32.h b/sw/device/lib/base/crc32.h index 399dfd27cbeac..20e79f2ccd079 100644 --- a/sw/device/lib/base/crc32.h +++ b/sw/device/lib/base/crc32.h @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 -#ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_CRC32_H_ -#define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_CRC32_H_ +#ifndef OPENTITAN_SW_DEVICE_LIB_BASE_CRC32_H_ +#define OPENTITAN_SW_DEVICE_LIB_BASE_CRC32_H_ #include #include @@ -72,4 +72,4 @@ uint32_t crc32(const void *buf, size_t len); } // extern "C" #endif // __cplusplus -#endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_CRC32_H_ +#endif // OPENTITAN_SW_DEVICE_LIB_BASE_CRC32_H_ diff --git a/sw/device/lib/base/crc32_functest.c b/sw/device/lib/base/crc32_functest.c index 30ea9eace47d8..d6f41e513f7d3 100644 --- a/sw/device/lib/base/crc32_functest.c +++ b/sw/device/lib/base/crc32_functest.c @@ -2,12 +2,11 @@ // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 +#include "sw/device/lib/base/crc32.h" #include "sw/device/lib/base/macros.h" #include "sw/device/lib/testing/test_framework/check.h" #include "sw/device/lib/testing/test_framework/ottf_main.h" #include "sw/device/lib/testing/test_framework/ottf_test_config.h" -#include "sw/device/silicon_creator/lib/crc32.h" -#include "sw/device/silicon_creator/lib/error.h" #define LOG_TEST_PARAMS(x) \ LOG_INFO("[%s] Test params: input = 0x%!y, expected_crc32 = 0x%x", \ @@ -40,40 +39,40 @@ static const test_params_t kTestCases[] = {{ 0x9508ac14, }}; -static rom_error_t crc32_test(void) { +static status_t crc32_test(void) { for (size_t i = 0; i < ARRAYSIZE(kTestCases); ++i) { LOG_TEST_PARAMS(kTestCases[i]); - CHECK(crc32(kTestCases[i].input, kTestCases[i].input_len) == - kTestCases[i].expected_crc32); + TRY_CHECK(crc32(kTestCases[i].input, kTestCases[i].input_len) == + kTestCases[i].expected_crc32); } - return kErrorOk; + return OK_STATUS(); } -static rom_error_t crc32_add_test(void) { +static status_t crc32_add_test(void) { for (size_t i = 0; i < ARRAYSIZE(kTestCases); ++i) { LOG_TEST_PARAMS(kTestCases[i]); uint32_t ctx; crc32_init(&ctx); crc32_add(&ctx, kTestCases[i].input, kTestCases[i].input_len); - CHECK(crc32_finish(&ctx) == kTestCases[i].expected_crc32); + TRY_CHECK(crc32_finish(&ctx) == kTestCases[i].expected_crc32); } - return kErrorOk; + return OK_STATUS(); } -static rom_error_t crc32_misaligned_test(void) { +static status_t crc32_misaligned_test(void) { uint32_t kExpCrc = 0x414fa339; alignas(uint32_t) char input[] = ">The quick brown fox jumps over the lazy dog"; - CHECK(crc32(&input[1], sizeof(input) - 2) == kExpCrc); + TRY_CHECK(crc32(&input[1], sizeof(input) - 2) == kExpCrc); uint32_t ctx; crc32_init(&ctx); crc32_add(&ctx, &input[1], sizeof(input) - 2); - CHECK(crc32_finish(&ctx) == kExpCrc); - return kErrorOk; + TRY_CHECK(crc32_finish(&ctx) == kExpCrc); + return OK_STATUS(); } -static rom_error_t crc32_add8_test(void) { +static status_t crc32_add8_test(void) { for (size_t i = 0; i < ARRAYSIZE(kTestCases); ++i) { LOG_TEST_PARAMS(kTestCases[i]); uint32_t ctx; @@ -81,12 +80,12 @@ static rom_error_t crc32_add8_test(void) { for (size_t j = 0; j < kTestCases[i].input_len; ++j) { crc32_add8(&ctx, kTestCases[i].input[j]); } - CHECK(crc32_finish(&ctx) == kTestCases[i].expected_crc32); + TRY_CHECK(crc32_finish(&ctx) == kTestCases[i].expected_crc32); } - return kErrorOk; + return OK_STATUS(); } -static rom_error_t crc32_add32_test(void) { +static status_t crc32_add32_test(void) { uint32_t ctx; crc32_init(&ctx); const uint32_t kExpCrc = 0x9508ac14; @@ -95,8 +94,8 @@ static rom_error_t crc32_add32_test(void) { OT_DISCARD(crc32_finish(&ctx)); crc32_add32(&ctx, 0x1badb002); - CHECK(crc32_finish(&ctx) == kExpCrc); - return kErrorOk; + TRY_CHECK(crc32_finish(&ctx) == kExpCrc); + return OK_STATUS(); } OTTF_DEFINE_TEST_CONFIG(); diff --git a/sw/device/lib/base/crc32_perftest.c b/sw/device/lib/base/crc32_perftest.c index df589919a8bd2..52e5c266e8d6d 100644 --- a/sw/device/lib/base/crc32_perftest.c +++ b/sw/device/lib/base/crc32_perftest.c @@ -5,13 +5,13 @@ #include #include +#include "sw/device/lib/base/crc32.h" #include "sw/device/lib/base/macros.h" #include "sw/device/lib/runtime/ibex.h" #include "sw/device/lib/runtime/log.h" #include "sw/device/lib/testing/test_framework/check.h" #include "sw/device/lib/testing/test_framework/ottf_main.h" #include "sw/device/lib/testing/test_framework/ottf_test_config.h" -#include "sw/device/silicon_creator/lib/crc32.h" OTTF_DEFINE_TEST_CONFIG(); diff --git a/sw/device/lib/base/crc32_unittest.cc b/sw/device/lib/base/crc32_unittest.cc index 2d853e0ec4e60..776e8afdb5dd2 100644 --- a/sw/device/lib/base/crc32_unittest.cc +++ b/sw/device/lib/base/crc32_unittest.cc @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 -#include "sw/device/silicon_creator/lib/crc32.h" +#include "sw/device/lib/base/crc32.h" #include #include diff --git a/sw/device/lib/base/mock_crc32.cc b/sw/device/lib/base/mock_crc32.cc index 1469e9306c972..3fe15b5f9c3eb 100644 --- a/sw/device/lib/base/mock_crc32.cc +++ b/sw/device/lib/base/mock_crc32.cc @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 -#include "sw/device/silicon_creator/lib/mock_crc32.h" +#include "sw/device/lib/base/mock_crc32.h" namespace rom_test { extern "C" { diff --git a/sw/device/lib/base/mock_crc32.h b/sw/device/lib/base/mock_crc32.h index 740476f9d2df9..45377ef84eaeb 100644 --- a/sw/device/lib/base/mock_crc32.h +++ b/sw/device/lib/base/mock_crc32.h @@ -2,11 +2,11 @@ // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 -#ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_MOCK_CRC32_H_ -#define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_MOCK_CRC32_H_ +#ifndef OPENTITAN_SW_DEVICE_LIB_BASE_MOCK_CRC32_H_ +#define OPENTITAN_SW_DEVICE_LIB_BASE_MOCK_CRC32_H_ +#include "sw/device/lib/base/crc32.h" #include "sw/device/lib/base/global_mock.h" -#include "sw/device/silicon_creator/lib/crc32.h" namespace rom_test { namespace internal { @@ -30,4 +30,4 @@ using MockCrc32 = testing::StrictMock; } // namespace rom_test -#endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_MOCK_CRC32_H_ +#endif // OPENTITAN_SW_DEVICE_LIB_BASE_MOCK_CRC32_H_ diff --git a/sw/device/lib/testing/test_framework/BUILD b/sw/device/lib/testing/test_framework/BUILD index 25515ecba4258..8a7f322769867 100644 --- a/sw/device/lib/testing/test_framework/BUILD +++ b/sw/device/lib/testing/test_framework/BUILD @@ -28,10 +28,10 @@ cc_library( hdrs = ["coverage.h"], linkopts = ["-lgcc"], deps = [ + "//sw/device/lib/base:crc32", "//sw/device/lib/base:memory", "//sw/device/lib/runtime:log", "//sw/device/lib/runtime:print", - "//sw/device/silicon_creator/lib:crc32", "//third_party/llvm_compiler_rt", ], ) diff --git a/sw/device/lib/testing/test_framework/coverage_llvm.c b/sw/device/lib/testing/test_framework/coverage_llvm.c index c64891ccf9f2a..3e75784afe022 100644 --- a/sw/device/lib/testing/test_framework/coverage_llvm.c +++ b/sw/device/lib/testing/test_framework/coverage_llvm.c @@ -5,10 +5,10 @@ #include #include "external/llvm_compiler_rt/lib/profile/InstrProfiling.h" +#include "sw/device/lib/base/crc32.h" #include "sw/device/lib/runtime/log.h" #include "sw/device/lib/runtime/print.h" #include "sw/device/lib/testing/test_framework/coverage.h" -#include "sw/device/silicon_creator/lib/crc32.h" /** * When the linker finds a definition of this symbol, it knows to skip loading diff --git a/sw/device/lib/ujson/BUILD b/sw/device/lib/ujson/BUILD index 3640cb4f02ada..d1f3517210a83 100644 --- a/sw/device/lib/ujson/BUILD +++ b/sw/device/lib/ujson/BUILD @@ -21,7 +21,7 @@ cc_library( "//sw/device/lib/base:math", "//sw/device/lib/base:status", "//sw/device/lib/runtime:print", - dual_cc_device_library_of("//sw/device/silicon_creator/lib:crc32"), + dual_cc_device_library_of("//sw/device/lib/base:crc32"), ], ) diff --git a/sw/device/lib/ujson/example_roundtrip.c b/sw/device/lib/ujson/example_roundtrip.c index 42021aa71b9f8..08920664a9c4b 100644 --- a/sw/device/lib/ujson/example_roundtrip.c +++ b/sw/device/lib/ujson/example_roundtrip.c @@ -6,9 +6,9 @@ #include #include +#include "sw/device/lib/base/crc32.h" #include "sw/device/lib/base/status.h" #include "sw/device/lib/ujson/example.h" -#include "sw/device/silicon_creator/lib/crc32.h" status_t stdio_getc(void *context) { int ch = fgetc(stdin); diff --git a/sw/device/lib/ujson/ujson.c b/sw/device/lib/ujson/ujson.c index 01cc04d82b469..54b0b617c33e7 100644 --- a/sw/device/lib/ujson/ujson.c +++ b/sw/device/lib/ujson/ujson.c @@ -8,11 +8,11 @@ #include #include +#include "sw/device/lib/base/crc32.h" #include "sw/device/lib/base/math.h" #include "sw/device/lib/base/status.h" #include "sw/device/lib/runtime/print.h" #include "sw/device/lib/ujson/private_status.h" -#include "sw/device/silicon_creator/lib/crc32.h" static bool is_space(int c) { return c == ' ' || (unsigned)c - '\t' < 5; } diff --git a/sw/device/silicon_creator/lib/BUILD b/sw/device/silicon_creator/lib/BUILD index fed0c9b642ecd..cd7f5f3d39569 100644 --- a/sw/device/silicon_creator/lib/BUILD +++ b/sw/device/silicon_creator/lib/BUILD @@ -373,75 +373,6 @@ cc_test( ], ) -dual_cc_library( - name = "crc32", - srcs = dual_inputs( - device = ["crc32.c"], - host = ["mock_crc32.cc"], - ), - hdrs = dual_inputs( - host = ["mock_crc32.h"], - shared = ["crc32.h"], - ), - # This library is a dependancy of the ujson library. - visibility = ["//sw/device/lib/ujson:__pkg__"], - deps = dual_inputs( - host = [ - "//sw/device/lib/base:global_mock", - "@googletest//:gtest", - ], - shared = [ - "//sw/device/lib/base:memory", - "//sw/device/lib/base:macros", - ], - ), -) - -cc_test( - name = "crc32_unittest", - srcs = ["crc32_unittest.cc"], - deps = [ - dual_cc_device_library_of(":crc32"), - "//sw/device/silicon_creator/testing:rom_test", - "@googletest//:gtest_main", - ], -) - -opentitan_test( - name = "crc32_functest", - srcs = ["crc32_functest.c"], - exec_env = EARLGREY_TEST_ENVS, - verilator = verilator_params( - timeout = "long", - ), - deps = [ - ":crc32", - "//sw/device/lib/testing/test_framework:ottf_main", - ], -) - -opentitan_test( - name = "crc32_perftest", - srcs = ["crc32_perftest.c"], - cw310 = cw310_params( - tags = [ - "manual", - ], - ), - exec_env = { - "//hw/top_earlgrey:fpga_cw310_test_rom": None, - }, - deps = [ - ":crc32", - "//sw/device/lib/base:macros", - "//sw/device/lib/runtime:ibex", - "//sw/device/lib/runtime:log", - "//sw/device/lib/testing/test_framework:check", - "//sw/device/lib/testing/test_framework:ottf_main", - "//sw/device/lib/testing/test_framework:ottf_test_config", - ], -) - cc_library( name = "bootstrap", srcs = ["bootstrap.c"], diff --git a/sw/device/silicon_creator/lib/drivers/BUILD b/sw/device/silicon_creator/lib/drivers/BUILD index 58f2b11b15cb3..285681d535113 100644 --- a/sw/device/silicon_creator/lib/drivers/BUILD +++ b/sw/device/silicon_creator/lib/drivers/BUILD @@ -62,7 +62,7 @@ dual_cc_library( "//sw/device/lib/base:abs_mmio", "//sw/device/lib/base:macros", "//sw/device/lib/base:memory", - "//sw/device/silicon_creator/lib:crc32", + "//sw/device/lib/base:crc32", "//sw/device/silicon_creator/lib:error", ], ), @@ -75,7 +75,7 @@ cc_test( dual_cc_device_library_of(":alert"), "//hw/top_earlgrey:alert_handler_regs", "//hw/top_earlgrey/sw/autogen:top_earlgrey", - "//sw/device/silicon_creator/lib:crc32", + "//sw/device/lib/base:crc32", "@googletest//:gtest_main", ], ) @@ -559,7 +559,7 @@ dual_cc_library( "//hw/ip/otp_ctrl/data:otp_ctrl_regs", "//hw/ip/rv_core_ibex/data:rv_core_ibex_regs", "//hw/top_earlgrey/sw/autogen:top_earlgrey", - "//sw/device/silicon_creator/lib:crc32", + "//sw/device/lib/base:crc32", ], host = [ "//sw/device/lib/base:global_mock", @@ -599,11 +599,11 @@ opentitan_test( ":otp", ":rnd", "//hw/top_earlgrey/sw/autogen:top_earlgrey", + "//sw/device/lib/base:crc32", "//sw/device/lib/dif:entropy_src", "//sw/device/lib/testing:entropy_testutils", "//sw/device/lib/testing:rand_testutils", "//sw/device/lib/testing/test_framework:ottf_main", - "//sw/device/silicon_creator/lib:crc32", "//sw/device/silicon_creator/lib:error", ], ) diff --git a/sw/device/silicon_creator/lib/drivers/alert.c b/sw/device/silicon_creator/lib/drivers/alert.c index 769484ba14247..ac34e93652032 100644 --- a/sw/device/silicon_creator/lib/drivers/alert.c +++ b/sw/device/silicon_creator/lib/drivers/alert.c @@ -5,8 +5,8 @@ #include "sw/device/silicon_creator/lib/drivers/alert.h" #include "sw/device/lib/base/abs_mmio.h" +#include "sw/device/lib/base/crc32.h" #include "sw/device/lib/base/macros.h" -#include "sw/device/silicon_creator/lib/crc32.h" #include "sw/device/silicon_creator/lib/drivers/otp.h" #include "sw/device/silicon_creator/lib/error.h" diff --git a/sw/device/silicon_creator/lib/drivers/alert_unittest.cc b/sw/device/silicon_creator/lib/drivers/alert_unittest.cc index b813a86f7008d..a874df2ac4545 100644 --- a/sw/device/silicon_creator/lib/drivers/alert_unittest.cc +++ b/sw/device/silicon_creator/lib/drivers/alert_unittest.cc @@ -7,9 +7,9 @@ #include "gtest/gtest.h" #include "sw/device/lib/base/mmio.h" #include "sw/device/lib/base/mock_abs_mmio.h" +#include "sw/device/lib/base/mock_crc32.h" #include "sw/device/silicon_creator/lib/drivers/lifecycle.h" #include "sw/device/silicon_creator/lib/drivers/mock_otp.h" -#include "sw/device/silicon_creator/lib/mock_crc32.h" #include "sw/device/silicon_creator/testing/rom_test.h" #include "alert_handler_regs.h" diff --git a/sw/device/silicon_creator/lib/drivers/rnd.c b/sw/device/silicon_creator/lib/drivers/rnd.c index ac1f10bf5526a..515c595649cdc 100644 --- a/sw/device/silicon_creator/lib/drivers/rnd.c +++ b/sw/device/silicon_creator/lib/drivers/rnd.c @@ -4,10 +4,10 @@ #include "sw/device/silicon_creator/lib/drivers/rnd.h" #include "sw/device/lib/base/abs_mmio.h" +#include "sw/device/lib/base/crc32.h" #include "sw/device/lib/base/csr.h" #include "sw/device/lib/base/hardened.h" #include "sw/device/lib/base/macros.h" -#include "sw/device/silicon_creator/lib/crc32.h" #include "sw/device/silicon_creator/lib/drivers/otp.h" #include "entropy_src_regs.h" diff --git a/sw/device/silicon_creator/lib/drivers/rnd_functest.c b/sw/device/silicon_creator/lib/drivers/rnd_functest.c index 21cd75d4dda4d..58f05242d20c3 100644 --- a/sw/device/silicon_creator/lib/drivers/rnd_functest.c +++ b/sw/device/silicon_creator/lib/drivers/rnd_functest.c @@ -5,13 +5,13 @@ #include #include +#include "sw/device/lib/base/crc32.h" #include "sw/device/lib/dif/dif_entropy_src.h" #include "sw/device/lib/runtime/log.h" #include "sw/device/lib/testing/entropy_testutils.h" #include "sw/device/lib/testing/rand_testutils.h" #include "sw/device/lib/testing/test_framework/check.h" #include "sw/device/lib/testing/test_framework/ottf_main.h" -#include "sw/device/silicon_creator/lib/crc32.h" #include "sw/device/silicon_creator/lib/drivers/otp.h" #include "sw/device/silicon_creator/lib/drivers/rnd.h" #include "sw/device/silicon_creator/lib/error.h" diff --git a/sw/device/silicon_creator/lib/drivers/rnd_unittest.cc b/sw/device/silicon_creator/lib/drivers/rnd_unittest.cc index ef341a76a87a0..00e2a1bad8e6a 100644 --- a/sw/device/silicon_creator/lib/drivers/rnd_unittest.cc +++ b/sw/device/silicon_creator/lib/drivers/rnd_unittest.cc @@ -9,10 +9,10 @@ #include "gtest/gtest.h" #include "sw/device/lib/base/csr.h" #include "sw/device/lib/base/mock_abs_mmio.h" +#include "sw/device/lib/base/mock_crc32.h" #include "sw/device/silicon_creator/lib/base/mock_csr.h" #include "sw/device/silicon_creator/lib/base/mock_sec_mmio.h" #include "sw/device/silicon_creator/lib/drivers/mock_otp.h" -#include "sw/device/silicon_creator/lib/mock_crc32.h" #include "sw/device/silicon_creator/testing/rom_test.h" #include "entropy_src_regs.h" diff --git a/sw/device/silicon_creator/manuf/lib/BUILD b/sw/device/silicon_creator/manuf/lib/BUILD index 45b106d9a0105..05b9e0a3c82e3 100644 --- a/sw/device/silicon_creator/manuf/lib/BUILD +++ b/sw/device/silicon_creator/manuf/lib/BUILD @@ -333,6 +333,7 @@ opentitan_test( deps = [ ":flash_info_fields", "//hw/top_earlgrey/sw/autogen:top_earlgrey", + "//sw/device/lib/base:crc32", "//sw/device/lib/base:status", "//sw/device/lib/dif:flash_ctrl", "//sw/device/lib/dif:pinmux", @@ -341,6 +342,5 @@ opentitan_test( "//sw/device/lib/runtime:print", "//sw/device/lib/testing:flash_ctrl_testutils", "//sw/device/lib/testing/test_framework:ottf_main", - "//sw/device/silicon_creator/lib:crc32", ], ) diff --git a/sw/device/silicon_creator/manuf/lib/ast_program_functest.c b/sw/device/silicon_creator/manuf/lib/ast_program_functest.c index 0dcd7024d30a3..f178adc07e64b 100644 --- a/sw/device/silicon_creator/manuf/lib/ast_program_functest.c +++ b/sw/device/silicon_creator/manuf/lib/ast_program_functest.c @@ -2,12 +2,12 @@ // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 +#include "sw/device/lib/base/crc32.h" #include "sw/device/lib/base/status.h" #include "sw/device/lib/dif/dif_flash_ctrl.h" #include "sw/device/lib/runtime/log.h" #include "sw/device/lib/testing/flash_ctrl_testutils.h" #include "sw/device/lib/testing/test_framework/ottf_main.h" -#include "sw/device/silicon_creator/lib/crc32.h" #include "sw/device/silicon_creator/manuf/lib/flash_info_fields.h" OTTF_DEFINE_TEST_CONFIG(.console.test_may_clobber = true); diff --git a/sw/host/opentitanlib/src/otp/alert_handler.rs b/sw/host/opentitanlib/src/otp/alert_handler.rs index 4fd925163086c..d9c6011583f8d 100644 --- a/sw/host/opentitanlib/src/otp/alert_handler.rs +++ b/sw/host/opentitanlib/src/otp/alert_handler.rs @@ -490,7 +490,7 @@ mod test { // A sanity test to make sure the correct CRC algorithm is being used. // // These values are taken from the CRC32 unit tests in - // `sw/device/silicon_creator/lib/crc32_unittest.cc`. + // `sw/device/lib/base/crc32_unittest.cc`. #[test] fn test_new_crc() { let crc = new_crc();