ESP-FPGA-SIM is a tiny educational tool that pretends your ESP32 is an FPGA so you don't have to buy an actual FPGA to learn digital logic (cus we are broke). It serves a web UI, accepts simple VHDL-like concurrent assignments, evaluates logic rules, and toggles GPIOs accordingly.
This README has two personalities:
- The easy route (Arduino): "be a good boy" — use Arduino IDE or PlatformIO, and everything will mostly just work.
- The i know my shit route (ESP-IDF + FreeRTOS): "suffer a little" — more power, more control, and the joy of wrestling with
esp_netifandgpio_config_tbitmasks at 2 AM With 3 white Monsters worth of caffine.
Pick your Path and I'll guide you.
Quick facts
- SoftAP SSID:
ESP32_FPGASim - SoftAP password:
12345678 - Websocket endpoint (Arduino sketch):
/ws - Upload rules API:
POST /updateLogicwith JSON{ "rules": [{"output": 19, "expression": "(A&B)|!C"}, ...] }
Files you care about
ESP32_LogicSim.ino— Arduino sketch (easy mode)esp-idf/— native ESP-IDF port (hard mode, includesmain/withmain.cpp,LogicEngine.h,PinMap.h,WebInterface.h)LogicEngine.h— expression parser/evaluatorPinMap.h— change inputs (A..G) and outputs hereWebInterface.h/webpage/— the web UI (embedded strings and local editable copy)
Pins (defaults — change them in PinMap.h if you like pain-free reconfiguration)
- Inputs A..G:
26, 27, 25, 33, 32, 35, 34 - Outputs:
19, 18, 5, 17, 16, 4, 0, 2
Watch out: some pins are input-only or affect boot. If you set an output on a boot pin you will learn the meaning of the word "brick".
Operators supported (translator and evaluator)
- AND →
& - OR →
| - XOR →
^ - NOT →
! - NAND →
~& - NOR →
~| - XNOR →
~^
Example VHDL (paste into the UI):
P19 <= (A and B) or not C;
P18 <= A xor B;
How to use — Arduino (the "good boy" route)
- Open the
.inoin Arduino IDE or import into PlatformIO. - Make sure you have these libraries installed:
ESPAsyncWebServer,AsyncTCP,ArduinoJson. - Build and flash to ESP32.
- Connect to WiFi SSID
ESP32_FPGASim(pw12345678) and openhttp://192.168.4.1/.
This path is fast, forgiving, and ideal if you want to hack VHDL → logic without wrestling with SDK internals.
How to use — ESP-IDF + FreeRTOS (the "suffer a little" route)
- Install ESP-IDF. Follow the official guide: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/
- Open PowerShell and initialize the ESP-IDF environment (use the
export.bator the PowerShell shortcut provided by the installer). - From this repo, change into
esp-idf/and run these commands:
cd '~\ESP-FPGA-SIM\esp-idf'
idf.py set-target esp32
idf.py menuconfig
idf.py build
idf.py -p <PORT> flash monitorReplace <PORT> with your serial port (COMx). If you enjoy debugging, leave out the -p and stare at the logs until you feel enligh.
Notes about the ESP-IDF port
- The native port uses
esp_http_serverandcJSON(no Arduino core required). - The web UI is embedded in
main/WebInterface.hso you can flash a single binary and be done. - The client will attempt WebSocket for live pin updates but falls back to polling
/pinsif needed.
Which should you pick?
- Want fast iteration, familiar APIs, and to avoid RTOS headaches? Use Arduino. Be a good boy.
- Want more control, lower-level networking, and the joy of explicit init sequences? Use ESP-IDF and join the suffering club.
Troubleshooting quick hits
- If the page doesn't update live, check the websocket or
/pinspolling endpoint. - If outputs don't change, inspect serial logs and make sure your rules uploaded successfully.
- If flashing fails, double-check pin usage: avoid using boot-changing pins as outputs during development.
Want me to help? I can:
- Move the web UI to LittleFS so you can edit JS/CSS without rebuilding.
- Add a native WebSocket server for push updates.
- Run a static scan and fix compile errors in the ESP-IDF port.
If you want the comfy chair and instant gratification, go Arduino. If you want to feel like a systems engineer and earn your bragging rights, go ESP-IDF. Either way, you'll end up with blinking LEDs and maybe a slightly bruised ego.
LMFAOOO