frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: SHDL – A minimal hardware description language built from logic gates

https://github.com/rafa-rrayes/SHDL
10•rafa_rrayes•9h ago
Hi, everyone!

I built SHDL (Simple Hardware Description Language) as an experiment in stripping hardware description down to its absolute fundamentals.

In SHDL, there are no arithmetic operators, no implicit bit widths, and no high-level constructs. You build everything explicitly from logic gates and wires, and then compose larger components hierarchically. The goal is not synthesis or performance, but understanding: what digital systems actually look like when abstractions are removed.

SHDL is accompanied by PySHDL, a Python interface that lets you load circuits, poke inputs, step the simulation, and observe outputs. Under the hood, SHDL compiles circuits to C for fast execution, but the language itself remains intentionally small and transparent.

This is not meant to replace Verilog or VHDL. It’s aimed at: - learning digital logic from first principles - experimenting with HDL and language design - teaching or visualizing how complex hardware emerges from simple gates.

I would especially appreciate feedback on: - the language design choices - what feels unnecessarily restrictive vs. educationally valuable - whether this kind of “anti-abstraction” HDL is useful to you.

Repo: https://github.com/rafa-rrayes/SHDL

Python package: PySHDL on PyPI

To make this concrete, here are a few small working examples written in SHDL:

1. Full Adder

component FullAdder(A, B, Cin) -> (Sum, Cout) {

    x1: XOR; a1: AND;
    x2: XOR; a2: AND;
    o1: OR;

    connect {
        A -> x1.A; B -> x1.B;
        A -> a1.A; B -> a1.B;

        x1.O -> x2.A; Cin -> x2.B;
        x1.O -> a2.A; Cin -> a2.B;
        a1.O -> o1.A; a2.O -> o1.B;

        x2.O -> Sum; o1.O -> Cout;
    }
}

2. 16 bit register

# clk must be high for two cycles to store a value

component Register16(In[16], clk) -> (Out[16]) {

    >i[16]{
        a1{i}: AND;
        a2{i}: AND;
        not1{i}: NOT;
        nor1{i}: NOR;
        nor2{i}: NOR;
    }
    
    connect {
        >i[16]{
            # Capture on clk
            In[{i}] -> a1{i}.A;
            In[{i}] -> not1{i}.A;
            not1{i}.O -> a2{i}.A;
            
            clk -> a1{i}.B;
            clk -> a2{i}.B;
            
            a1{i}.O -> nor1{i}.A;
            a2{i}.O -> nor2{i}.A;
            nor1{i}.O -> nor2{i}.B;
            nor2{i}.O -> nor1{i}.B;
            nor2{i}.O -> Out[{i}];
        }
    }
}

3. 16-bit Ripple-Carry Adder

use fullAdder::{FullAdder};

component Adder16(A[16], B[16], Cin) -> (Sum[16], Cout) {

    >i[16]{ fa{i}: FullAdder; }

    connect {
        A[1] -> fa1.A;
        B[1] -> fa1.B;
        Cin -> fa1.Cin;
        fa1.Sum -> Sum[1];

        >i[2,16]{
            A[{i}] -> fa{i}.A;
            B[{i}] -> fa{i}.B;
            fa{i-1}.Cout -> fa{i}.Cin;
            fa{i}.Sum -> Sum[{i}];
        }

        fa16.Cout -> Cout;
    }
}

Comments

Lramseyer•1h ago
Kind of a wild idea, but have you considered using this as a markup language for logic diagrams? I'm thinking something like mermaid - https://mermaid.js.org/ While this might not be super useful for chip design, it is a fully functional HDL, and since it is gate level, it would map nicely to diagrams.
notherhack•1h ago
You've reinvented Verilog primitive gates.
fspeech•49m ago
If you are just interested in a structural description (so-called netlist) the standard is EDIF.

Mousefood – Build embedded terminal UIs for microcontrollers

https://github.com/ratatui/mousefood
98•orhunp_•4h ago•30 comments

Airfoil (2024)

https://ciechanow.ski/airfoil/
279•brk•6h ago•45 comments

Native Linux VST plugin directory

https://linuxmusic.rocks
26•Aldipower•1h ago•13 comments

Oban, the job processing framework from Elixir, has come to Python

https://www.dimamik.com/posts/oban_py/
120•dimamik•4h ago•58 comments

