aboutsummaryrefslogtreecommitdiffstats
path: root/backends/btor/verilog2btor.sh
blob: a2f9ebc7ef8ab93a667e28564d4046693a7f17e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/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)

./yosys -q -p "
read_verilog $1; 
hierarchy -top $3; 
hierarchy -libdir $DIR; 
hierarchy -check; 
proc; 
opt; opt_const -mux_undef; opt;
rename -hide;;;
techmap -share_map pmux2mux.v;;
memory -nomap;;
flatten;;
memory_unpack; 
splitnets -driver;
setundef -zero -undriven;
opt;;;
write_btor $2;"