Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hwpe/neureka/pulp_inject_fault.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ set log_injections 1
set seed 12345
set print_statistics 1

set inject_start_time 80000000000ps
set inject_stop_time 150000000000ps
set inject_start_time 20000000ps
set inject_stop_time 37500000ps
set injection_clock "pulp_cluster_tb/cluster_i/clk_i"
set injection_clock_trigger 0
set fault_period 100
Expand Down
2 changes: 2 additions & 0 deletions hwpe/redmule/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ PULP_APP = test
PULP_APP_SRCS = redmule.c
PULP_CFLAGS = -O3

export LEGACY_DMA=1

ifeq ($(use_dma),1)
PULP_CFLAGS += -DUSE_DMA
endif
Expand Down
4 changes: 2 additions & 2 deletions hwpe/redmule/pulp_inject_fault.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ set log_injections 1
set seed 12345
set print_statistics 1

set inject_start_time 550000000000ps
set inject_stop_time 750000000000ps
set inject_start_time 137500000ps
set inject_stop_time 187500000ps
set injection_clock "pulp_cluster_tb/cluster_i/clk_i"
set injection_clock_trigger 0
set fault_period 150
Expand Down
2 changes: 2 additions & 0 deletions hwpe/redmule_256iter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ PULP_APP = test
PULP_APP_SRCS = redmule.c
PULP_CFLAGS = -O3

export LEGACY_DMA=1

ifeq ($(use_dma),1)
PULP_CFLAGS += -DUSE_DMA
endif
Expand Down
2 changes: 2 additions & 0 deletions hwpe/redmule_softclear/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ PULP_APP = test
PULP_APP_SRCS = redmule.c
PULP_CFLAGS = -O3

export LEGACY_DMA=1

ifeq ($(use_dma),1)
PULP_CFLAGS += -DUSE_DMA
endif
Expand Down
2 changes: 2 additions & 0 deletions hwpe/softex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ PULP_APP = test
PULP_APP_SRCS = softex.c
PULP_CFLAGS = -O3

export LEGACY_DMA=1

ifeq ($(use_dma),1)
PULP_CFLAGS += -DUSE_DMA
endif
Expand Down
21 changes: 21 additions & 0 deletions idma_tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## IDMA Tests

This folder contains basic tests for the iDMA IP.
Currently, the following are supported:
- **1D transfers**
- **2D transfers**
- **3D transfers**

To launch each test:
1. Move into the related folder.
2. Launch the following:
1. `make stimuli` : this will generate the randomized stimuli for the test. The randomized stimuli consist of transfer sizes, number of transfers to be executed, n-dimensional strides, etc ...
2. `make clean all` : this will compile the C code. Few choices are available:
- **Single Core mode**: no flags are needed. All transfers specified in the stimuli will be executed by Core 0 only.
- **Sequential Multi-Core Mode**: specify **MULTI_CORE_S=1** in the command line when compiling the code. In this mode, all cores will execute the transfers specified in the stimuli in a sequential manner.
- **Parallel Multi-Core Mode**: specify **MULTI_CORE_P=1** in the command line when compiling the code. In this mode, all cores will execute the transfers specified in the stimulin in a parallel manner.
- **Quick Mode**: specify **QUICK_MODE=1** in the command line when compiling the code. In this mode the non-random inputs (declared in the idma_presets.h files) are used instead of the random ones.
3. `make run` : this will launch the simulation in bash mode (use gui=1 for Modelsim gui).
4. All transfers will be executed in the three different directions that are currently supported: **L1->L2, L2->L1, L1->L1**.

Updated drivers for the iDMA can be found at **pulp_cluster/pulp-runtime/include/hal/dma/idma_v2.h** and **pulp_cluster/pulp-runtime/include/archi/dma/idma_v2.h**.
163 changes: 163 additions & 0 deletions idma_tests/gen_stimuli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
#!/usr/bin/env python

import sys
import random
import argparse
import math
import re

# Extracting testcase
if len(sys.argv) > 1:
testcase = sys.argv[1]
else:
testcase = None


# Define max values for size, strides and length
TRANSFER_SIZE = 128
MAX_STRIDE = 10
MAX_LENGTH = 10
MAX_REPS = 5
# Randomize the number of transfers to execute
NB_TRANSFERS = random.randint(1, 10)
# Create array for sizes of each transfer
transfers = [None] * NB_TRANSFERS

