Merge pull request #43 from pulp-platform/yt/tcdm-scrubber

Add APIs for TCDM scrubber.
This commit is contained in:
Yvan Tortorella 2024-02-28 17:09:00 +01:00 committed by GitHub
commit 7c791d0568
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 102 additions and 0 deletions

View file

@ -99,6 +99,7 @@
#define ARCHI_ICACHE_CTRL_OFFSET 0x00001400
#define ARCHI_MCHAN_EXT_OFFSET 0x00001800
#define ARCHI_HMR_OFFSET 0x00002000
#define ARCHI_TCDM_SCRUBBER_OFFSET 0x00002400
#define ARCHI_CLUSTER_PERIPHERALS_ADDR ( ARCHI_CLUSTER_ADDR + ARCHI_CLUSTER_PERIPHERALS_OFFSET )
#define ARCHI_CLUSTER_PERIPHERALS_GLOBAL_ADDR(cid) ( ARCHI_CLUSTER_GLOBAL_ADDR(cid) + ARCHI_CLUSTER_PERIPHERALS_OFFSET )
@ -109,6 +110,7 @@
#define ARCHI_HWCE_ADDR ( ARCHI_CLUSTER_PERIPHERALS_ADDR + ARCHI_HWCE_OFFSET )
#define ARCHI_MCHAN_EXT_ADDR ( ARCHI_CLUSTER_PERIPHERALS_ADDR + ARCHI_MCHAN_EXT_OFFSET )
#define ARCHI_HMR_ADDR ( ARCHI_CLUSTER_PERIPHERALS_ADDR + ARCHI_HMR_OFFSET )
#define ARCHI_TCDM_SCRUBBER_ADDR ( ARCHI_CLUSTER_PERIPHERALS_ADDR + ARCHI_TCDM_SCRUBBER_OFFSET )
#define ARCHI_CLUSTER_CTRL_GLOBAL_ADDR(cid) ( ARCHI_CLUSTER_PERIPHERALS_GLOBAL_ADDR(cid) + ARCHI_CLUSTER_CTRL_OFFSET )
#define ARCHI_ICACHE_CTRL_GLOBAL_ADDR(cid) ( ARCHI_CLUSTER_PERIPHERALS_GLOBAL_ADDR(cid) + ARCHI_ICACHE_CTRL_OFFSET )
@ -117,6 +119,7 @@
#define ARCHI_MCHAN_EXT_GLOBAL_ADDR(cid) ( ARCHI_CLUSTER_PERIPHERALS_GLOBAL_ADDR(cid) + ARCHI_MCHAN_EXT_OFFSET )
#define ARCHI_IDMA_EXT_GLOBAL_ADDR(cid) ( ARCHI_CLUSTER_PERIPHERALS_GLOBAL_ADDR(cid) + ARCHI_IDMA_EXT_OFFSET )
#define ARCHI_HMR_GLOBAL_ADDR(cid) ( ARCHI_CLUSTER_PERIPHERALS_GLOBAL_ADDR(cid) + ARCHI_HMR_OFFSET )
#define ARCHI_TCDM_SCRUBBER_GLOBAL_ADDR(cid) ( ARCHI_CLUSTER_PERIPHERALS_GLOBAL_ADDR(cid) + ARCHI_TCDM_SCRUBBER_OFFSET )
/*

View file

@ -46,5 +46,6 @@
#include "archi/udma/uart/udma_uart_v1.h"
#include "archi/udma/udma_v3.h"
#include "archi/hmr/hmr_v1.h"
#include "archi/tcdm_scrubber/tcdm_scrubber.h"
#endif

View file

@ -0,0 +1,54 @@
/*
* Copyright (C) 2023 ETH Zurich and University of Bologna
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _TCDM_SCRUBBER_REG_DEFS_
#define _TCDM_SCRUBBER_REG_DEFS_
#define REGISTER_OFFSET 0x20
#ifdef __cplusplus
extern "C" {
#endif
// Register width
#define ECC_MANAGER_PARAM_REG_WIDTH 32
// Correctable mismatches caught by ecc on access
#define ECC_MANAGER_MISMATCH_COUNT_REG_OFFSET 0x0
// Interval between scrubs
#define ECC_MANAGER_SCRUB_INTERVAL_REG_OFFSET 0x4
// Correctable mismatches caught by ecc on scrub
#define ECC_MANAGER_SCRUB_FIX_COUNT_REG_OFFSET 0x8
// Uncorrectable mismatches caught by ecc on scrub
#define ECC_MANAGER_SCRUB_UNCORRECTABLE_COUNT_REG_OFFSET 0xc
// Testing: Inverted write mask for data bits
#define ECC_MANAGER_WRITE_MASK_DATA_N_REG_OFFSET 0x10
// Testing: Inverted write mask for ECC bits
#define ECC_MANAGER_WRITE_MASK_ECC_N_REG_OFFSET 0x14
#define ECC_MANAGER_WRITE_MASK_ECC_N_WRITE_MASK_ECC_N_MASK 0x7f
#define ECC_MANAGER_WRITE_MASK_ECC_N_WRITE_MASK_ECC_N_OFFSET 0
#define ECC_MANAGER_WRITE_MASK_ECC_N_WRITE_MASK_ECC_N_FIELD \
((bitfield_field32_t) { .mask = ECC_MANAGER_WRITE_MASK_ECC_N_WRITE_MASK_ECC_N_MASK, .index = ECC_MANAGER_WRITE_MASK_ECC_N_WRITE_MASK_ECC_N_OFFSET })
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _TCDM_SCRUBBER_REG_DEFS_
// End generated register defines for ECC_manager

View file

@ -42,5 +42,6 @@
#include "hal/udma/spim/udma_spim_v3.h"
#include "hal/udma/uart/udma_uart_v1.h"
#include "hal/hmr/hmr_v1.h"
#include "hal/tcdm_scrubber/tcdm_scrubber.h"
#endif

View file

@ -0,0 +1,43 @@
/*
* Copyright (C) 2023 ETH Zurich and University of Bologna
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __HAL_TCDM_SCRUBBER_H__
#define __HAL_TCDM_SCRUBBER_H__
#include "archi/tcdm_scrubber/tcdm_scrubber.h"
#include "archi/pulp.h"
// Get the number of correctable mismatches detected by the ECC decoders during access
static inline unsigned int tcdm_scrubber_get_mismatch_count(unsigned int cid, unsigned int bank_id) {
return pulp_read32(ARCHI_TCDM_SCRUBBER_GLOBAL_ADDR(cid) + ECC_MANAGER_MISMATCH_COUNT_REG_OFFSET + bank_id*REGISTER_OFFSET);
}
// Set the interval between each access scrubber access to memory banks
static inline void tcdm_scrubber_set_interval(unsigned int cid, unsigned int bank_id, unsigned int value) {
pulp_write32(ARCHI_TCDM_SCRUBBER_GLOBAL_ADDR(cid) + ECC_MANAGER_SCRUB_INTERVAL_REG_OFFSET + bank_id*REGISTER_OFFSET, value);
}
// Get the number of correctable mismatches detected by the ECC decoders while scrubbing
static inline unsigned int tcdm_scrubber_get_fix_count(unsigned int cid, unsigned int bank_id) {
return pulp_read32(ARCHI_TCDM_SCRUBBER_GLOBAL_ADDR(cid) + ECC_MANAGER_SCRUB_FIX_COUNT_REG_OFFSET + bank_id*REGISTER_OFFSET);
}
// Set the number of uncorrectable mismatches detected by the ECC decoders while scrubbing
static inline unsigned int tcdm_scrubber_get_uncorrectable_count(unsigned int cid, unsigned int bank_id) {
return pulp_read32(ARCHI_TCDM_SCRUBBER_GLOBAL_ADDR(cid) + ECC_MANAGER_SCRUB_FIX_COUNT_REG_OFFSET + bank_id*REGISTER_OFFSET);
}
#endif // __HAL_TCDM_SCRUBBER_H__