Skip to content

martinrz/dupal

Repository files navigation

DuPAL Workspace

Fork of the DuPAL-PAL-DUmper project. Original hardware and toolchain by the DuPAL-PAL-DUmper contributors. This repository adds a unified GUI, active learning (AALpy) integration, Pi Zero deployment support, and firmware extensions.

A workspace for dumping and reverse-engineering PALs, GALs, ROMs, and other combinatorial ICs using the DuPAL V3 "dupico" board (Raspberry Pi Pico / RP2040).


What this fork adds

Addition Description
dupal_gui.py Unified Tkinter GUI wrapping the full workflow in one window
AALpy integration Active automata learning tab — learns a state machine directly from a sequential IC
AALpy firmware assist Batch membership-query mode (cmds 0x0A/0x0B) — one USB transfer per query instead of one per step
Pi Zero tab SSH-based deploy panel to program a Raspberry Pi Zero with the DuPAL tools
Firmware docs FIRMWARE_INTERNALS.md — architecture reference; BUILD_AND_FLASH.md — step-by-step build guide
Flash storage Persistent Wi-Fi credentials stored in RP2040 flash
Wi-Fi task Optional TCP bridge exposing the binary protocol over the network

Repository layout

dupal/
├── dupico_firmware/   # C — RP2040 firmware for the dupico board
├── espresso-logic/    # C — Espresso heuristic logic minimizer
├── dupicolib/         # Python lib — serial comms with dupico
├── dpdumperlib/       # Python lib — shared dumper utilities
├── dpanalib/          # Python lib — shared analysis utilities
├── dpdumper/          # Python tool — dump combinatorial ICs
├── dppeeper/          # Python tool — visual IC analysis
├── dpdump2tab/        # Python tool — convert dumps to espresso truth tables
├── dupal_gui.py       # Python — unified Tkinter GUI for the whole workflow
└── projects/          # JSON project files (one per IC under test)

Tool overview

dupico_firmware

Firmware that runs on the Pico. Exposes a USB virtual serial port using a binary protocol. Must be flashed before using any of the host tools. See dupico_firmware/BUILD_AND_FLASH.md for full build and flash instructions.

espresso-logic

Standalone C binary. Takes a truth table and produces a minimized sum-of-products expression. Used as the final step after dumping a combinatorial IC.

dupicolib

Python library. Handles the low-level binary protocol for communicating with the dupico over USB serial. Required by dpdumper and dppeeper.

dpdumperlib

Python library. Shared data structures and utilities for the dumping workflow. Required by dpdumper and dpdump2tab.

dpanalib

Python library. Shared analysis utilities. Required by dppeeper.

dpdumper

Python tool. Connects to a dupico and dumps basic combinatorial ICs. Outputs a dump file.

dppeeper

Python tool. Connects to a dupico and performs visual/interactive analysis of an IC's behavior.

dpdump2tab

Python tool. Converts a dpdumper dump file into an Espresso-compatible truth table, ready to pass to espresso-logic.

dupal_gui.py

Unified Tkinter GUI that wraps the entire workflow in a single window. Run with:

python dupal_gui.py

Tabs:

Tab Function
Connection Select IC definition (TOML), connect via USB serial or WiFi (TCP port 23), set dupico address
Dump Run dpdumper to dump a combinatorial IC to a binary file
Analyze Run dppeeper for interactive pin-state analysis
BIN→PLA Run dpdump2tab to convert a dump to an Espresso truth table
Espresso Run espresso-logic to minimize a PLA truth table
Equations Display boolean equations from a .pla or .jed file, with project signal names applied
JED Read/write JEDEC files; convert BIN↔JED; generate .pld source files from JED

