Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
I wanted a computer, but all I got was a transi...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Denis Defreyne
September 08, 2015
Programming
290
2
Share
I wanted a computer, but all I got was a transistor
Denis Defreyne
September 08, 2015
More Decks by Denis Defreyne
See All by Denis Defreyne
The importance of naming
denisdefreyne
0
160
An introduction to fibers
denisdefreyne
0
290
Code as data (RubyConfBY 2019 edition)
denisdefreyne
0
160
Code as data
denisdefreyne
0
250
How to memoize
denisdefreyne
0
250
Clean & fast code with enumerators
denisdefreyne
0
200
Fibers
denisdefreyne
0
560
Let’s create a programming language! [SoundCloud HQ edition]
denisdefreyne
0
280
Let’s create a programming language! [RUG::B edition]
denisdefreyne
1
270
Other Decks in Programming
See All in Programming
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
1.3k
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
4
1.4k
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
3.4k
関係性から理解する"同一性"の型用語たち
pvcresin
2
630
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
130
TypeScriptだけでAIエージェントを作る フロント・エージェント・インフラのフルスタック実践
har1101
6
1.3k
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
470
inferと仲良くなる10分間
ryokatsuse
1
360
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
450
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.1k
The NotImplementedError Problem in Ruby
koic
1
480
Oxlintのカスタムルールの現況
syumai
5
980
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Docker and Python
trallard
47
3.9k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
220
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
The Curse of the Amulet
leimatthew05
1
13k
Into the Great Unknown - MozCon
thekraken
41
2.5k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
130
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
190
WCS-LA-2024
lcolladotor
0
610
Transcript
I wanted a computer, but all I got was a
transistor. Denis Defreyne 1
2 I will explain how to build a computer from
scratch. I cannot do this without taking some shortcuts. I will tell lies. CAUTION
3
In the beginning, the transistor was created. 4
5 GATE SOURCE DRAIN
6 GATE SOURCE DRAIN
7 GATE SOURCE DRAIN
8
9
10
11
12 AND
13
14
15
16
OR 17
Now we have gates, and we can forget about transistors.
18
19 OR AND XOR NAND NOT …
A B Sum 0 0 0 0 1 1 1
0 1 1 1 0 20
A B Carry 0 0 0 1 A B Sum
Carry 0 0 0 0 1 1 1 0 1 1 1 0 21 AND XOR
22 AND A B CARRY XOR SUM
ADD CARRY SUM A B 23
24 ADD CARRY SUM A B CARRY
25 ADD SUM 0 A 0 B 0
26 ADD SUM 0 A 0 B 0 ADD SUM
1 A 1 B 1
27 ADD SUM 0 A 0 B 0 ADD SUM
1 A 1 B 1 ADD SUM 0 A 0 B 0 ADD SUM 1 A 1 B 1 ADD A 2 B 2 SUM 2
28 ADD A B SUM
ADD 00010001 00000101 00010110 29
ADD 17 5 22 30
31 ADD R A B MUL R A B DIV
R A B MOD R A B
A B ADD MUL DIV MOD R R R R
32
A B ADD MUL DIV MOD MUX S R 33
34 MUX
35 0 MUX
36 1 MUX
37 2 MUX
38 3 MUX
39 A B ADD MUL DIV MOD MUX S R
40 ALU R A B S
A B S Result 15 7 0 (+) 22 15
7 1 (*) 105 15 7 2 (/) 2 15 7 3 (%) 1 41
Now we have an arithmetic logic unit. 42
43 OR NOT OR NOT Q S R
OR NOT OR NOT Q S R 44
OR NOT OR NOT Q S R 45
OR NOT OR NOT Q S R 46
OR NOT OR NOT Q S R 47
OR NOT OR NOT Q S R 48
49 SR-LATCH S R Q set reset
D-LATCH D E Q 50 data enable write
51 D-LATCH D 0 Q 0 D-LATCH D 1 Q
1 D-LATCH D 2 Q 2 D-LATCH D 3 Q 3 D-LATCH D 4 Q 4 D-LATCH D 5 Q 5 D-LATCH D 6 Q 6 D-LATCH D 7 Q 7 E
52 REGISTER (8 BIT) D E Q
Now we have registers. 53
Q: What distinguishes a computer from a simple calculator? 54
A: You can program a computer, but not a calculator.
55
56 OPCODE VALUE 1 VALUE 2 2 7 15
57 OPCODE VALUE 1 VALUE 2 ALU R
OPCODE VALUE 1 VALUE 2 ALU REGISTER (8 BIT) 1
58
OPCODE VALUE 1 VALUE 2 ALU REGISTER FILE OUTPUT REG
1 59
OPCODE INPUT REG 1 INPUT REG 2 REGISTER FILE OUTPUT
REG ALU 0 0 1 60
61 OPCODE INPUT REG 1 INPUT REG 2 OUTPUT REG
62 INSTRUCTION REGISTER OPCODE INPUT REG 1 INPUT REG 2
OUTPUT REG
63 MEMORY INSTRUCTION REGISTER OPCODE INPUT REG 1 INPUT REG
2 OUTPUT REG
MEMORY INSTRUCTION REGISTER OPCODE INPUT REG 1 INPUT REG 2
OUTPUT REG 0 64
65 INSTRUCTION POINTER REGISTER MEMORY INSTRUCTION REGISTER OPCODE INPUT REG
1 INPUT REG 2 OUTPUT REG
66 INSTRUCTION POINTER REGISTER MEMORY INSTRUCTION REGISTER ADD 4 OPCODE
INPUT REG 1 INPUT REG 2 OUTPUT REG
Now we have the hardware for a programmable computer, and
we can forget the hardware. 67
68 0 3 0 2 Add register 0 and register
2, and store result in register 3: OPCODE INPUT REG 1 OUTPUT REG INPUT REG 2
69 “add r3 r0 r2” Add register 0 and register
2, and store result in register 3:
70 “add r3 r0 r2” 0 3 0 2 assembly
language machine code assembler
16 0 0 12 127 56 16 1 0 3
224 211 18 1 0 0 0 0 7 32 15 2 1 19 1 0 1 15 0 2 6 12 14 0 255 0 71
li r0, 819000 li r1, 254163 cmpi r1, 0 jeq
@end mov r2, r1 mod r1, r0, r1 mov r0, r2 jmp @start prn r0 halt 72
73 cmp mod add sub mul div xor or and
shl shr not ARITHMETIC
74 j je jne jg jge jl jle cmp mod
add sub mul div xor or and shl shr not lw lh lb sw sh sb STACK FUNC SPECIAL call ret push pop prn halt BRANCHING ARITHMETIC mov li MEMORY REG
DEMO 75
github.com/ddfreyne/rcpu 76
77
78 slack @denis / mail
[email protected]
Denis Defreyne Ask me
about Belgian beer.