2014-01-18 14:54:52 -06:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#
|
2015-08-14 15:23:01 -05:00
|
|
|
# Script to write BTOR from Verilog design
|
2014-01-18 14:54:52 -06:00
|
|
|
#
|
|
|
|
|
|
|
|
if [ "$#" -ne 3 ]; then
|
|
|
|
echo "Usage: $0 input.v output.btor top-module-name" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if ! [ -e "$1" ]; then
|
|
|
|
echo "$1 not found" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
FULL_PATH=$(readlink -f $1)
|
|
|
|
DIR=$(dirname $FULL_PATH)
|
|
|
|
|
2014-01-24 08:00:43 -06:00
|
|
|
./yosys -q -p "
|
2015-07-02 04:14:30 -05:00
|
|
|
read_verilog -sv $1;
|
|
|
|
hierarchy -top $3;
|
|
|
|
hierarchy -libdir $DIR;
|
|
|
|
hierarchy -check;
|
|
|
|
proc;
|
2016-03-31 01:43:28 -05:00
|
|
|
opt; opt_expr -mux_undef; opt;
|
2014-01-24 08:00:43 -06:00
|
|
|
rename -hide;;;
|
2015-04-08 05:13:53 -05:00
|
|
|
#techmap -map +/pmux2mux.v;;
|
2014-02-12 06:38:28 -06:00
|
|
|
splice; opt;
|
2014-02-11 06:06:01 -06:00
|
|
|
memory_dff -wr_only;
|
2014-02-03 06:01:45 -06:00
|
|
|
memory_collect;;
|
2014-01-24 08:00:43 -06:00
|
|
|
flatten;;
|
2015-07-02 04:14:30 -05:00
|
|
|
memory_unpack;
|
2014-01-24 08:00:43 -06:00
|
|
|
splitnets -driver;
|
|
|
|
setundef -zero -undriven;
|
|
|
|
opt;;;
|
2014-01-18 14:54:52 -06:00
|
|
|
write_btor $2;"
|
|
|
|
|