aboutsummaryrefslogtreecommitdiff
path: root/recipes-demo/de10-nano-fftsw-apps/files/create_input_waveforms.sh
blob: f087bfa2120909278456930ca206646d9cc31afa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh

WAVEFORM_LIST="
sine
square
triangle
"
cd $(dirname ${0})

[ -d input_waveforms ] && {
	echo ""
	echo "ERROR: directory '$(pwd)/input_waveforms' already exists, please delete before running"
	echo ""
	exit 1
}

mkdir input_waveforms || {
	echo ""
	echo "ERROR: could not create directory '$(pwd)/input_waveforms'"
	echo ""
	exit 1
}

for WAVEFORM in ${WAVEFORM_LIST}
do
	echo "Creating base waveforms for ${WAVEFORM} wave..."
	./create_real_short_${WAVEFORM}32 > input_waveforms/real_short_${WAVEFORM}32.bin
	./duplicate_x8.sh   input_waveforms/real_short_${WAVEFORM}32.bin  > input_waveforms/real_short_${WAVEFORM}256.bin
	./duplicate_x32.sh  input_waveforms/real_short_${WAVEFORM}256.bin > input_waveforms/real_short_${WAVEFORM}256x32.bin
	./duplicate_x128.sh input_waveforms/real_short_${WAVEFORM}32.bin  > input_waveforms/real_short_${WAVEFORM}4096.bin
	./duplicate_x32.sh  input_waveforms/real_short_${WAVEFORM}32.bin  > input_waveforms/real_short_${WAVEFORM}1K.bin
	./duplicate_x32.sh  input_waveforms/real_short_${WAVEFORM}1K.bin  > input_waveforms/real_short_${WAVEFORM}32K.bin
	./duplicate_x32.sh  input_waveforms/real_short_${WAVEFORM}32K.bin > input_waveforms/real_short_${WAVEFORM}1M.bin
	rm input_waveforms/real_short_${WAVEFORM}1K.bin
	rm input_waveforms/real_short_${WAVEFORM}32K.bin
	echo "Creating ne10cpx_short waveforms for ${WAVEFORM} wave..."
	cat input_waveforms/real_short_${WAVEFORM}256.bin    | ./real_short_to_ne10cpx_short > input_waveforms/ne10cpx_short_${WAVEFORM}256.bin
	cat input_waveforms/real_short_${WAVEFORM}256x32.bin | ./real_short_to_ne10cpx_short > input_waveforms/ne10cpx_short_${WAVEFORM}256x32.bin
	cat input_waveforms/real_short_${WAVEFORM}4096.bin     | ./real_short_to_ne10cpx_short > input_waveforms/ne10cpx_short_${WAVEFORM}4096.bin
	cat input_waveforms/real_short_${WAVEFORM}1M.bin     | ./real_short_to_ne10cpx_short > input_waveforms/ne10cpx_short_${WAVEFORM}1M.bin
	echo "Creating ne10cpx_long waveforms for ${WAVEFORM} wave..."
	cat input_waveforms/real_short_${WAVEFORM}256.bin    | ./real_short_to_ne10cpx_long > input_waveforms/ne10cpx_long_${WAVEFORM}256.bin
	cat input_waveforms/real_short_${WAVEFORM}256x32.bin | ./real_short_to_ne10cpx_long > input_waveforms/ne10cpx_long_${WAVEFORM}256x32.bin
	cat input_waveforms/real_short_${WAVEFORM}4096.bin     | ./real_short_to_ne10cpx_long > input_waveforms/ne10cpx_long_${WAVEFORM}4096.bin
	cat input_waveforms/real_short_${WAVEFORM}1M.bin     | ./real_short_to_ne10cpx_long > input_waveforms/ne10cpx_long_${WAVEFORM}1M.bin
done

[ -d output_waveforms ] && {
	exit 0
}

mkdir output_waveforms || {
	echo ""
	echo "ERROR: could not create directory '$(pwd)/output_waveforms'"
	echo ""
	exit 1
}

exit 0