Project files (projects/*.json):

Each project file stores a name, IC definition path, per-pin signal names, and notes. The project bar at the top of the window lets you create, edit, and switch between projects. Signal names from the active project are applied automatically in the Equations and JED tabs.

{
  "name": "GAL16V8 Gatter",
  "ic_def": "dpanalib/examples/GAL16V8.toml",
  "signals": { "1":"B", "2":"C", "19":"A", "18":"W", "17":"/X", "16":"Y", "15":"Z" },
  "notes": "W=A·B·C, /X=D·E (NAND), Y=F+G, Z=H·I+J·K"
}

JED→PLD device support:

The JED tab can generate a .pld source file from any of the following devices:

Device QF Output type Notes
GAL16V8 2194 / 2200 GALasm .pld Programmable I/O macrocells
PAL10L8 / PAL10H8 320 CUPL 10 in, 8 out, 2 PT/output
PAL12L6 / PAL12H6 384 CUPL 12 in, 6 out
PAL14L4 / PAL14H4 448 CUPL 14 in, 4 out
PAL16L2 / PAL16H2 512 CUPL 16 in, 2 out, 8 PT/output
PAL16L8 2048 CUPL 16 in, 8 out, OE per output
PAL16R4 / R6 / R8 2048 CUPL 4/6/8 registered outputs
PAL20L8 2560 CUPL 20 in, 8 out, OE per output
PAL20L10 1600 CUPL 20 in, 10 out
PAL20R4 / R6 / R8 2560 CUPL 4/6/8 registered outputs
PAL22V10 / PALCE22V10 5828 CUPL Per-pin polarity + reg/comb macrocells
GAL20V8 2706 CUPL Mode-dependent (reg / comb-complex / comb-simple)
GAL22V10 5892 CUPL Same as PAL22V10 + 64 extra fuses

When multiple devices share the same QF (e.g. PAL16L8/R4/R6/R8 all have QF=2048), the first entry is used by default and the log shows which alternatives also match.


Typical workflows

Combinatorial IC analysis (GUI)

python dupal_gui.py
  │
  ├─ Connection tab  → select IC TOML, connect to dupico
  ├─ Dump tab        → run dpdumper → .bin dump file
  ├─ BIN→PLA tab     → run dpdump2tab → .pla truth table
  ├─ Espresso tab    → run espresso → minimized .pla
  └─ Equations tab   → display human-readable equations

PAL/GAL reverse engineering (GUI)

python dupal_gui.py
  │
  ├─ Projects        → create project, assign signal names to pins
  ├─ Connection tab  → connect to dupico
  ├─ Dump tab        → dump PAL to .bin
  ├─ JED tab         → BIN→JED conversion
  ├─ JED tab         → JED→PLD (generates CUPL/GALasm source)
  └─ Equations tab   → display equations from the .jed file

Command-line workflow

IC in socket
    │
    ▼
dpdumper  ──────────────────► dump file
    │
    ▼
dpdump2tab ─────────────────► truth table (.pla)
    │
    ▼
espresso-logic ──────────────► minimized logic equations

For interactive analysis instead of a full dump:

IC in socket
    │
    ▼
dppeeper ───────────────────► visual pin-state analysis

Quick start — batch files

File What it does
setenv.bat Sets all required environment variables. Run with call setenv.bat in an existing cmd session.
build_all.bat Builds dupico_firmware, espresso-logic, and installs all Python tools in one shot.
cd E:\Dropbox\_Claude\dupal
build_all.bat

Building everything (manual)

Prerequisites (Windows / MSYS2)

Tool Location
ARM GNU Toolchain 14.3 C:/Program Files (x86)/Arm GNU Toolchain arm-none-eabi/14.3 rel1/bin/
CMake 4.x C:/Program Files/CMake/bin/
Ninja C:/Users/Martin/AppData/Roaming/Python/Python314/Scripts/ninja.exe
MinGW64 GCC 10 /c/msys64/mingw64/bin/
Pico SDK ~/pico-sdk
FreeRTOS-Kernel ~/FreeRTOS-Kernel
Python 3.14 C:/Python314/python.exe

1. dupico_firmware

export PICO_SDK_PATH=~/pico-sdk
export FREERTOS_KERNEL_PATH=~/FreeRTOS-Kernel
export PATH="/c/msys64/mingw64/bin:/c/Users/Martin/AppData/Roaming/Python/Python314/Scripts:$PATH"

cd dupico_firmware
cmake -B build -S . -G Ninja
cmake --build build
# Output: build/src/dupico.uf2

2. espresso-logic

export PATH="/c/msys64/mingw64/bin:$PATH"

cd espresso-logic/espresso-src
make
# Output: ../bin/espresso.exe

3. Python tools

Install in dependency order (from the workspace root):

pip install -e dupicolib
pip install -e dpdumperlib
pip install -e dpanalib
pip install -e dpdumper
pip install -e dppeeper
pip install -e dpdump2tab

Executables (dpdumper.exe, dppeeper.exe, dpdump2tab.exe) are installed to C:/Users/Martin/AppData/Roaming/Python/Python314/Scripts/.

About

Fork of the DuPAL-PAL-DUmper toolchain — adds unified GUI, AALpy active learning, firmware extensions, and Pi Zero deployment

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors