Repository navigation
Software CPLD Logic Encoder Logic
Status: Draft Project: Enigma-NG Author: Izzyonstage & GitHub Copilot Version: v.0.1.0 Associated Hardware Revision: Rev A Last Updated: 2026-04-26
This document defines the intended logic-level requirements for the generic Encoder Module CPLD. It captures the behaviour that the future VHDL implementation must provide once prototype boards are available for timing and debounce tuning.
The active hardware direction is:
- one universal Encoder PCB per board position
- one Intel MAX II
EPM570T100I5Nper board - role chosen by the programmed CPLD image
- sampled digital debounce in the encode image
- no external per-line RC debounce network on the active board design
Board-level connector ownership, physical placement, and BOM authority remain in:
design/Electronics/Encoder/Design_Spec.mddesign/Electronics/Encoder/Board_Layout.md
This logic specification covers four behaviours:
- 64-bit sampled debounce for encode-role input banks
- 64-to-6 encoding for keyboard and plugboard encode roles
-
ENC_ACTIVE_Ngeneration / consumption for HID roles - 6-to-64 decoding for lightboard and plugboard decode roles
This document does not freeze the final VHDL syntax, timing-closure method, or Quartus project structure. Those items are deferred until the first prototype boards exist and the practical debounce constants can be measured.
The Encoder board is physically generic. Role is selected entirely by the CPLD image loaded onto the board based on its known JTAG-chain position.
| Image family | Used by | Primary function |
|---|---|---|
ENCODE |
KBD_ENC, PLG_PASS1_ENC, PLG_PASS2_ENC
|
Debounce and encode a one-of-64 input bank into ENC_DATA[5:0]
|
DECODE |
LBD_DEC, PLG_PASS1_DEC, PLG_PASS2_DEC
|
Decode ENC_DATA[5:0] into a one-of-64 output bank |
- No DIP switch, jumper, or strap is required for role selection in the active design.
- No role-specific RC population is required on the PCB.
- Assembly identity is provided by:
- the board's installed location
- the harness connected to
J3-J66 - the CPLD image programmed into that board
-
J3-J66is always treated as a 64-bit logical bank in the CPLD. - Logical bank ordering must stay stable between encode and decode images.
- The VHDL implementation shall preserve a one-to-one mapping between bank bit index and external terminal number.
- Encode-role input lines are active-low.
- Unasserted input = logic HIGH.
- Asserted input = logic LOW caused by a switch/jack closure.
- Decode-role output polarity must match the board-level harness/electrical intent for the target assembly.
- Only one output line may be asserted at a time during normal operation.
- All non-selected outputs must remain inactive.
- The encode-role implementation should enable the MAX II input-buffer features that best improve noise tolerance, including Schmitt-trigger behaviour where supported by the selected I/O standard.
- All encode-role input pins should have the MAX II weak pull-up configuration enabled so the idle state is held HIGH without requiring an external per-line pull-up bank.
- Bias strategy for idle-high inputs is therefore expected to use the MAX II weak pull-up setting as the active baseline, though schematic capture may still add external reinforcement later if prototype evidence shows it is necessary.
- The logic must assume active-low externally observed events.
-
ENC_ACTIVE_Nis an active-low sideband on the generic Encoder connector. - Idle / unused state = logic HIGH.
- Active HID event = logic LOW.
- The pin shall default HIGH through the MAX II weak pull-up behaviour or an equivalent schematic bias method if the role does not actively drive it.
Debounce is performed on the observed 64-bit bank state, not as 64 fully independent RC emulators. This preserves LE headroom while still filtering key and plugboard contact chatter.
The encode image shall implement:
- a periodic sample tick
- a 64-bit raw sampled bank register
- a 64-bit candidate bank register
- a 64-bit debounced/stable bank register
- a small stability counter or equivalent stable-sample tracker
The design may derive the sample tick from:
- the MAX II internal oscillator path, or
- another logic-side clocking method selected during implementation
No external debounce timing RC is assumed.
On each sample event:
- Capture the raw 64-bit input bank.
- Compare that sample against the current candidate bank.
- If the sample differs from the candidate bank:
- replace the candidate bank with the new sample
- reset the stability counter
- If the sample matches the candidate bank:
- increment the stability counter
- When the candidate bank has remained unchanged for the configured debounce threshold:
- commit it into the debounced/stable bank
Prototype testing must be allowed to tune:
- sample period
- number of consecutive matching samples required
- total debounce acceptance window
The active design intent is:
- reject short contact chatter
- accept real key/jack events quickly enough that the machine remains responsive
- avoid 64 separate long counters unless fitting results prove they are cheap enough
The debounce design should prefer:
- one shared sample-timebase
- one shared stability counter for the whole bank state
- bank-level state comparison
over:
- 64 independent counters or timers
unless prototype fit/timing review later proves a more granular scheme is both necessary and cheap.
The encode logic is designed around the normal operating assumption that zero or one bank line is asserted at a time after debounce.
- The encode image shall produce
ENC_DATA[5:0]from the debounced bank state. - The mapping from bank index
0..63toENC_DATA[5:0]shall be deterministic and fixed. - The mapping table must be documented in the final VHDL/package files used for implementation.
- The role-specific image shall also define the
ENC_ACTIVE_Nbehaviour for that assembly position.
The logic must define behaviour for:
- no asserted line
- more than one asserted line
The active requirement is:
- invalid bank states must not silently alias a different valid one-hot input
- the implementation may hold the previous valid output code, force a reserved diagnostic behaviour, or otherwise expose an internal invalid-state flag
The final invalid-state handling policy should be confirmed during prototype bring-up once the Stator-side bus sampling behaviour is exercised end-to-end.
This subsection describes the 64-character keyboard implementation of KBD_ENC.
For KBD_ENC:
- the physical assembly contains 40 populated switch positions
- the logical machine repertoire remains 64 characters:
a-zA-Z0-9+=
Required keyboard behaviour:
- Left Shift and Right Shift act as modifiers for alphabetic positions
- when either Shift input is active, alphabetic keys map to
A-Z - digits,
+, and=are not remapped by Shift - Shift keys are consumed as state modifiers rather than emitted as printable output codes
-
ENC_ACTIVE_Nshall be driven LOW only while a debounced printable keyboard event is active -
ENC_ACTIVE_Nshall return HIGH for the idle state and for invalid / ambiguous bank states unless prototype testing later defines a different explicit diagnostic behaviour
Variant / extension notes:
- A separate 26-character Enigma-style keyboard variant is also expected. That variant uses the same generic Encoder hardware but only a subset of the 64 available input pins, with the final logical mapping to be defined by its own dedicated keyboard-specific programming.
- The generic 64-input bank is intentionally broad enough to support other custom keyboard implementations for educational use.
- Beyond preserving that capability in the hardware platform, custom educational keyboard mappings are out of scope for the core Enigma-NG design logic and remain a classroom / follow-on activity.
For plugboard encode images:
- the encode result is the debounced logical identity of the currently asserted plugboard line
- no keyboard Shift remapping is involved
-
ENC_ACTIVE_Nis not used by the active Stator plugboard path and should therefore be held HIGH / inactive by the programmed image
The decode image shall accept ENC_DATA[5:0] and generate a one-of-64 output selection across
J3-J66.
- exactly one output line is active for any valid 6-bit code
- all other output lines remain inactive
- output transitions should be monotonic and deterministic for each code change
For LBD_DEC:
- the decode image mirrors the HID logical code space
- uppercase alphabetic codes illuminate the same physical alphabetic lamp position used for the corresponding lowercase letter
- no separate uppercase-only lamp positions exist
- when
ENC_ACTIVE_Nis HIGH, all decode outputs must remain inactive regardless of the 6-bit code - decode outputs may only illuminate a lamp while
ENC_ACTIVE_Nis LOW
For plugboard decode images:
- the 6-bit code selects exactly one destination line into the passive jack field
- identity continuity with the paired encode board must be preserved by the shared bank ordering
-
ENC_ACTIVE_Nis not used by the active plugboard decode path and may be ignored internally
- Each Encoder Module remains a standard MAX II device in the system JTAG chain.
- Programming software must load the correct image according to known board position.
- The active architecture assumes the programming flow, not local hardware switches, determines role.
The first hardware prototypes must be used to validate:
- actual contact bounce duration for keyboard switches
- actual bounce/noise behaviour of the plugboard jack path
- suitable sample period and debounce threshold
- encode invalid-state handling
- Quartus fit margin for the final encode image on
EPM570T100I5N
When implementation begins, the VHDL work should produce:
- a shared package defining bank ordering and code mapping
- one
ENCODEimage with sampled debounce and 64-to-6 logic - one
DECODEimage with 6-to-64 logic - simulation cases for:
- clean one-hot transitions
- bounce/noise sequences
- simultaneous invalid presses
- keyboard Shift behaviour
- plugboard pass-through identity cases
-
Design Log
- DEC-001 3v3-enig-used-throughout-3v3-system-removed-from-btb-interconnect
- DEC-002 poe-option-a2-selected-coilcraft-poe600f-12ld
- DEC-003 poe-output-12v-or-ing-priority-logic-required
- DEC-004 supercap-charge-current-05a-under-poe
- DEC-005 tps25980-efuse-replaces-tps259474l
- DEC-006 stusb4500-negotiates-15v5a-75w
- DEC-007 dual-interleaved-lmq61460-q1-5v-buck-12a
- DEC-008 tps25750-emulates-5v5a-pd-profile-to-cm5
- DEC-009 legacy-controller-probe-access-pin-14-reassigned-to-sw-led-ctrl
- DEC-010 inc-14-deferred-legacy-probe-access-esd-protection-post-prototype
- DEC-011 all-power-rails-on-power-module-3v3-enig-serves-rotor-stack
- DEC-012 u4-tps25750-replaced-with-tps25751drefr-nrnd-resolution
- DEC-013 l3-emi-inductor-changed-to-bourns-srp1265a-100m
- DEC-014 controller-board-uses-erf8-female-on-both-btb-connectors-for-blind-mate-assembly
- DEC-015 link-beta-connector-reduced-from-80-pin-to-40-pin-erf8-020-erm8-020
- DEC-016 jtag-controlled-impedance-and-series-termination
- DEC-017 minimum-4-layer-stackup-for-all-non-controller-boards
- DEC-018 connector-pinout-ownership-model
- DEC-019 poe-transformer-topology-acf-option-a-selected
- DEC-020 gnd-chassis-rib-clearway-enig-bond
- DEC-021 supercapacitor-bank-upgrade-2x2-2s2p-2x3-2s3p
- DEC-022 jdb-ft232h-clock-source-dedicated-12mhz-smd-crystal-selected
- DEC-023 jdb-gnd-chassis-omitted-mounting-holes-tied-to-gnd
- DEC-024 jdb-is-complete-jtag-master-controller-jtag-lines-are-pass-through
- DEC-025 cm5-shutdown-mechanism-hardware-driven-ltc3350-software-support-deferred
- DEC-026 rotor-position-encoder-as5600-replaced-with-single-track-capacitive-encoder
- DEC-027 rotor-position-readback-via-jtag-virtual-jtag-user0-udr
- DEC-028 split-dual-board-rotor-architecture
- DEC-029 supercapacitor-hold-up-specification-25f-abracon-cells-2s4p-20-s-at-15w
- DEC-030 5v-main-backup-switchover-transient-fix-r14-r30-c35
- DEC-031 cm5-virtual-keyboard-key-injection-feature-architecture
- DEC-032 settings-board-panel-mount-configuration-controls-with-cm5-override
- DEC-033 dsi1-display-connector-provision-for-optional-lid-touchscreen
- DEC-034 switch-hardware-refresh-settings-board-toggle-discrete-rgb-led-ruggedized-pm-sw1
- DEC-035 hid-keyboard-and-lightboard-use-a-40-position-qwerty-derived-layout-for-the-64-character-code-space
- DEC-036 link-beta-former-monitor-pins-reallocated-as-grouped-power-rails
- DEC-037 link-beta-pin-map-regrouped-around-dedicated-jtag-and-i2c-guard-bands
- DEC-038 controller-centric-dock-architecture-replaces-legacy-link-alpha-link-beta-backplane
- DEC-039 enclosure-connected-boards-use-gnd-chassis-daughterboards-are-exempt
- DEC-040 diagnostics-banks-removed-from-active-design-specs-pending-coupon-review
- DEC-041 encoder-modules-use-epm570-with-digital-debounce-and-role-by-programming
- DEC-042 encoder-port-pin-8-carries-hid-local-enc-active-n
- DEC-043 shared-actuation-module-replaces-direct-controller-servo-gpio
- DEC-044 fdc2114-internal-oscillator-selected-clkin-gnd
- DEC-045 rotor-samtec-erm8erf8-connectors-require-esd-protection
- DEC-046 bypassdecoupling-capacitor-voltage-rating-50v-retained-on-all-non-pm-boards
- DEC-047 or-ing-mosfet-corrected-to-csd17578q5a
- DEC-048 esd-protection-extended-to-host-side-rotor-facing-btb-connectors
- DEC-049 rotor-internal-headers-renamed-to-j-convention-connector-count-updated-to-8-bom-unified
- DEC-050 encoder-blade-terminal-refdes-corrected-from-bt-to-j-convention
- DEC-051 settings-board-renamed-to-user-settings-module-board-code-sbd-usm
- DEC-052 variant-specific-fdc2114-refdes-use-ab-suffix-convention
- DEC-053 extension-port-connector-upgraded-from-bhr-20-vua-20-pin-to-2bhr-30-vua-30-pin
- DEC-054 signal-net-renamed-pwr-but-pwr-but-n-active-low-suffix-conformance
- DEC-055 f-108-system-wide-reference-designator-and-requirement-id-consecutive-renumbering
- DEC-056 relocate-investigation-documents-to-board-owned-folders
- DEC-057 daughterboard-mounting-hole-specification-and-standoff-bom-ownership
- DEC-058 jdb-connector-upgrade-hat-headers-to-df40c-20-btb
- DEC-059 erm8erf8-stacking-height-confirmed-rotor-stack-assembly-specification-created
- DEC-060 jtag-daughterboard-renamed-to-jtag-module-jdb-prefix-replaced-with-jm
- DEC-061 pass-7-review-corrections-ctlstarotencamgrsstatus-updates
- DEC-062 ctl-poe-t1-selection-tdk-b82806d0060a120-topology-acf-flyback-acf-forward
- DEC-063 ctl-poe-l1-selection-yageo-pa4343333nlt-acf-forward-output-inductor
- DEC-064 ctl-poe-c17-final-part-selection-kemet-c0805c223k2racauto-22nf-200v-x7r-0805
- DEC-065 system-wide-stackup-code-correction-and-jlcpcb-authoritative-impedance-values
- DEC-066 grs-canonical-pcb-stackup-authority-consolidation
- DEC-067 am-sw1sw2-tactile-switch-rating-accepted-for-production
- DEC-068 pm-per-input-bulk-capacitors-and-output-source-quality-bulk-banks
- DEC-069 pm-per-input-polyfuse-protection-and-uvlo-resistor-recalculation
- DEC-070 mcp23017-i²c-silicon-restriction-gpb7gpa7-review-and-cfg-apply-n-reassignment
- DEC-071 usm-spdt-switch-dual-terminated-wiring-and-pull-down-resistor-removal
- DEC-072 review-pass-9-findings-and-resolutions
- DEC-073 ltc3350-rt-resistor-correction-332-kω-133-kω-amends-dec-030
- DEC-074 rename-cpld-reset-signal-sys-reset-n-cpld-reset-n
- DEC-075 tps25751-option-c-external-eeprom-isolated-i2ct-debug-header-on-power-module
- DEC-076 pm-3v3-architecture-redesign-3v3-main3v3-enig-rail-split-j4-dual-purpose-programming-j6-removal-and-q12-parallel-p-fet-selection
- DEC-077 retrospective-rotor-ttd-daisy-chain-no-series-termination-resistors-amends-dec-016
- DEC-078 cpld-reset-n-stator-buffer-bss138-n-channel-mosfet-new-decision-references-dec-077
- DEC-079 c20-voltage-rating-correction-25v-35v-amends-dec-072-bom-item-1
- DEC-080 retrospective-pm-and-stator-dock-connector-redesignation-amends-dec-038
- DEC-081 retrospective-rotor-ttd-no-series-resistor-policy-in-addition-to-dec-016
- DEC-082 10µf-bulk-reservoir-capacitor-upgrade-25v-0805-50v-1206-all-boards
- DEC-083 retire-all-boards-bomjson-consolidate-bom-authority-in-design-spec-files-and-consolidated-bom
- DEC-084 cypher-stack-architecture-migration-and-board-role-consolidation
- DEC-085 stack-output-j4-power-pin-zero-ohm-links-prototype-test
- DEC-086 cypher-input-common-variant-restructure-10-numeric-variant-single-i2c-address
- DEC-087 cypher-input-led-colour-architecture-moved-off-plain-bits-onto-local-rgb-select-circuit
- DEC-088 plugboard-jacks-wired-directly-to-cypher-board-spade-bank-j4j6-reserves-5v-main
- DEC-089 board-role-id-widened-to-4-bit-capability-bitmask-cpld-pin-freeing-and-j5-migration
- DEC-090 cypher-board-j3-stack-input-side-full-50-pin-allocation-and-actuate-request-in-out-n-signal-pair
- DEC-091 j3-esd-protection-extended-to-actuate-request-pins-and-actuation-gating-resolved-to-cypher-cpld
- DEC-092 cypher-board-j4-stack-output-side-full-50-pin-allocation
- DEC-093 actuate-request-end-to-end-signal-path-j4-rename-rotor-interposer-connectors-extended
- DEC-094 connector-ownership-reassignment-for-reused-chain-templates
- DEC-095 actuate-request-esd-protection-completed-stack-output-passive-wiring-defined
- DEC-096 stack-blanking-board-corrected-actuate-request-bridging-added
- DEC-097 cypher-j3-actuate-request-out-n-wired-as-round-trip-verification-input
- DEC-098 controller-cypher-dock-split-power-molex-signal-samtec-amends-dec-038-dec-080
- DEC-099 cm5-i2c-bank-architecture-mipi0-to-mipi1-swap-pwm-gpclk-reservation
- DEC-100 jtag-module-actuation-module-retirement-from-controller-board
- DEC-101 cypher-ina219-i2c-address-aligned-to-pm-default
- DEC-102 cypher-ft232h-3v3-vregin-self-powered-5v-usb-net-retired
- DEC-103 hid-usm-hub-connector-topology-rework
- DEC-104 user-settings-module-role-reworked-as-hid-colour-audio-hub-and-jtag-i2c-spine
- DEC-105 cfg-route-moved-to-full-cm5-software-control-physical-usm-switches-retired
- DEC-106 cypher-plugboard-reduced-to-mechanical-connector-only-board
- DEC-107 usm-hid-connector-four-colour-style-signal-expansion
- index
-
Diagrams
- renders
-
Electronics
- Boards Overview
- Consolidated BOM
- Electrical Design
- Power Budgets
- System Architecture
- Actuation Module
- Controller
- Cypher
- Cypher-Input
- Cypher-Output
- Cypher-Plugboard
- Encoder Module
- Extension
- JTAG Module
- Power Module
- Reflector
- Rotor
- Stack-Blanking
- Stack-Input
- Stack-Interposer
- Stack-Output
- Stator
- User Settings Module
-
Guides
-
Mechanical
- Complete System Assembly
- Extension
- Keyboard Assembly
- Lightboard Assembly
- Main Enclosure
- Plugboard Assembly
- Power Module
- Reflector
- Rotor
- Rotor Actuation Assembly
- Rotor Stack Assembly
-
Procedures
-
Production
-
Software
- Actuation Module
- CPLD Logic
-
GUI App
- Design Spec
-
Wireframes
- README
- renders
- Linux OS
-
Standards