Permalink
Browse files

Buildscripts (#73)

Fixed compilation in Xilinx compiler. Refactored FPGA build scripts out of the makefile. Added initial Vivado build script based on Teguh's work.
  • Loading branch information...
jameshegarty committed Oct 5, 2017
1 parent f023108 commit 58928866d62c792c162b29ac613c23d8af4c7550
View
@@ -340,7 +340,7 @@ function harnessTop(t)
if backend==nil then backend = arg[1] end
if backend==nil then backend = "verilog" end
if backend=="verilog" then
if backend=="verilog" or backend=="verilator" then
H.verilogOnly( t.outFile, fn, t.inFile, t.tapType, t.tapValue, iover, inputP, t.inSize[1], t.inSize[2], oover, outputP, t.outSize[1], t.outSize[2], t.simCycles, t.harness )
elseif(backend=="axi") then
H.axi( t.outFile, fn, t.inFile, t.tapType, t.tapValue, iover, inputP, t.inSize[1], t.inSize[2], oover, outputP, t.outSize[1], t.outSize[2], t.underflowTest, t.earlyOverride )
@@ -353,7 +353,7 @@ function harnessTop(t)
assert(false)
end
if backend=="verilog" or backend=="terra" or backend=="axi" then
if backend=="verilog" or backend=="terra" or backend=="axi" or backend=="verilator" then
local tapValueString = "x"
local tapBits = 0
if t.tapType~=nil then
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -15,7 +15,7 @@ static map<string,Filestate> state;
// pixels: # of pixels being written this time
void writeBytes(string id, int w, int h, string type, int pixels, int bytecnt, unsigned char* data){
#ifndef DISABLE_WRITE_PIXELS
if(state.count(id)==0){
// initialize
Filestate fs;
@@ -46,7 +46,7 @@ void writeBytes(string id, int w, int h, string type, int pixels, int bytecnt, u
state[id].seenPixels+=pixels;
for(int i=0; i<bytecnt; i++){fputc(data[i],state[id].file);}
#endif
}
void done(){
View
@@ -197,7 +197,7 @@ module stage
___PIPELINE_TAPS
___PIPELINE_MODULE_NAME #(.INPUT_COUNT(___PIPELINE_INPUT_COUNT),.OUTPUT_COUNT(___PIPELINE_OUTPUT_COUNT)) pipeline(.CLK(FCLK0),.reset(CONFIG_READY),.ready(pipelineReady),.ready_downstream(downstreamReady),.process_input({pipelineInputValid,___PIPELINE_INPUT}),.process_output(pipelineOutputPacked));
___PIPELINE_MODULE_NAME pipeline(.CLK(FCLK0),.reset(CONFIG_READY),.ready(pipelineReady),.ready_downstream(downstreamReady),.process_input({pipelineInputValid,___PIPELINE_INPUT}),.process_output(pipelineOutputPacked));
// UnderflowShim #(.WAIT_CYCLES(___PIPELINE_WAIT_CYCLES)) OS(.CLK(FCLK0),.RST(CONFIG_READY),.lengthOutput(lengthOutput),.inp(pipelineOutputPacked[63:0]),.inp_valid(pipelineOutputPacked[64]),.out(pipelineOutput),.out_valid(pipelineOutputValid));
View
@@ -0,0 +1,10 @@
#!/bin/bash
VERILOG_FILE=$1
METADATA_FILE=$2
BUILDDIR=$3
OUTFILE=$4
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
make -f $DIR/makefile.ise OUTFILE=$OUTFILE INPUT=$VERILOG_FILE BUILD_DIR=$BUILDDIR $OUTFILE
View
@@ -0,0 +1,100 @@
out/%.camera.bit: out/%.axi.v
mkdir -p out/buildcamera_$*
echo "verilog work \"../$*.axi.v\"" > out/buildcamera_$*/system.prj
echo "verilog work \"../../../platform/camera/vsrc/*.v\"" >> out/buildcamera_$*/system.prj
cp ../platform/camera/vsrc/*.ngc out/buildcamera_$*/.
cd out/buildcamera_$*; xst -ifn ../../../platform/camera/system.xst | tee OUT_xst.log
cd out/buildcamera_$*; ngdbuild -nt timestamp -uc ../../../platform/camera/ps7_constraints.ucf -uc ../../../platform/camera/system.ucf -p xc7z020-clg484-1 system.ngc system.ngd | tee OUT_ngd.log
cd out/buildcamera_$*; map -detail -p xc7z020-clg484-1 -w -logic_opt off -ol high -t 1 -xt 0 -register_duplication off -r 4 -mt off -ir off -pr off -lc off -power off -o system_map.ncd system.ngd system.pcf > OUT_map.txt
cd out/buildcamera_$*; par -w -ol high -mt off system_map.ncd system.ncd system.pcf > OUT_par.txt
cd out/buildcamera_$*; trce -v 3 -s 1 -n 3 -fastpaths -xml system.twx system.ncd -o system.twr system.pcf -ucf ../../platform/axi/ps7_constraints.ucf -ucf ../../platform/axi/system.ucf > OUT_trce.txt
cd out/buildcamera_$*; bitgen -w -g Binary:no -g CRC:Enable -g ProgPin:PullUp -g InitPin:Pullup -g TckPin:PullUp -g TdiPin:PullUp \
-g TdoPin:PullUp -g TmsPin:PullUp -g Disable_JTAG:No -g UnusedPin:PullDown -g UserID:0xFFFFFFFF -g OverTempPowerDown:Disable \
-g USR_ACCESS:None -g JTAG_XADC:Enable -g DCIUpdateMode:AsRequired -g StartUpClk:CClk -g DONE_cycle:4 -g GTS_cycle:5 -g GWE_cycle:6 \
-g Match_cycle:Auto -g Security:None -g ICAP_select:Auto -g DonePipe:Yes -g DriveDone:No system.ncd > OUT_bitgen.txt
cp out/buildcamera_$*/system.bit $@
out/%.camera1x.bit: out/%.axi.v
mkdir -p out/buildcamera_$*
echo "verilog work \"../$*.axi.v\"" > out/buildcamera_$*/system.prj
echo "verilog work \"../../../platform/camera1x/vsrc/*.v\"" >> out/buildcamera_$*/system.prj
cp ../platform/camera1x/vsrc/*.ngc out/buildcamera_$*/.
cd out/buildcamera_$*; xst -ifn ../../../platform/camera/system.xst | tee OUT_xst.log
cd out/buildcamera_$*; ngdbuild -nt timestamp -uc ../../../platform/camera/ps7_constraints.ucf -uc ../../../platform/camera1x/system.ucf -p xc7z020-clg484-1 system.ngc system.ngd | tee OUT_ngd.log
cd out/buildcamera_$*; map -detail -p xc7z020-clg484-1 -w -logic_opt off -ol high -t 1 -xt 0 -register_duplication off -r 4 -mt off -ir off -pr off -lc off -power off -o system_map.ncd system.ngd system.pcf > OUT_map.txt
cd out/buildcamera_$*; par -w -ol high -mt off system_map.ncd system.ncd system.pcf > OUT_par.txt
cd out/buildcamera_$*; trce -v 3 -s 1 -n 3 -fastpaths -xml system.twx system.ncd -o system.twr system.pcf -ucf ../../platform/axi/ps7_constraints.ucf -ucf ../../platform/axi/system.ucf > OUT_trce.txt
cd out/buildcamera_$*; bitgen -w -g Binary:no -g CRC:Enable -g ProgPin:PullUp -g InitPin:Pullup -g TckPin:PullUp -g TdiPin:PullUp \
-g TdoPin:PullUp -g TmsPin:PullUp -g Disable_JTAG:No -g UnusedPin:PullDown -g UserID:0xFFFFFFFF -g OverTempPowerDown:Disable \
-g USR_ACCESS:None -g JTAG_XADC:Enable -g DCIUpdateMode:AsRequired -g StartUpClk:CClk -g DONE_cycle:4 -g GTS_cycle:5 -g GWE_cycle:6 \
-g Match_cycle:Auto -g Security:None -g ICAP_select:Auto -g DonePipe:Yes -g DriveDone:No system.ncd > OUT_bitgen.txt
cp out/buildcamera_$*/system.bit $@
out/%.camera2.0.bit: out/%.axi.v
mkdir -p out/buildcamera_$*
echo "verilog work \"../$*.axi.v\"" > out/buildcamera_$*/system.prj
echo "verilog work \"../../../platform/camera2.0/vsrc/*.v\"" >> out/buildcamera_$*/system.prj
cp ../platform/camera2.0/vsrc/*.ngc out/buildcamera_$*/.
cd out/buildcamera_$*; xst -ifn ../../../platform/camera/system.xst | tee OUT_xst.log
cd out/buildcamera_$*; ngdbuild -nt timestamp -uc ../../../platform/camera/ps7_constraints.ucf -uc ../../../platform/camera2.0/system.ucf -p xc7z020-clg484-1 system.ngc system.ngd | tee OUT_ngd.log
cd out/buildcamera_$*; map -detail -p xc7z020-clg484-1 -w -logic_opt off -ol high -t 1 -xt 0 -register_duplication off -r 4 -mt off -ir off -pr off -lc off -power off -o system_map.ncd system.ngd system.pcf > OUT_map.txt
cd out/buildcamera_$*; par -w -ol high -mt off system_map.ncd system.ncd system.pcf > OUT_par.txt
cd out/buildcamera_$*; trce -v 3 -s 1 -n 3 -fastpaths -xml system.twx system.ncd -o system.twr system.pcf -ucf ../../platform/axi/ps7_constraints.ucf -ucf ../../platform/axi/system.ucf > OUT_trce.txt
cd out/buildcamera_$*; bitgen -w -g Binary:no -g CRC:Enable -g ProgPin:PullUp -g InitPin:Pullup -g TckPin:PullUp -g TdiPin:PullUp \
-g TdoPin:PullUp -g TmsPin:PullUp -g Disable_JTAG:No -g UnusedPin:PullDown -g UserID:0xFFFFFFFF -g OverTempPowerDown:Disable \
-g USR_ACCESS:None -g JTAG_XADC:Enable -g DCIUpdateMode:AsRequired -g StartUpClk:CClk -g DONE_cycle:4 -g GTS_cycle:5 -g GWE_cycle:6 \
-g Match_cycle:Auto -g Security:None -g ICAP_select:Auto -g DonePipe:Yes -g DriveDone:No system.ncd > OUT_bitgen.txt
cp out/buildcamera_$*/system.bit $@
CAMERA_ADDR=192.168.42.50
CAMERA_WRITE_PATH=/tmp
CAMERA_PASS=1234
%.camera.run: out/%.camera.bit
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo 'fclk0' > /sys/devices/amba.0/f8007000.ps7-dev-cfg/fclk_export"
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo 'fclk1' > /sys/devices/amba.0/f8007000.ps7-dev-cfg/fclk_export"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo '100000000' > /sys/class/fclk/fclk0/set_rate"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "cat /sys/class/fclk/fclk0/set_rate"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo '96000000' > /sys/class/fclk/fclk1/set_rate"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "cat /sys/class/fclk/fclk1/set_rate"
###### CLOCK STUFF END
sshpass -p $(CAMERA_PASS) scp ../platform/camera/csrc/processimage out/$*.camera.bit root@$(CAMERA_ADDR):$(CAMERA_WRITE_PATH)/.
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "cat $(CAMERA_WRITE_PATH)/$*.camera.bit > /dev/xdevcfg"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "$(CAMERA_WRITE_PATH)/processimage 0"
-sshpass -p $(CAMERA_PASS) scp root@$(CAMERA_ADDR):$(CAMERA_WRITE_PATH)/*.raw .
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "rm $(CAMERA_WRITE_PATH)/processimage $(CAMERA_WRITE_PATH)/$*.camera.bit"
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo 'fclk0' > /sys/devices/amba.0/f8007000.ps7-dev-cfg/fclk_unexport"
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo 'fclk1' > /sys/devices/amba.0/f8007000.ps7-dev-cfg/fclk_unexport"
%.camera1x.run: out/%.camera1x.bit
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo 'fclk0' > /sys/devices/amba.0/f8007000.ps7-dev-cfg/fclk_export"
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo 'fclk1' > /sys/devices/amba.0/f8007000.ps7-dev-cfg/fclk_export"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo '100000000' > /sys/class/fclk/fclk0/set_rate"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "cat /sys/class/fclk/fclk0/set_rate"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo '96000000' > /sys/class/fclk/fclk1/set_rate"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "cat /sys/class/fclk/fclk1/set_rate"
###### CLOCK STUFF END
sshpass -p $(CAMERA_PASS) scp ../platform/camera1x/csrc/processimage out/$*.camera1x.bit root@$(CAMERA_ADDR):$(CAMERA_WRITE_PATH)/.
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "cat $(CAMERA_WRITE_PATH)/$*.camera1x.bit > /dev/xdevcfg"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "$(CAMERA_WRITE_PATH)/processimage 0"
-sshpass -p $(CAMERA_PASS) scp root@$(CAMERA_ADDR):$(CAMERA_WRITE_PATH)/*.raw .
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "rm $(CAMERA_WRITE_PATH)/processimage $(CAMERA_WRITE_PATH)/$*.camera1x.bit"
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo 'fclk0' > /sys/devices/amba.0/f8007000.ps7-dev-cfg/fclk_unexport"
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo 'fclk1' > /sys/devices/amba.0/f8007000.ps7-dev-cfg/fclk_unexport"
%.camera2.0.run: out/%.camera2.0.bit
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo 'fclk0' > /sys/devices/amba.0/f8007000.ps7-dev-cfg/fclk_export"
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo 'fclk1' > /sys/devices/amba.0/f8007000.ps7-dev-cfg/fclk_export"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo '100000000' > /sys/class/fclk/fclk0/set_rate"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "cat /sys/class/fclk/fclk0/set_rate"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo '96000000' > /sys/class/fclk/fclk1/set_rate"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "cat /sys/class/fclk/fclk1/set_rate"
###### CLOCK STUFF END
sshpass -p $(CAMERA_PASS) scp ../platform/camera2.0/csrc/processimage out/$*.camera2.0.bit root@$(CAMERA_ADDR):$(CAMERA_WRITE_PATH)/.
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "cat $(CAMERA_WRITE_PATH)/$*.camera2.0.bit > /dev/xdevcfg"
sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "$(CAMERA_WRITE_PATH)/processimage 0"
-sshpass -p $(CAMERA_PASS) scp root@$(CAMERA_ADDR):$(CAMERA_WRITE_PATH)/*.raw .
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "rm $(CAMERA_WRITE_PATH)/processimage $(CAMERA_WRITE_PATH)/$*.camera2.0.bit"
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo 'fclk0' > /sys/devices/amba.0/f8007000.ps7-dev-cfg/fclk_unexport"
-sshpass -p $(CAMERA_PASS) ssh root@$(CAMERA_ADDR) "echo 'fclk1' > /sys/devices/amba.0/f8007000.ps7-dev-cfg/fclk_unexport"
View
@@ -0,0 +1,46 @@
# isim is crap, and if we run multiple processes at the same time in the same directory, they will clobber each other. So we need to run in different directories.
out/%.isim.raw: out/%.isim.v $(DUPS)
mkdir -p out/sim_$*
cd out/sim_$*; vlogcomp ../$*.isim.v
cd out/sim_$*; fuse -o $* -lib $* -L unisim -L unimacro -top sim
cd out/sim_$*; echo "run all" | ./$* > output.txt
split -n 2 -d out/sim_$*/$*.isim.raw out/sim_$*/S
mv out/sim_$*/S00 out/$*.isim.raw
mv out/sim_$*/S01 out/$*.isim.1.raw
$(TERRA) ../misc/extractCycles.t out/$*.isim.raw > out/$*.isim.cycles.txt
# keep copy for future reference
mkdir -p out/build_$*
cp out/$*.isim.cycles.txt out/build_$*
out/%.isim.bmp: out/%.isim.raw out/%.metadata.lua
$(LUA) ../misc/raw2bmp.lua out/$*.isim.raw out/$*.isim.bmp out/$*.metadata.lua 1
# keep copy for future reference
mkdir -p out/build_$*
cp out/$*.isim.bmp out/build_$*
out/%.isim.1.bmp: out/%.isim.raw out/%.metadata.lua
$(LUA) ../misc/raw2bmp.lua out/$*.isim.1.raw out/$*.isim.1.bmp out/$*.metadata.lua 1
# keep copy for future reference
mkdir -p out/build_$*
cp out/$*.isim.1.bmp out/build_$*
out/%_half.isim.correct.txt : out/%_half.isim.bmp
diff out/$*_half.isim.bmp gold/$*.bmp > out/$*_half.isim.diff
test ! -s out/$*_half.isim.diff && touch $@
# keep copy for future reference
mkdir -p out/build_$*
test ! -s out/$*_half.isim.diff && touch out/build_$*/$*_half.isim.correct.txt
out/%.isim.correct.txt : out/%.isim.bmp
diff out/$*.isim.bmp gold/$*.bmp > out/$*.isim.diff
test ! -s out/$*.isim.diff && touch $@
# keep copy for future reference
mkdir -p out/build_$*
test ! -s out/$*.isim.diff && touch out/build_$*/$*.isim.correct.txt
out/%.isim.1.correct.txt : out/%.isim.1.bmp
diff out/$*.isim.1.bmp gold/$*.bmp > out/$*.isim.1.diff
test ! -s out/$*.isim.1.diff && touch $@
# keep copy for future reference
mkdir -p out/build_$*
test ! -s out/$*.isim.1.diff && touch out/build_$*/$*.isim.1.correct.txt
No changes.
Oops, something went wrong.

0 comments on commit 5892886

Please sign in to comment.