31 lines
857 B
Bash
Executable File
31 lines
857 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# --- CONFIGURATION ---
|
|
PROJECTNAME=SOC
|
|
DEVICE='GW2A-LV18PG256C8/I7'
|
|
BOARD='tangprimer20k'
|
|
BOARD_FREQ=27
|
|
CPU_FREQ=50
|
|
VERILOGS=$1
|
|
|
|
# --- Synthesis with Yosys ---
|
|
yosys -q -DPRIMER20K -DBOARD_FREQ=$BOARD_FREQ -DCPU_FREQ=$CPU_FREQ -D INV_BTN=0 -p "
|
|
read_verilog $VERILOGS;
|
|
synth_gowin -top $PROJECTNAME -json $PROJECTNAME.json -family gw2a" || exit 1
|
|
|
|
# --- Placement and Routing with nextpnr-himbaechel ---
|
|
nextpnr-himbaechel \
|
|
--json $PROJECTNAME.json \
|
|
--write $PROJECTNAME"_pnr.json" \
|
|
--device $DEVICE \
|
|
--vopt cst=BOARDS/$BOARD.cst \
|
|
--vopt family=GW2A-18 \
|
|
--freq $BOARD_FREQ || exit 1
|
|
|
|
# --- Bitstream Packing with gowin_pack ---
|
|
gowin_pack -d $DEVICE -o $PROJECTNAME.fs $PROJECTNAME"_pnr.json" || exit 1
|
|
|
|
# --- Programming with openFPGALoader ---
|
|
openFPGALoader -b tangprimer20k $PROJECTNAME.fs || exit 1
|
|
|