HOW TO RUN PROJECT

1. Synthesize hw contained in ./embedded_hw
   Project file is lab3.qpf - Qsys system file is alu_component.qsys
   1. First generate hdl for alu_component.qsys
   2. Peform compilation in Quartus
   3. dts of the system in provided in ./embedded_hw/dpu.dts

2. Compile driver and run test program
   1. Create rbf and dtb to load on the board - move embedded_sw on the nfs folder
   2. From the bompile driver in embedded_sw:
   	    cd embedded_sw
   	    make
   3. Compile test program:
   	   	make hello
   4. Run test program:
   	  	./hello

Test program executes a small query - This is just for functional verification.
All parameters sent to the hw (together with the data) are hardcoded (sorry).
The query is equivalent to

	select t1.id, min(t2.id*t2.y)
	from   t1, t2
	where  t1.id == t2.x and 
		   t1.id == t2.id


SIMULATION

testbenches for each tiles are present together with tile verilog in ./embedded_hw/my_files
./embedded_hw contain a python script for each tile which performs a set of functional test in simulation e.g. 

lottarini@c1:~/Desktop/DPU/q100_hardware_andrea/one_dpu$ python alu_test.py 
Model Technology ModelSim ALTERA vlog 10.1d Compiler 2012.11 Nov  2 2012
-- Compiling module alu_tb
-- Compiling module alu
-- Compiling module buffer

Top level modules:
        alu_tb

vsim -c alu_tb -gSEED=337334   -gSEND_THRESHOLD=8 -gREADY_THRESHOLD=1 -gALU_OP=6 -gALU_CONSTANT=643  -do "run -all":      7 True 0
vsim -c alu_tb -gSEED=281185   -gSEND_THRESHOLD=0 -gREADY_THRESHOLD=8 -gALU_OP=4 -gALU_CONSTANT=344  -do "run -all":     14 True 2
vsim -c alu_tb -gSEED=448444   -gSEND_THRESHOLD=9 -gREADY_THRESHOLD=1 -gALU_OP=3 -gALU_CONSTANT=942  -do "run -all":      3 True 0
vsim -c alu_tb -gSEED=57572    -gSEND_THRESHOLD=4 -gREADY_THRESHOLD=7 -gALU_OP=2 -gALU_CONSTANT=789  -do "run -all":     13 True 1
vsim -c alu_tb -gSEED=371083   -gSEND_THRESHOLD=2 -gREADY_THRESHOLD=6 -gALU_OP=1 -gALU_CONSTANT=160  -do "run -all":     15 True 0
vsim -c alu_tb -gSEED=767703   -gSEND_THRESHOLD=1 -gREADY_THRESHOLD=3 -gALU_OP=7 -gALU_CONSTANT=780  -do "run -all":     28 True 1
vsim -c alu_tb -gSEED=297348   -gSEND_THRESHOLD=9 -gREADY_THRESHOLD=2 -gALU_OP=5 -gALU_CONSTANT=415  -do "run -all":      7 True 0
vsim -c alu_tb -gSEED=781705   -gSEND_THRESHOLD=6 -gREADY_THRESHOLD=2 -gALU_OP=6 -gALU_CONSTANT=640  -do "run -all":     19 True 1
vsim -c alu_tb -gSEED=340660   -gSEND_THRESHOLD=3 -gREADY_THRESHOLD=9 -gALU_OP=7 -gALU_CONSTANT=838  -do "run -all":      5 True 2
vsim -c alu_tb -gSEED=420045   -gSEND_THRESHOLD=7 -gREADY_THRESHOLD=7 -gALU_OP=4 -gALU_CONSTANT=314  -do "run -all":     10 True 1

This will execute 10 simulations with random seeds and test the result, e.g. 14 True indicates that 14 operations were performed and all of them gave the correct result.

TESTING

Similarly there is *.tcl script for every tile that can be sourced in the quartus system console to check that the qsys integration is correct.