yosys/backends/btor/verilog2btor.sh

38 lines
609 B
Bash
Raw Normal View History

2014-01-18 14:54:52 -06:00
#!/bin/sh
#
# Script to writing btor from verilog design
#
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 "
read_verilog -sv $1;
2014-01-18 14:54:52 -06:00
hierarchy -top $3;
hierarchy -libdir $DIR;
hierarchy -check;
2014-01-24 08:00:43 -06:00
proc;
opt; opt_const -mux_undef; opt;
2014-01-24 08:00:43 -06:00
rename -hide;;;
#techmap -share_map pmux2mux.v;;
splice; opt;
memory_dff -wr_only;
memory_collect;;
2014-01-24 08:00:43 -06:00
flatten;;
memory_unpack;
splitnets -driver;
setundef -zero -undriven;
opt;;;
2014-01-18 14:54:52 -06:00
write_btor $2;"