What does Werner Herzog's nihilist penguin teach us about life?

https://lwlies.com/article/werner-herzog-penguin-encounters-at-the-end-of-the-world
7•Marceltan•37m ago•8 comments

Microsoft forced me to switch to Linux

https://www.himthe.dev/blog/microsoft-to-linux
1355•bobsterlobster•6h ago•1062 comments

Android's desktop interface leaks

https://9to5google.com/2026/01/27/android-desktop-leak/
75•thunderbong•17h ago•154 comments

Computer History Museum Launches Digital Portal to Its Collection

https://computerhistory.org/press-releases/computer-history-museum-launches-digital-portal-to-its...
56•ChrisArchitect•3h ago•9 comments

The Five Levels: From Spicy Autocomplete to the Software Factory

https://www.danshapiro.com/blog/2026/01/the-five-levels-from-spicy-autocomplete-to-the-software-f...
12•benwerd•4d ago•4 comments

Who sets the Doomsday Clock?

https://www.popularmechanics.com/science/a70162364/setting-the-doomsday-clock/
6•littlexsparkee•1h ago•4 comments

Spinning around: Please don't – Common problems with spin locks

https://www.siliceum.com/en/blog/post/spinning-around/
43•bdash•4h ago•14 comments

Show HN: The HN Arcade

https://andrewgy8.github.io/hnarcade/
268•yuppiepuppie•10h ago•68 comments

Trying to craft AI images that are worth displaying to end users

https://www.approachwithalacrity.com/how-to-turn-sfo-jfk-into-a-beautiful-photo/
5•bblcla•1h ago•0 comments

I Overengineered a Spinning Top

https://www.youtube.com/watch?v=Wp5NodfvvF4
94•bane•5d ago•24 comments

Show HN: Cursor for Userscripts

https://github.com/chebykinn/browser-code
9•mifydev•1h ago•0 comments

Amazon cuts 16k jobs

https://www.reuters.com/legal/litigation/amazon-cuts-16000-jobs-globally-broader-restructuring-20...
354•DGAP•5h ago•475 comments

Native Instruments enters into insolvency proceedings

https://www.engadget.com/audio/native-instruments-enters-into-insolvency-proceedings-leaving-its-...
46•elevaet•1h ago•9 comments

I have written gemma3 inference in pure C

https://github.com/robitec97/gemma3.c
32•robitec97•2d ago•16 comments

Show HN: A MitM proxy to see what your LLM tools are sending

https://github.com/jmuncor/sherlock
6•jmuncor•2h ago•0 comments

Some notes on starting to use Django

https://jvns.ca/blog/2026/01/27/some-notes-on-starting-to-use-django/
159•ingve•22h ago•91 comments

Kairos: AI interns for everyone

https://www.kairos.computer/
4•bamitsmanas•13h ago•1 comments

That's not how email works

https://danq.me/2026/01/28/hsbc-dont-understand-email/
162•HotGarbage•3h ago•105 comments

Amazon One palm authentication discontinued

https://amazonone.aws.com/help
36•KerryJones•4h ago•77 comments

3D-Printed Mathematical Lampshades

https://hessammehr.github.io/blog/posts/2025-12-24-maths-to-lampshade.html
33•hessammehr•4d ago•12 comments

Kyber (YC W23) Is Hiring a Staff Engineer

https://www.ycombinator.com/companies/kyber/jobs/GPJkv5v-staff-engineer-tech-lead
1•asontha•9h ago

Show HN: Sandbox Agent SDK – unified API for automating coding agents

https://github.com/rivet-dev/sandbox-agent
11•NathanFlurry•7h ago•0 comments

Will AIs take all our jobs and end human history, or not? (2023)

https://writings.stephenwolfram.com/2023/03/will-ais-take-all-our-jobs-and-end-human-history-or-n...
50•lukakopajtic•4h ago•96 comments

If you tax them, will they leave?

https://www.theatlantic.com/economy/2026/01/california-wealth-tax-billionaire-migration/685779/
58•JumpCrisscross•8h ago•166 comments

Show HN: I'm building an AI-proof writing tool. How would you defeat it?

https://auth-auth.vercel.app/
3•callmeed•3h ago•1 comments

Show HN: SHDL – A minimal hardware description language built from logic gates

https://github.com/rafa-rrayes/SHDL
10•rafa_rrayes•9h ago•3 comments