#!/bin/bash

YOSYS_LIBDIR=".:library"
YOSYS_OPTS=
YOSYS_V_OPTS=-noautowire

FN=$1

yosys ${YOSYS_OPTS} <<EOF~
read_verilog ${YOSYS_V_OPTS} "${FN}.v"
$( IFS=':'; for LD in ${YOSYS_LIBDIR}; do echo hierarchy -libdir ${LD} ; done )
synth_ice40 -top ${FN} -json ${FN}.json
EOF~


