A lightweight Go server that compiles Verilog projects using Yosys and nextpnr-ice40, streaming output in real-time.
- Receives Verilog source files via HTTP POST
- Compiles using Yosys + nextpnr-ice40 + icepack
- Streams compilation output in real-time using Server-Sent Events (SSE)
- Returns the compiled bitstream (.bin file) on success
Start the server:
docker-compose up --buildCheck health:
curl http://localhost:8080/healthTest the API:
make test-apiYou should see streaming output from yosys, nextpnr, and icepack!
Stop the server:
docker-compose downdocker build -t fpga-compiler .Or using docker-compose:
docker-compose builddocker run -p 8080:8080 fpga-compilerOr using docker-compose:
docker-compose upCompiles Verilog files and returns the bitstream.
Request Body:
{
"sources": {
"project.v": "module project_top(...); ... endmodule",
"other.v": "module other(...); ... endmodule"
},
"topModule": "tt_um_project_name"
}Response:
Server-Sent Events stream with JSON messages:
{"type": "command", "command": "yosys", "args": ["..."]}
{"type": "stdout", "data": "Output text..."}
{"type": "stderr", "data": "Error text..."}
{"type": "success", "data": "base64:...bitstream data..."}
{"type": "error", "message": "Error message"}Health check endpoint.
PORT- Server port (default: 8080)
# Install dependencies
go mod download
# Run locally (requires yosys, nextpnr-ice40, icepack installed)
go run main.go