Building Memory With Logic Gates

Zaid Humayun
Dec 14, 2018 · 12 min read

Introduction

Holding State

Source: CODE by Charles Petzold
Source: CODE by Charles Petzold
Source: CODE by Charles Petzold
Source: CODE by Charles Petzold
Source: CODE by Charles Petzold
Inputs               OutputsD    Clock           Q     Q_bar0    1               0     1
1 1 1 0
X 0 Q Q_bar
levelTrigger.flipflop(0, 1)levelTrigger.flipflop(1, 1)levelTrigger.flipflop(0, 0)var result = levelTrigger.getState()

Assembling The Memory

Source: CODE by Charles Petzold
Source: CODE by Charles Petzold

The Size Of Memory

Source: CODE by Charles Petzold
Source: CODE by Charles Petzold

Visualizing Memory

Representing memory addresses as blocks

Automation

Extending Automation

Adding an instruction set to our memory blocks
The Data RAM array and Code RAM array
Load: 11111101 (253)
Add: 11111110 (254)
Store: 11111111 (255)
const dataMap = new Map([["000", "00000001"],["001", "00000001"],["010", "00000001"],["011", "00000001"],["100", "00000001"],["101", "00000001"],["110", "00000111"],["111", "00000001"]]);const codeMap = new Map([["000", "11111101"],["001", "11111110"],["010", "11111110"],["011", "11111110"],["100", "11111111"],["101", "11111101"],["110", "11111110"],["111", "11111111"]]);
Memory Iteration GIF

Conclusion


This story is published in The Startup, Medium’s largest entrepreneurship publication followed by +399,714 people.

Subscribe to receive our top stories here.

The Startup

Medium's largest active publication, followed by +477K people. Follow to join our community.

Zaid Humayun

Written by

Developer. Writer.

The Startup

Medium's largest active publication, followed by +477K people. Follow to join our community.