#########################################
# 1D STIMULI GENERATION
#########################################

# The following function writes the needed defines and the structure containing the parameter fields for a 1-dimensional transfer
def write_transfer_params_1d(f, struct_name, params_array_name, arr):
f.write ('%s %s[] = {\n' % (struct_name, params_array_name))
for v in arr:
size = random.randint(1, TRANSFER_SIZE)
f.write('{%d},\n' % size)
f.write('};\n\n')
return

# The following function writes an array of structures containing the parameters for the 1-dimensional transfers to be executed
def write_defs_array_1d(f, name, val, name_size, name_struct):
f.write('#define %s %d\n\n' % (name,val))
f.write ('typedef struct { \n')
f.write (' unsigned int %s;\n' % name_size)
f.write ('} %s;\n\n' %name_struct)
return

#########################################
# 2D STIMULI GENERATION
#########################################

# The following function writes the needed defines and the structure containing the parameter fields for a 2-dimensional transfer
def write_defs_array_2d(f, name, val, name_size, length, name_src_stride, name_dst_stride, name_struct):
f.write('#define %s %d\n\n' % (name,val))
f.write ('typedef struct { \n')
f.write (' unsigned int %s;\n' % name_size)
f.write (' unsigned int %s;\n' % length)
f.write (' unsigned int %s;\n' % name_src_stride)
f.write (' unsigned int %s;\n' % name_dst_stride)
f.write ('} %s;\n\n' %name_struct)
return

# The following function writes an array of structures containing the parameters for the 2-dimensional transfers to be executed
def write_transfer_params_2d(f, struct_name, params_array_name, arr):
f.write ('%s %s[] = {\n' % (struct_name, params_array_name))
for v in arr:
length = random.randint(1, MAX_LENGTH)
size = random.randint(1, TRANSFER_SIZE) + length
src_stride = random.randint(1, MAX_STRIDE) + length
dst_stride = random.randint(1, MAX_STRIDE) + length
f.write('{%d, %d, %d, %d},\n' % (size, length, src_stride, dst_stride))
f.write('};\n\n')
return

#########################################
# 3D STIMULI GENERATION
#########################################

# The following function writes the needed defines and the structure containing the parameter fields for a 2-dimensional transfer
def write_defs_array_3d(f, name, val, name_size, length, name_src_stride_2d, name_dst_stride_2d, name_src_stride_3d, name_dst_stride_3d, num_reps_3d, name_struct):
f.write('#define %s %d\n\n' % (name,val))
f.write ('typedef struct { \n')
f.write (' unsigned int %s;\n' % name_size)
f.write (' unsigned int %s;\n' % length)
f.write (' unsigned int %s;\n' % name_src_stride_2d)
f.write (' unsigned int %s;\n' % name_dst_stride_2d)
f.write (' unsigned int %s;\n' % name_src_stride_3d)
f.write (' unsigned int %s;\n' % name_dst_stride_3d)
f.write (' unsigned int %s;\n' % num_reps_3d)
f.write ('} %s;\n\n' %name_struct)
return

# The following function writes an array of structures containing the parameters for the 2-dimensional transfers to be executed
def write_transfer_params_3d(f, struct_name, params_array_name, arr):
f.write ('%s %s[] = {\n' % (struct_name, params_array_name))
for v in arr:
length = random.randint(1, MAX_LENGTH)
size = random.randint(1, TRANSFER_SIZE) + length
src_stride_2d = random.randint(1, MAX_STRIDE) + length
dst_stride_2d = random.randint(1, MAX_STRIDE) + length
src_stride_3d = random.randint(1, MAX_STRIDE) + length
dst_stride_3d = random.randint(1, MAX_STRIDE) + length
num_reps_3d = random.randint(1, MAX_REPS)
f.write('{%d, %d, %d, %d, %d, %d, %d},\n' % (size, length, src_stride_2d, dst_stride_2d, src_stride_3d, dst_stride_3d, num_reps_3d))
f.write('};\n\n')
return


