惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
M
MIT News - Artificial intelligence
Engineering at Meta
Engineering at Meta
云风的 BLOG
云风的 BLOG
博客园 - 叶小钗
Jina AI
Jina AI
Last Week in AI
Last Week in AI
The Cloudflare Blog
博客园 - 【当耐特】
Stack Overflow Blog
Stack Overflow Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学
博客园_首页
I
InfoQ
G
Google Developers Blog
Martin Fowler
Martin Fowler
Recent Announcements
Recent Announcements
H
Help Net Security
U
Unit 42
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
IT之家
IT之家
Microsoft Security Blog
Microsoft Security Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
How You Can Build a Computer From a Single Gate
jasu.dev · 2026-05-17 · via DEV Community

jasu.dev

Most software engineers can't explain how their computer works.

Me included, I work as a backend developer but know nothing about the internals of my laptop.
In modern computer science we have so many layers of abstraction that you don't need to know what's underneath.
But knowing a thing or two about it will certainly make you a better developer.

And you can start by building your own computer from just a single logic gate.

Nand2Tetris

Nand2Tetris is a course by Noam Nisan and Shimon Schocken where you build a fully functional computer by starting with just one simple logic gate - the NAND gate.

The course is available for free on the website nand2tetris.org and it does not require any pre-existing knowledge about computers or programming (although it helps).
It's divided into two parts: Hardware and Software, and includes twelve projects.
In the first six projects you build the computer from scratch, and in projects 7 to 12 you build the software stack: a VM translator, a compiler, and a small OS.

The course is widely known as one of the best courses in computer science for understanding how things work on a low level.

Boolean Logic

The first project is about boolean logic. Build 15 different chips from a simple logic gate.

The documents (or videos) explain everything that is needed to solve this task:

  • the theory of boolean logic
  • the connection between boolean logic and electrical circuits
  • an introduction to hardware description files and hardware simulation

You are provided with stub, comparison and test files for each gate. These files provide the necessary information on how the gate/chip
is supposed to work. The actual implementation is your part.

For the Xor gate for example, these are the stub and comparison file:

// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/1/Xor.hdl
/**
 * Exclusive-or gate:
 * if ((a and Not(b)) or (Not(a) and b)) out = 1, else out = 0
 */
CHIP Xor {
    IN a, b;
    OUT out;

    PARTS:
    //// Replace this comment with your code.
}

Enter fullscreen mode Exit fullscreen mode

| a | b |out|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |

Enter fullscreen mode Exit fullscreen mode

The first gates like NOT, AND and XOR were straightforward, but Mux and DMux were a different story.

Routing

Mux and DMux broke my pattern.

While the simpler gates are all basic boolean arithmetic, Mux and DMux do not calculate anything.
The Mux takes two input signals (a and b) and a select signal.
Based on the select signal the output has either the value of a or b. The DMux does the opposite: it takes one input and routes it to one of two outputs based on the selector.

This is the truth table for the Mux:

| a | b |sel|out|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |

Enter fullscreen mode Exit fullscreen mode

The tricky part here is the shift in the pattern. NOT, AND, XOR all follow the principle of combining inputs and calculating a result. Routing needs a different pattern and requires you to shift your thinking.

Another challenge is the 4-Way and 8-Way Mux. I built them the same way as the Mux (but with a lot more code as you may imagine) first, before realizing that they can be built with just three Mux chips.
I discovered that you can use the divide and conquer pattern for both, software and hardware.

My Verdict of Project 1

In total the first project took me around five hours including going through the course material.

So far it's worth it to go through this course to deepen your knowledge of how computers work and eventually become a better software engineer.

The next project will be about building a calculator from logic gates.

Originally published on jasu.dev