run.sh 6.64 KB
Newer Older
1 2
#!/bin/bash

3
set -x
4 5 6 7 8 9
test -d $1

rm -rf $1/work_$2
mkdir $1/work_$2
cd $1/work_$2

10 11
touch .start

12 13
# cases where 'syntax error' or other errors are expected
if echo "$1" | grep ".*_error"; then
14

15
	expected_string=""
16
	# Change checked string for check other errors
17 18 19 20 21
	if echo "$2" | grep ".*_fully_selected"; then
		expected_string="ERROR: This command only operates on fully selected designs!"
	elif [ "$2" = "synth_greenpak4_invalid_part" ]; then
		expected_string="ERROR: Invalid part name: "
	elif [ "$2" = "synth_intel_invalid_family" ]; then
22
		expected_string="ERROR: Invalid or no family specified:"
23
	elif [ "$2" = "synth_xilinx_invalid_arch" ]; then
Miodrag Milanovic committed
24
		expected_string="ERROR: Invalid Xilinx -family setting: "
25 26 27 28 29 30 31 32
	elif [ "$2" = "synth_xilinx_widemux_1" ]; then
		expected_string="ERROR: -widemux value must be 0 or >= 2."
	elif [ "$2" = "synth_xilinx_abc9_retime" ]; then
		expected_string="ERROR: -retime option not currently compatible with -abc9!"
	elif [ "$2" = "synth_ice40_abc9_retime" ]; then
		expected_string="ERROR: -retime option not currently compatible with -abc9!"
	elif [ "$2" = "synth_ice40_device_unknown" ]; then
		expected_string="ERROR: Invalid or no device specified: "
33
	fi
34

35 36 37 38 39 40 41 42 43
	if yosys -ql yosys.log ../../scripts/$2.ys; then
		echo FAIL > ${1}_${2}.status
	else
		if  grep "$expected_string" yosys.log && [ "$expected_string" != "" ]; then
			echo PASS > ${1}_${2}.status
		else
			echo FAIL > ${1}_${2}.status
		fi
	fi
44
else
45

46 47
	if [ -f ../run-test.sh ]; then
		../run-test.sh
48 49 50 51 52
		if [ $? != 0 ] ; then
			echo FAIL > ${1}_${2}.status
		else
			echo PASS > ${1}_${2}.status
		fi
53
		touch .stamp
54 55 56 57 58 59 60 61 62
		exit
	else
		test -f scripts/$2.ys
		yosys -ql yosys.log ../../scripts/$2.ys
		if [ $? != 0 ] ; then
			echo FAIL > ${1}_${2}.status
			touch .stamp
			exit 0
		fi
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
	fi
	if [ -f "../../../../../techlibs/common/simcells.v" ]; then
		COMMON_PREFIX=../../../../../techlibs/common
		TECHLIBS_PREFIX=../../../../../techlibs
	else
		COMMON_PREFIX=/usr/local/share/yosys
		TECHLIBS_PREFIX=/usr/local/share/yosys
	fi

	if [ "$1" = "synth_ecp5" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/ecp5/cells_sim.v
	elif [ "$1" = "synth_ecp5_wide_ffs" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/ecp5/cells_sim.v
	elif [ "$1" = "synth_achronix" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/achronix/speedster22i/cells_sim.v
	elif [ "$1" = "synth_anlogic" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/anlogic/cells_sim.v
	elif [ "$1" = "synth_anlogic_fulladder" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/anlogic/cells_sim.v
	elif [ "$1" = "synth_anlogic_mem" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/anlogic/cells_sim.v  $TECHLIBS_PREFIX/anlogic/eagle_bb.v
	elif [ "$1" = "synth_coolrunner2" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/coolrunner2/cells_sim.v
	elif [ "$1" = "synth_coolrunner2_fulladder" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/coolrunner2/cells_sim.v
	elif [ "$1" = "synth_gowin" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/gowin/cells_sim.v
	elif [ "$1" = "synth_gowin_mem" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/gowin/cells_sim.v
	elif [ "$1" = "synth_ice40" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/ice40/cells_sim.v
	elif [ "$1" = "synth_ice40_mem" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/ice40/cells_sim.v
	elif [ "$1" = "synth_ice40_wide_ffs" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/ice40/cells_sim.v
98 99
	elif [ "$1" = "synth_ice40_fulladder" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/ice40/cells_sim.v
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
	elif [ "$1" = "synth_intel" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/intel/max10/cells_sim.v
	elif [ "$1" = "synth_intel_a10gx" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/intel/a10gx/cells_sim.v
	elif [ "$1" = "synth_intel_cycloneiv" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/intel/cycloneiv/cells_sim.v
	elif [ "$1" = "synth_intel_cycloneive" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/intel/cycloneive/cells_sim.v
	elif [ "$1" = "synth_intel_cyclone10" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/intel/cyclone10/cells_sim.v
	elif [ "$1" = "synth_intel_cyclonev" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/intel/cyclonev/cells_sim.v
	elif [ "$1" = "synth_sf2" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/sf2/cells_sim.v
	elif [ "$1" = "synth_xilinx" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/xilinx/cells_sim.v
	elif [ "$1" = "synth_greenpak4" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/greenpak4/cells_sim_digital.v
	elif [ "$1" = "synth_greenpak4_wide_ffs" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/greenpak4/cells_sim_digital.v
120 121
	elif [ "$1" = "synth_greenpak4_dffs_r" ]; then
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v $TECHLIBS_PREFIX/greenpak4/cells_sim_digital.v
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
	else
		iverilog -o testbench  ../testbench.v synth.v ../../common.v $COMMON_PREFIX/simcells.v
	fi
	if [ $? != 0 ] ; then
		echo FAIL > ${1}_${2}.status
		touch .stamp
		exit 0
	fi

	if ! vvp -N testbench > testbench.log 2>&1; then
		grep 'ERROR' testbench.log
		echo FAIL > ${1}_${2}.status
	elif grep 'ERROR' testbench.log || ! grep 'OKAY' testbench.log; then
		echo FAIL > ${1}_${2}.status
	else
		echo PASS > ${1}_${2}.status
	fi

140 141 142
fi

touch .stamp