def gen_stim_1d(f_param, f_def, testcase):
print ("Generate stimuli for 1d testcase")
struct_name = 'transfer_1d'
size_field_name = 'size_1d'
params_array_name = 'params_1d'
write_defs_array_1d(f_def, 'NB_TRANSFERS', NB_TRANSFERS, size_field_name, struct_name)
write_transfer_params_1d(f_param, struct_name, params_array_name, transfers)

def gen_stim_2d(f_param, f_def, testcase):
print ("Generate stimuli for 2d testcase")
struct_name = 'transfer_2d'
size_field_name = 'size_2d'
length_field_name = 'length'
src_stride_field_name = 'src_stride_2d'
dst_stride_field_name = 'dst_stride_2d'
params_array_name = 'params_2d'
write_defs_array_2d(f_def, 'NB_TRANSFERS', NB_TRANSFERS, size_field_name, length_field_name, src_stride_field_name, dst_stride_field_name, struct_name)
write_transfer_params_2d(f_param, struct_name, params_array_name, transfers)

def gen_stim_3d(f_param, f_def, testcase):
print ("Generate stimuli for 3d testcase")
struct_name = 'transfer_3d'
size_field_name = 'size_3d'
length_field_name = 'length'
src_stride_2d_field_name = 'src_stride_2d'
src_stride_3d_field_name = 'src_stride_3d'
dst_stride_2d_field_name = 'dst_stride_2d'
dst_stride_3d_field_name = 'dst_stride_3d'
num_reps_3d_field_name = 'num_reps_3d'
params_array_name = 'params_3d'
write_defs_array_3d(f_def, 'NB_TRANSFERS', NB_TRANSFERS, size_field_name, length_field_name, src_stride_2d_field_name, dst_stride_2d_field_name, src_stride_3d_field_name, dst_stride_3d_field_name, num_reps_3d_field_name, struct_name)
write_transfer_params_3d(f_param, struct_name, params_array_name, transfers)


# Selecting the testcase depending on what was specified through command line (defaulting to 1D)

if (testcase == '1D'):
print ("Generating stimuli for 1D case")
f_param_1d = open('idma_param_1d.h', 'w')
f_def_1d = open('idma_def_1d.h', 'w')
gen_stim_1d(f_param_1d, f_def_1d, testcase)
elif (testcase == '2D'):
print ("Generating stimuli for 2D case")
f_param_2d = open('idma_param_2d.h', 'w')
f_def_2d = open('idma_def_2d.h', 'w')
gen_stim_2d(f_param_2d, f_def_2d, testcase)
elif (testcase == '3D'):
print ("Generating stimuli for 3D case")
f_param_3d = open('idma_param_3d.h', 'w')
f_def_3d = open('idma_def_3d.h', 'w')
gen_stim_3d(f_param_3d, f_def_3d, testcase)
else:
print ("No testcase specified --> generating stimuli for 1d case")
f_param_1d = open('idma_param_1d.h', 'w')
f_def_1d = open('idma_def_1d.h', 'w')
gen_stim_1d(f_param_1d, f_def_1d, testcase)
36 changes: 36 additions & 0 deletions idma_tests/idma_multi_core/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
PULP_APP = test
TEST_SRCS ?= idma_multi_core.c
PULP_APP_SRCS = $(TEST_SRCS)

ifdef VERBOSE
PULP_CFLAGS += -DVERBOSE
endif

ifdef CYCLE_COUNT
PULP_CFLAGS += -DCYCLE_COUNT
PULP_CFLAGS += -DVERBOSE
endif

ifdef MULTI_CORE_P
PULP_CFLAGS += -DMULTI_CORE_P
endif

ifdef MULTI_CORE_S
PULP_CFLAGS += -DMULTI_CORE_S
endif

ifdef SINGLE_CORE
PULP_CFLAGS += -DSINGLE_CORE
endif

ifdef QUICK_MODE
PULP_CFLAGS += -DQUICK_MODE
endif

PULP_CFLAGS += -O3
stackSize = 4096

include $(PULP_SDK_HOME)/install/rules/pulp.mk

stimuli:
python ../gen_stimuli.py 1D
6 changes: 6 additions & 0 deletions idma_tests/idma_multi_core/idma_def_1d.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define NB_TRANSFERS 5

typedef struct {
unsigned int size_1d;
} transfer_1d;

Loading