aboutsummaryrefslogtreecommitdiff
path: root/recipes-demo/de10-nano-fftsw-apps/files/README_SANDBOX.TXT
blob: 5969cbf3a323e98b7a65003530b44ce3d1a5ede5 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
To build the applications in this directory, please follow the guidance provided
at the top of the README_SANDBOX_BUILD.TXT file.

Once you have built the applications in this directory you can follow these
directions to make use of them.

We want to run the 'fftdma_256' program and the 'neon32_256' program that we
just built.  These programs require some input waveform data to feed into the
FFT algorithm and they output the real and imaginary FFT results.  To create the
input waveform data we can run this script:

sandbox# ./sandbox_create_input_waveforms.sh

The 'sandbox_create_input_waveforms.sh' script runs a few of the utiltiy
programs that we just build along with some of the utility scripts to create
some input waveform patterns that we can feed into the 'fftdma_256' and
'neon32_256' programs.  After we run this script we should see the following
output that it created:

sandbox# ls input_waveforms/ output_waveforms/
input_waveforms/:
ne10cpx_long_sine256.bin       ne10cpx_short_sine256.bin
ne10cpx_long_square256.bin     ne10cpx_short_square256.bin
ne10cpx_long_triangle256.bin   ne10cpx_short_triangle256.bin

output_waveforms/:

The 'fftdma_256' program consumes 16-bit sample inputs which is what the
'ne10cpx_short_*.bin' files contain, and the 'neon32_256' program consumes
32-bit sample inputs which is what the 'ne10cpx_long_*.bin' files contain.

Now we're ready to run the programs.  Execute each program like this:

sandbox# ./fftdma_256 \
	--input=input_waveforms/ne10cpx_short_sine256.bin \
	--output=output_waveforms/fftdma_256_sine.bin

sandbox# ./neon32_256 \
	--input=input_waveforms/ne10cpx_long_sine256.bin \
	--output=output_waveforms/neon32_256_sine.bin

And now we should see the raw binary output from the two program executions,
like this:

sandbox# ls output_waveforms/
fftdma_256_sine.bin  neon32_256_sine.bin

You can see the raw data by dumping it with 'hexdump -Cv', but if we really want
to "see" the data, we could also convert it into a PNG image file that we can
view with a web browser.

To create a PNG image out of the output results, first we need to convert the
binary data into a text file that 'gnuplot' can digest.  We have previously
compiled a utility program that can help us do that, the 'ne10cpx_long_to_text'
utility.  We can convert the two output data files like this:

sandbox# cat output_waveforms/fftdma_256_sine.bin | \
	./ne10cpx_long_to_text > output_waveforms/fftdma_256_sine.txt

sandbox# cat output_waveforms/neon32_256_sine.bin | \
	./ne10cpx_long_to_text > output_waveforms/neon32_256_sine.txt

And now we should see the binary output files along with the converted text
files in the output directory:
	
sandbox# ls output_waveforms/
fftdma_256_sine.bin  neon32_256_sine.bin
fftdma_256_sine.txt  neon32_256_sine.txt

Next we can have gnuplot plot the data from the text files like this:

sandbox# gnuplot -d -e '
set terminal pngcairo background "#FFFFFF" fontscale 1.0 size 1024, 768;
set output "output_waveforms/fftdma_256_sine.png";
set title "fftdma_256_sine";
plot for [i=1:2] "output_waveforms/fftdma_256_sine.txt"
using i with line title columnhead;'

sandbox# gnuplot -d -e '
set terminal pngcairo background "#FFFFFF" fontscale 1.0 size 1024, 768;
set output "output_waveforms/neon32_256_sine.png";
set title "neon32_256_sine";
plot for [i=1:2] "output_waveforms/neon32_256_sine.txt"
using i with line title columnhead;'

And now we should see the PNG files in the output directory along with the
binary and text files:

sandbox# ls output_waveforms/
fftdma_256_sine.bin  fftdma_256_sine.txt  neon32_256_sine.png
fftdma_256_sine.png  neon32_256_sine.bin  neon32_256_sine.txt

Let's convert the input waveform into a PNG so that we can "see" that as well.
We follow the same steps as above.

sandbox# cat input_waveforms/ne10cpx_long_sine256.bin | \
	./ne10cpx_long_to_text > input_waveforms/ne10cpx_long_sine256.txt

sandbox# gnuplot -d -e '
set terminal pngcairo background "#FFFFFF" fontscale 1.0 size 1024, 768;
set output "input_waveforms/ne10cpx_long_sine256.png" ;
set title "input_256_sine" ;
plot for [i=1:2] "input_waveforms/ne10cpx_long_sine256.txt"
using i with line title columnhead ;'

Now lets put all the images together into one large montage.

sandbox# montage \
	-background '#000000' \
	-font Liberation-Mono-Regular \
	"input_waveforms/ne10cpx_long_sine256.png" \
	"output_waveforms/neon32_256_sine.png" \
	"output_waveforms/fftdma_256_sine.png" \
	-tile 1x3 \
	-geometry +5+5 \
	sines_256.png

VIEW MONTAGE IMAGE IN WEB BROWSER
To view this montage in a web browser, we can copy it over to the images
directory that the web server is pulling from on the DE10-Nano target system.
That directory is '/usr/share/webcontent/images', so we can copy the montage
file like this:

sandbox# cp \
	sines_256.png \
	/usr/share/webcontent/images/

To view the montage, we need to start a web browser on our host machine and
surf to the image on the Altas target, the montage will be visible at the
following URL:

<DE10-Nano-ip-address>/images/sines_256.png

VIEW MONTAGE IMAGE IN VNC SESSION
To view this montage in a VNC session, simply run the 'display' image viewer
application:

sandbox# display sines_256.png