Skip to content

Commit 2f39f8f

Browse files
author
bowwang
committed
[sw] update DAS tests
1 parent 64003ac commit 2f39f8f

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

software/tests/baremetal/das_dma/main.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
#include "runtime.h"
1616
#include "synchronization.h"
1717

18-
#define NUM_TILES (NUM_CORES / NUM_CORES_PER_TILE)
19-
uint32_t l2_array[2 * NUM_BANKS] __attribute__((section(".l2")));
18+
#define NUM_TILES (NUM_CORES / NUM_CORES_PER_TILE)
19+
#define NUM_PARTITION_ROWS (2)
20+
uint32_t l2_array[NUM_PARTITION_ROWS * NUM_BANKS] __attribute__((section(".l2")));
2021

2122
int main() {
2223
uint32_t core_id = mempool_get_core_id();
@@ -31,9 +32,9 @@ int main() {
3132
// --------------------------------------------
3233
// Initialize
3334
// --------------------------------------------
34-
uint32_t num_tiles_per_partition = 4;
35-
uint32_t array_size =
36-
2 * num_tiles_per_partition * BANKING_FACTOR * NUM_CORES_PER_TILE;
35+
uint32_t num_tiles_per_partition = 32;
36+
uint32_t array_size = NUM_PARTITION_ROWS * NUM_BANKS;
37+
uint32_t array_size_partition = NUM_PARTITION_ROWS * num_tiles_per_partition * NUM_CORES_PER_TILE * BANKING_FACTOR;
3738
// Initialize L2 array
3839
for (uint32_t i = 0; i < array_size; i++) {
3940
l2_array[i] = i;
@@ -59,21 +60,26 @@ int main() {
5960
dynamic_heap_alloc, array_size * sizeof(uint32_t));
6061

6162
// 5. Config the hardware registers
62-
partition_config(part_id, num_tiles_per_partition);
63-
start_addr_scheme_config(part_id, (uint32_t)(*array),
64-
array_size * sizeof(uint32_t));
63+
das_config(part_id, num_tiles_per_partition, (uint32_t)(array), array_size * sizeof(uint32_t));
6564

6665
// 6. Move data
6766
dma_memcpy_blocking(array, l2_array, array_size * sizeof(uint32_t));
6867

68+
printf("%4d at address %8X.\n", array[0], &array[0]);
69+
6970
// 7. Change addressing scheme (to fully interleaved)
70-
partition_config(part_id, NUM_TILES);
71+
das_config(part_id, NUM_TILES, (uint32_t)(array), array_size * sizeof(uint32_t));
72+
73+
printf("%4d at address %8X.\n", array[0], &array[0]);
7174

7275
// 8. check
7376
for (uint32_t i = 0; i < array_size; i++) {
77+
uint32_t partition_width = num_tiles_per_partition * NUM_CORES_PER_TILE * BANKING_FACTOR;
78+
uint32_t ele_offset = i % partition_width;
79+
uint32_t row_offset = (i / partition_width) % NUM_PARTITION_ROWS;
80+
uint32_t partition_offset = (i / (partition_width * NUM_PARTITION_ROWS));
7481
uint32_t *fetch_address = &array[0] +
75-
(i % (num_tiles_per_partition * NUM_CORES_PER_TILE * BANKING_FACTOR)) +
76-
(i / (num_tiles_per_partition * NUM_CORES_PER_TILE * BANKING_FACTOR)) * NUM_BANKS;
82+
ele_offset + row_offset * NUM_BANKS + partition_offset * partition_width;
7783
if (l2_array[i] != *fetch_address) {
7884
printf("%4d != %4d at address %8X.\n", i, *fetch_address,
7985
fetch_address);

software/tests/baremetal/das_static_test/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ int main() {
3131
// --------------------------------------------
3232
printf("Verify DAS partitions\n\n");
3333

34-
uint32_t num_tiles_per_partition = 4;
34+
uint32_t num_tiles_per_partition = 64;
3535
uint32_t part_id = 0;
3636

3737
uint32_t num_partitions = NUM_TILES / num_tiles_per_partition;

0 commit comments

Comments
 (0)