Skip to content

Commit

Permalink
Bug Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
IveanEx committed Sep 2, 2024
1 parent a37ac46 commit 6cae711
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,84 +14,83 @@
#include "snrt.h"
int8_t* tcdm0_start_addr;
int8_t* tcdm1_start_addr;
int main(){
int main() {
int err = 0;
// First set the addr of cluster 0
// tcdm0_start_addr = (int8_t*)0x10000000;
// tcdm1_start_addr = (int8_t*)0x10100000;
if(snrt_cluster_idx()==0){
if(snrt_is_dm_core()){
if (snrt_cluster_idx() == 0) {
if (snrt_is_dm_core()) {
tcdm0_start_addr = (int8_t*)snrt_cluster_base_addrl();
printf("The C0 TCDM ADDR is %p \n", tcdm0_start_addr);
}
}
snrt_global_barrier();

if(snrt_cluster_idx()==1){
if(snrt_is_dm_core()){
if (snrt_cluster_idx() == 1) {
if (snrt_is_dm_core()) {
tcdm1_start_addr = (int8_t*)snrt_cluster_base_addrl();
printf("The C1 TCDM ADDR is %p \n", tcdm1_start_addr);
}
}
snrt_global_barrier();
// C0 Load the data from l3 -> l1
if(snrt_cluster_idx()==0){
if (snrt_is_dm_core()){
if (snrt_cluster_idx() == 0) {
if (snrt_is_dm_core()) {
printf("[C0] Start to load data from %p\n", test_data);
snrt_dma_start_1d(tcdm0_start_addr,test_data,length_data);
snrt_dma_start_1d(tcdm0_start_addr, test_data, length_data);
snrt_dma_wait_all();
}
}
// wait the C0 is done
snrt_global_barrier();

// Thenc C1 fetches data from C0
if(snrt_cluster_idx()==1){
if (snrt_is_dm_core()){
if (snrt_cluster_idx() == 1) {
if (snrt_is_dm_core()) {
printf("[C1] Load data from C0 TCDM %p\n", tcdm0_start_addr);
snrt_dma_start_1d(tcdm1_start_addr,tcdm0_start_addr,length_data);
snrt_dma_start_1d(tcdm1_start_addr, tcdm0_start_addr, length_data);
snrt_dma_wait_all();
}

}
// wait the C1 is done
snrt_global_barrier();

// Start to check
if(snrt_cluster_idx()==0){

if (snrt_cluster_core_idx()==0){
if (snrt_cluster_idx() == 0) {
if (snrt_cluster_core_idx() == 0) {
printf("C0 Checking the results\n");
for (int i = 0; i < length_data; i++){
if(tcdm0_start_addr[i] != test_data[i]){
err ++;
for (int i = 0; i < length_data; i++) {
if (tcdm0_start_addr[i] != test_data[i]) {
err++;
printf("C0 data is incorrect!\n");
printf("tcdm0[%d]=%d, test_data[%d]=%d\n", i,
tcdm0_start_addr[i], i, test_data[i]);
tcdm0_start_addr[i], i, test_data[i]);
return -1;
}
}
}
}
snrt_global_barrier();
if(snrt_cluster_idx()==1){

if (snrt_cluster_core_idx()==0){
if (snrt_cluster_idx() == 1) {
if (snrt_cluster_core_idx() == 0) {
printf("C1 Checking the results\n");
for (int i = 0; i < length_data; i++){
if(tcdm1_start_addr[i] != test_data[i]){
err ++;
for (int i = 0; i < length_data; i++) {
if (tcdm1_start_addr[i] != test_data[i]) {
err++;
printf("C1 data is incorrect!\n");
printf("tcdm0[%d]=%d, test_data[%d]=%d\n", i,
tcdm1_start_addr[i], i, test_data[i]);
tcdm1_start_addr[i], i, test_data[i]);
return -1;
}
}
}
}

snrt_global_barrier();
if(snrt_cluster_idx()==0){
if(snrt_is_dm_core()){
printf("Checking all done! No error!\n");
if (snrt_cluster_idx() == 0) {
if (snrt_is_dm_core()) {
printf("Checking all done! No error!\n");
}
}

Expand Down
2 changes: 1 addition & 1 deletion target/sim/sw/sim_elf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# SPDX-License-Identifier: Apache-2.0

runs:
- elf: sw/apps/offload/build/offload-snax-test-integration.elf
- elf: apps/offload/build/offload-snax-test-integration.elf

0 comments on commit 6cae711

Please sign in to comment.