2015-04-24 01:32:07 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
for abits in 7 8 9 10 11 12; do
|
|
|
|
for dbits in 2 4 8 16 24 32; do
|
|
|
|
id="test_bram_${abits}_${dbits}"
|
2015-04-26 01:39:31 -05:00
|
|
|
iadr=$((RANDOM % (1 << abits)))
|
|
|
|
idat=$((RANDOM % ((1 << dbits) - 1) + 1))
|
2015-04-25 13:44:51 -05:00
|
|
|
sed -re "s/(ABITS = )0/\1$abits/g; s/(DBITS = )0/\1$dbits/g; s/(INIT_ADDR = )0/\1$iadr/g; s/(INIT_DATA = )0/\1$idat/g;" < test_bram.v > ${id}.v
|
|
|
|
sed -re "s/(ABITS = )0/\1$abits/g; s/(DBITS = )0/\1$dbits/g; s/(INIT_ADDR = )0/\1$iadr/g; s/(INIT_DATA = )0/\1$idat/g;" < test_bram_tb.v > ${id}_tb.v
|
2015-04-24 01:32:07 -05:00
|
|
|
../../../yosys -ql ${id}_syn.log -p "synth_ice40" -o ${id}_syn.v ${id}.v
|
2015-04-25 11:04:57 -05:00
|
|
|
# iverilog -s bram_tb -o ${id}_tb ${id}_syn.v ${id}_tb.v /opt/lscc/iCEcube2.2014.08/verilog/sb_ice_syn.v
|
|
|
|
iverilog -s bram_tb -o ${id}_tb ${id}_syn.v ${id}_tb.v ../cells_sim.v
|
2015-04-24 01:32:07 -05:00
|
|
|
./${id}_tb > ${id}_tb.txt
|
2015-04-25 11:04:57 -05:00
|
|
|
if grep -H ERROR ${id}_tb.txt; then false; fi
|
2015-04-24 01:32:07 -05:00
|
|
|
done; done
|
|
|
|
echo OK
|
|
|
|
|