1
0
forked from tanchou/Verilog
Files
Verilog_Louis/Semaine_4/UART/scripts/build.bat

46 lines
1.2 KiB
Batchfile
Raw Normal View History

2025-05-02 15:51:18 +02:00
@echo off
setlocal
2025-05-05 14:52:01 +02:00
rem === Aller à la racine du projet ===
cd /d %~dp0\..
2025-05-02 15:51:18 +02:00
rem === Config de base ===
set DEVICE=GW2AR-LV18QN88C8/I7
set BOARD=tangnano20k
set TOP=top_uart_loopback
set CST_FILE=%TOP%.cst
2025-05-05 14:52:01 +02:00
set JSON_FILE=runs/%TOP%.json
set PNR_JSON=runs/pnr_%TOP%.json
set BITSTREAM=runs/%TOP%.fs
2025-05-02 15:51:18 +02:00
rem === Créer le dossier runs si nécessaire ===
2025-05-05 14:52:01 +02:00
if not exist runs (
mkdir runs
2025-05-02 15:51:18 +02:00
)
echo === Étape 1 : Synthèse avec Yosys ===
2025-05-09 09:15:28 +02:00
yosys -p "read_verilog -sv src/verilog/%TOP%1.v IP/verilog/other_rx.v IP/verilog/rxuartlite.v IP/verilog/other_tx.v src/verilog/uart_rx.v src/verilog/uart_tx.v; synth_gowin -top %TOP% -json %JSON_FILE%"
2025-05-02 15:51:18 +02:00
if errorlevel 1 goto error
echo === Étape 2 : Placement & Routage avec nextpnr-himbaechel ===
2025-05-05 14:52:01 +02:00
nextpnr-himbaechel --json %JSON_FILE% --write %PNR_JSON% --device %DEVICE% --vopt cst=constraints/%CST_FILE% --vopt family=GW2A-18C
2025-05-02 15:51:18 +02:00
if errorlevel 1 goto error
echo === Étape 3 : Packing avec gowin_pack ===
gowin_pack -d %DEVICE% -o %BITSTREAM% %PNR_JSON%
if errorlevel 1 goto error
echo === Étape 4 : Flash avec openFPGALoader ===
openFPGALoader -b %BOARD% %BITSTREAM%
if errorlevel 1 goto error
2025-05-05 14:52:01 +02:00
echo === Compilation et flash réussis ===
2025-05-02 15:51:18 +02:00
goto end
:error
2025-05-05 14:52:01 +02:00
echo === Une erreur est survenue ===
2025-05-02 15:51:18 +02:00
:end
endlocal
pause