|
16 | 16 | * management and core-specific operations. |
17 | 17 | */ |
18 | 18 |
|
19 | | -// TODO (lleone): Chekc if these functions can be difend as static |
20 | | - |
21 | 19 | /** |
22 | 20 | * @brief Get start address of a memory tile |
23 | 21 | * @param tile_idx The memory tile idx in the NoC |
24 | 22 | * @return Start addres of memory tile idx |
25 | 23 | */ |
26 | | -inline uintptr_t l3_tile_address(uint32_t tile_idx) { |
27 | | - return (uintptr_t)L3_START_ADDRESS + |
28 | | - (uintptr_t)tile_idx * (uintptr_t)L3_SIZE; |
| 24 | +inline uintptr_t pb_l3_tile_address(uint32_t tile_idx) { |
| 25 | + return (uintptr_t) (picobello_addrmap.l2_spm[tile_idx].mem); |
29 | 26 | } |
30 | 27 |
|
31 | 28 | /** |
32 | 29 | * @brief Get the address offset of a data respect to the memory tile start address |
33 | 30 | * @param src_addr The data absolute address |
34 | 31 | * @return Address location offset respect to the tile start address |
35 | 32 | */ |
36 | | -inline uintptr_t l3_tile_offset(uintptr_t src_addr) { |
| 33 | +inline uintptr_t pb_l3_tile_offset(uintptr_t src_addr) { |
37 | 34 | return (src_addr - (uintptr_t)L3_START_ADDRESS) & (uintptr_t)(L3_SIZE - 1); |
38 | 35 | } |
39 | 36 |
|
| 37 | + |
40 | 38 | /** |
41 | 39 | * @brief Get the NoC row index |
42 | 40 | * @param cidx The cluster index |
43 | 41 | * @return The Row index |
44 | 42 | */ |
45 | | -inline uint32_t cluster_row(uint32_t cidx) |
| 43 | +inline uint32_t pb_cluster_row(uint32_t cidx) |
46 | 44 | { |
47 | 45 | return cidx % CLUSTER_PER_ROW; |
48 | 46 | } |
49 | 47 |
|
| 48 | +/** |
| 49 | + * @brief Get the NoC row index |
| 50 | + * This is a convenience orload of pb_cluster_row() |
| 51 | + * @return The Row index |
| 52 | + */ |
| 53 | +inline uint32_t pb_cluster_row() |
| 54 | +{ |
| 55 | + return pb_cluster_row(snrt_cluster_idx()); |
| 56 | +} |
| 57 | + |
| 58 | + |
50 | 59 | /** |
51 | 60 | * @brief Get the NoC column index |
52 | 61 | * @param cidx The cluster index |
53 | 62 | * @return The Column index |
54 | 63 | */ |
55 | | -inline uint32_t cluster_col(uint32_t cidx) |
| 64 | +inline uint32_t pb_cluster_col(uint32_t cidx) |
56 | 65 | { |
57 | 66 | return cidx % CLUSTER_PER_COL; |
58 | 67 | } |
59 | 68 |
|
60 | | -inline uint32_t dst_tile_for_cluster(uint32_t cidx) { |
61 | | - uint32_t row = cluster_row(cidx); |
| 69 | +/** |
| 70 | + * @brief Get the NoC column index |
| 71 | + * This is a convenience orload of pb_cluster_row() |
| 72 | + * @return The Column index |
| 73 | + */ |
| 74 | +inline uint32_t pb_cluster_col() |
| 75 | +{ |
| 76 | + return pb_cluster_col(snrt_cluster_idx()); |
| 77 | +} |
| 78 | + |
| 79 | + |
| 80 | +/** |
| 81 | + * @brief Get the index of the closest memory tile |
| 82 | + * @param cidx The cluster index |
| 83 | + * @return Index of the closest memory tile to cidx |
| 84 | + */ |
| 85 | +inline uint32_t pb_closest_mem_tile(uint32_t cidx) { |
| 86 | + uint32_t row = pb_cluster_row(cidx); |
62 | 87 | return (cidx < 8u) ? row // first 8 clusters -> left column tiles 0..3 |
63 | 88 | : (row + 4u); // clusters >= 8 -> right column tiles 4..7 |
64 | 89 | } |
| 90 | + |
| 91 | +/** |
| 92 | + * @brief Get the index of the closest memory tile |
| 93 | + * This is a convenience orload of pb_closest_mem_tile() |
| 94 | + */ |
| 95 | +inline uint32_t pb_closest_mem_tile() { |
| 96 | + return pb_closest_mem_tile(snrt_cluster_idx()); |
| 97 | +} |
0 commit comments