From 978233e828ec79da3dbfb4c6cec4bd207430565a Mon Sep 17 00:00:00 2001 From: Michael Schaffner Date: Fri, 25 Aug 2023 00:04:05 -0700 Subject: [PATCH] [otp_ctrl/dv] Update otp_ctrl_env_pkg template Signed-off-by: Michael Schaffner [otp_ctrl/dv] Update otp_ctrl_env_pkg template Signed-off-by: Michael Schaffner --- hw/ip/otp_ctrl/data/otp_ctrl_env_pkg.sv.tpl | 52 +++++++++++---------- hw/ip/otp_ctrl/dv/env/otp_ctrl_env_pkg.sv | 15 +++--- 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/hw/ip/otp_ctrl/data/otp_ctrl_env_pkg.sv.tpl b/hw/ip/otp_ctrl/data/otp_ctrl_env_pkg.sv.tpl index d714a0801c0a4..265fa2991d0c2 100644 --- a/hw/ip/otp_ctrl/data/otp_ctrl_env_pkg.sv.tpl +++ b/hw/ip/otp_ctrl/data/otp_ctrl_env_pkg.sv.tpl @@ -2,6 +2,12 @@ // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 ${gen_comment} +<% +from topgen.lib import Name + +parts_without_lc = [part for part in otp_mmap.config["partitions"] if + part["variant"] in ["Buffered", "Unbuffered"]] +%>\ package otp_ctrl_env_pkg; // dep packages import uvm_pkg::*; @@ -71,26 +77,24 @@ package otp_ctrl_env_pkg; // lc does not have dai access parameter int PART_BASE_ADDRS [NumPart-1] = { - VendorTestOffset, - CreatorSwCfgOffset, - OwnerSwCfgOffset, - HwCfg0Offset, - HwCfg1Offset, - Secret0Offset, - Secret1Offset, - Secret2Offset +% for part in parts_without_lc: +<% + part_name = Name.from_snake_case(part["name"]) + part_name_camel = part_name.as_camel_case() +%>\ + ${part_name_camel}Offset${"" if loop.last else ","} +% endfor }; // lc does not have digest parameter int PART_OTP_DIGEST_ADDRS [NumPart-1] = { - VendorTestDigestOffset >> 2, - CreatorSwCfgDigestOffset >> 2, - OwnerSwCfgDigestOffset >> 2, - HwCfg0DigestOffset >> 2, - HwCfg1DigestOffset >> 2, - Secret0DigestOffset >> 2, - Secret1DigestOffset >> 2, - Secret2DigestOffset >> 2 +% for part in parts_without_lc: +<% + part_name = Name.from_snake_case(part["name"]) + part_name_camel = part_name.as_camel_case() +%>\ + ${part_name_camel}DigestOffset >> 2${"" if loop.last else ","} +% endfor }; // types @@ -101,15 +105,13 @@ package otp_ctrl_env_pkg; } otp_intr_e; typedef enum bit [5:0] { - OtpVendorTestErrIdx, - OtpCreatorSwCfgErrIdx, - OtpOwnerSwCfgErrIdx, - OtpHwCfg0ErrIdx, - OtpHwCfg1ErrIdx, - OtpSecret0ErrIdx, - OtpSecret1ErrIdx, - OtpSecret2ErrIdx, - OtpLifeCycleErrIdx, +% for part in otp_mmap.config["partitions"]: +<% + part_name = Name.from_snake_case(part["name"]) + part_name_camel = part_name.as_camel_case() +%>\ + Otp${part_name_camel}ErrIdx, +% endfor OtpDaiErrIdx, OtpLciErrIdx, OtpTimeoutErrIdx, diff --git a/hw/ip/otp_ctrl/dv/env/otp_ctrl_env_pkg.sv b/hw/ip/otp_ctrl/dv/env/otp_ctrl_env_pkg.sv index 4f56823f1bb36..54e44e9af6c81 100644 --- a/hw/ip/otp_ctrl/dv/env/otp_ctrl_env_pkg.sv +++ b/hw/ip/otp_ctrl/dv/env/otp_ctrl_env_pkg.sv @@ -77,7 +77,6 @@ package otp_ctrl_env_pkg; CreatorSwCfgOffset, OwnerSwCfgOffset, HwCfg0Offset, - HwCfg1Offset, Secret0Offset, Secret1Offset, Secret2Offset @@ -85,14 +84,13 @@ package otp_ctrl_env_pkg; // lc does not have digest parameter int PART_OTP_DIGEST_ADDRS [NumPart-1] = { - VendorTestDigestOffset >> 2, + VendorTestDigestOffset >> 2, CreatorSwCfgDigestOffset >> 2, - OwnerSwCfgDigestOffset >> 2, - HwCfg0DigestOffset >> 2, - HwCfg1DigestOffset >> 2, - Secret0DigestOffset >> 2, - Secret1DigestOffset >> 2, - Secret2DigestOffset >> 2 + OwnerSwCfgDigestOffset >> 2, + HwCfg0DigestOffset >> 2, + Secret0DigestOffset >> 2, + Secret1DigestOffset >> 2, + Secret2DigestOffset >> 2 }; // types @@ -107,7 +105,6 @@ package otp_ctrl_env_pkg; OtpCreatorSwCfgErrIdx, OtpOwnerSwCfgErrIdx, OtpHwCfg0ErrIdx, - OtpHwCfg1ErrIdx, OtpSecret0ErrIdx, OtpSecret1ErrIdx, OtpSecret2ErrIdx,