#!/usr/bin/env bash
name=$1
yosys -D LEDS_NR=8 -p "read_verilog ${name}.v; synth_gowin -json ${name}.json"
nextpnr-gowin --json ${name}.json --write pnr${name}.json  --device GW1NSR-LV4CQN48PC7/I6 --cst tangnano4k.cst 
gowin_pack -d  GW1NSR-LV4CQN48PC7/I6 -o pack.fs pnr${name}.json
openFPGALoader -b tangnano4k pack.fs
