A nibble-oriented CPU in Verilog to build a scientific calculator
The core question: how did HP's scientific calculators actually work at the gate level? That rabbit hole led to building one from scratch. The architectural decision everything else follows from: a decimal calculator should store numbers as BCD — one decimal digit per 4-bit nibble. A standard byte-oriented CPU (Z80, 6502) fights that layout constantly. So I designed a small custom CPU in Verilog where 4 bits is the natural data width and memory is nibble addressable. What the project covers: - Custom CPU: Harvard architecture, 12-bit ISA, 8-state execution FSM, hardware stack guard with a…
In plain words
This project is a custom CPU designed in Verilog specifically for building scientific calculators, inspired by how HP calculators operated at the hardware level. The CPU uses a nibble-oriented architecture (4-bit data width) with BCD number storage, making it naturally suited for decimal calculations rather than forcing them through byte-oriented processors. It includes a Harvard architecture, custom instruction set, hardware stack protection, and CORDIC algorithms for trigonometric functions. The project provides a two-pass assembler, simulation framework compatible with multiple platforms including WebAssembly, and supporting documentation for understanding calculator design fundamentals.
written from the facts on this page · September 2026
From the sources
In the maker’s words, at launch
The core question: how did HP's scientific calculators actually work at the gate level? That rabbit hole led to building one from scratch. The architectural decision everything else follows from: a decimal calculator should store numbers as BCD — one decimal digit per 4-bit nibble. A standard byte-oriented CPU (Z80, 6502) fights that layout constantly. So I designed a small custom CPU in Verilog where 4 bits is the natural data width and memory is nibble addressable. What the project covers: - Custom CPU: Harvard architecture, 12-bit ISA, 8-state execution FSM, hardware stack guard with a FAULT state for microcode debugging - CORDIC for trig functions, verified to 14 significant digits - Two-pass assembler in Python (~700 lines) - Verilator + Qt framework: same Verilog source runs in simulation, as a desktop GUI debugger, as WebAssembly, and on real hardware - Scripting language on top of the microcode for adding functions without touching hardware - Custom PCB (EasyEDA/JLCPCB), battery, charging circuit Write-up: https://baltazarstudios.com Hackaday: https://hackaday.com/2026/05/13/build-the-cpu-then-build-the...
Does the same job
all alternatives →- OSOpen-source engine running Gemma 4 26B in 2 GB RAM on any M-series MacJul 2026 · github.com · ▲919
Hi HN, I built a specialized inference engine for running 4-bit Gemma 4 26B-A4B-IT on any M-series Mac using about 2 GB of RAM. It is called TurboFieldfare and is written in Swift and Metal. I have always adored on-device AI. It feels like magic that you can run a powerful NN on your Mac or iPhone. So I wanted to push the limits a bit and run a model whose weights don’t fit in memory. The model’s 4-bit quantized weights occupy roughly 14 GB, which makes running it with conventional inference tools almost impossible on an 8 GB or even 16 GB Mac once the OS, applications, and KV cache are…
- WBWe built an 8-bit CPU as 2nd year EE studentsJun 2026 · github.com · ▲108
Hi! me and my friends together built an 8 bit CPU implemented in Logisim purely from scratch. The control unit of this system does not implement the generic microcode ROM or any kind of RAM. This was made purely from discrete logic gates and coded the system to run different programs. key features: Custom 16-instruction Harvard ISA, 8-bit fixed format, 4 general purpose registers Hardwired control unit built entirely from AND/OR gate logic matrix Dual-phase clocking to eliminate race conditions Bootstrap Control Unit that cold-boots via ROM-to-RAM transfer Early-exit conditional…
- KAKnightOS – An open-source OS for calculators2016 · knightos.org · ▲180
- H1Homebrew 16bit CPU from 74HC logic with C compiler and Unix-like OS2023 · sol-1.org · ▲192
This is a 16bit CPU+Minicomputer from pure 74 series logic. It has user/kernel modes, virtual memory, prioritized IRQ's and DMA. It has a full C compiler and a unix-like OS. It's still in development.

- IAInsect – a high-precision scientific calculator with physical units2017 · insect.sh · ▲354
More commerce this month
the category →

Compare your startup equity grant for free.
Commerce · 26d ago · equitybee.com
Launched alongside, May 2026
the whole month →

Parallel agents, diff reviewer, and multi-model comparisons
Dev tools · May 2026 · kilo.ai


- NW
Hey HN, Henry here from Cactus. We open-sourced Needle, a 26M parameter function-calling (tool use) model. It runs at 6000 tok/s prefill and 1200 tok/s decode on consumer devices. We were always frustrated by the little effort made towards building agentic models that run on budget phones, so we conducted investigations that led to an observation: agentic experiences are built upon tool calling, and massive models are overkill for it. Tool calling is fundamentally retrieval-and-assembly (match query to tool name, extract argument values, emit JSON), not reasoning. Cross-attention…
Life & fun · May 2026 · github.com
- FM
Dev tools · May 2026 · github.com