/* * Copyright (C) 2019 ETH Zurich, 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. */ #include "pulp.h" #include #include #if defined(ARCHI_HAS_L1) pos_alloc_t pos_alloc_l1[ARCHI_NB_CLUSTER]; #endif #if defined(ARCHI_HAS_FC_TCDM) pos_alloc_t pos_alloc_fc_tcdm; #endif #if defined(ARCHI_HAS_L2) pos_alloc_t pos_alloc_l2[POS_NB_ALLOC_L2]; #endif #ifdef CONFIG_ALLOC_L2_PWD_NB_BANKS static uint32_t pos_alloc_account_0[CONFIG_ALLOC_L2_PWD_NB_BANKS]; static uint32_t pos_alloc_account_1[CONFIG_ALLOC_L2_PWD_NB_BANKS]; #endif #if defined(ARCHI_HAS_FC_TCDM) static inline pos_alloc_t *get_fc_alloc() { return &pos_alloc_fc_tcdm; } #else static inline pos_alloc_t *get_fc_alloc() { return &pos_alloc_l2[0]; } #endif void pos_allocs_init() { #if defined(ARCHI_HAS_L2) #if defined(ARCHI_HAS_L2_MULTI) //pos_trace(//pos_trace_INIT, "Initializing L2 private bank0 allocator (base: 0x%8x, size: 0x%8x)\n", (int)pos_l2_priv0_base(), pos_l2_priv0_size()); pos_alloc_init(&pos_alloc_l2[0], pos_l2_priv0_base(), pos_l2_priv0_size()); //pos_trace(//pos_trace_INIT, "Initializing L2 private bank1 allocator (base: 0x%8x, size: 0x%8x)\n", (int)pos_l2_priv1_base(), pos_l2_priv1_size()); pos_alloc_init(&pos_alloc_l2[1], pos_l2_priv1_base(), pos_l2_priv1_size()); //pos_trace(//pos_trace_INIT, "Initializing L2 shared banks allocator (base: 0x%8x, size: 0x%8x)\n", (int)pos_l2_shared_base(), pos_l2_shared_size()); pos_alloc_init(&pos_alloc_l2[2], pos_l2_shared_base(), pos_l2_shared_size()); #ifdef CONFIG_ALLOC_L2_PWD_NB_BANKS pos_alloc_l2[2].track_pwd = 1; pos_alloc_l2[2].pwd_count = pos_alloc_account_0; pos_alloc_l2[2].ret_count = pos_alloc_account_0; for (int i=0; i