Lesson 3. RAM from latches: a light through memory

In pictures

After this lesson the processor gets memory — 8 cells of 8 bits made of transistors. And you can see right away why it is needed: the light runs on a program of five commands, because the processor can add a memory cell to A.


3.1. The idea: the address is in the command

ST 3 puts A into cell 3, LD 3 takes it out, ADD 3 adds the cell to A. The cell number is in the low bits of the command, like the number of LD #5, only ir11 = 0. The addresses are divided into areas:

  • 0–7 — RAM;
  • 16–23 — permanent memory (the card's personal data, lesson 6);
  • 24 — the PIN try counter (lesson 6), 28–29 — the data wire (lesson 5).

The row inside an area is chosen by the decoder DEC8 — one for the RAM and the permanent memory.

012345678910111213141516171819202122232425262728293031RAM: 8 cellslesson 3personal datalesson 6TRYlesson 6IOlesson 5
The cell address is the low bits of the instruction. 0–7 is RAM, 16–22 the card’s personal data, 24 the attempt counter, 28–29 the data wire. One DEC8 decoder selects the row inside an area.

3.2. The idea: a latch writes while it is open

A RAM cell is 8 latches. A latch remembers while it is open, so it may be opened only when the address and A have settled. The clock is split into two halves: CLK = 1 — read, CLK = 0 — write. The write window weRAM is open in the second half and is closed by the CLK edge itself — before PC changes.

CLKinstr.LD #1ST 0ADD 0JNC 1ST 0ADD 0oSTweRAMwindow: CLK = 0↑ CLK edge: PC steps, the window is already closed
A latch writes while it is open. So ST opens the RAM row only in the second half of the cycle (CLK = 0): the address and A have settled by then, and the CLK edge itself closes the window — before PC changes.

3.3. The idea: memory at power-on is garbage

At power-on the latches remember nothing: in Real they "float" (orange). So the program first writes a cell and only then reads it. Real computers are the same: memory has to be filled after power-on.

3.4. Building

The same project as in lesson 2.

We build the RAM from latches: a row of 8 latches for each cell. Reading is always on (the selected row gives what it holds), writing only by the ST command and only in the second half of the clock.

Step 1. Chip AND3 — AND with 3 inputs

If AND3 is already in the library (from "A Watch and a Game"), skip this step.

PartPinLabel
Input portoutA
Input portoutB
Input portoutC
Output portinY
ANDI0
I1
O0
A
B
ab
ANDI0
I1
O0
ab
C
Y

Ctrl+G → name AND3. Pins: inputs A, B, C; outputs Y.

Step 2. Chip DEC8 — decoder 3 → 8: exactly one wire is lit

PartPinLabel
Input portoutI0
Input portoutI1
Input portoutI2
Output portinY0
Output portinY1
Output portinY2
Output portinY3
Output portinY4
Output portinY5
Output portinY6
Output portinY7
NOTI0
O0
I0
n0
NOTI0
O0
I1
n1
NOTI0
O0
I2
n2
AND3A
B
C
Y
n2
n1
n0
Y0
AND3A
B
C
Y
n2
n1
I0
Y1
AND3A
B
C
Y
n2
I1
n0
Y2
AND3A
B
C
Y
n2
I1
I0
Y3
AND3A
B
C
Y
I2
n1
n0
Y4
AND3A
B
C
Y
I2
n1
I0
Y5
AND3A
B
C
Y
I2
I1
n0
Y6
AND3A
B
C
Y
I2
I1
I0
Y7

Ctrl+G → name DEC8. Pins: inputs I0, I1, I2; outputs Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7.

Step 3. Chip WORD8 — a RAM row: 8 latches, write by W, read by R

PartPinLabel
Input portoutD0
Input portoutD1
Input portoutD2
Input portoutD3
Input portoutD4
Input portoutD5
Input portoutD6
Input portoutD7
Input portoutW
Input portoutR
Output portinO0
Output portinO1
Output portinO2
Output portinO3
Output portinO4
Output portinO5
Output portinO6
Output portinO7
DLatchD
EN
Q
D0
W
q0
DLatchD
EN
Q
D1
W
q1
DLatchD
EN
Q
D2
W
q2
DLatchD
EN
Q
D3
W
q3
DLatchD
EN
Q
D4
W
q4
DLatchD
EN
Q
D5
W
q5
DLatchD
EN
Q
D6
W
q6
DLatchD
EN
Q
D7
W
q7
ANDI0
I1
O0
q0
R
O0
ANDI0
I1
O0
q1
R
O1
ANDI0
I1
O0
q2
R
O2
ANDI0
I1
O0
q3
R
O3
ANDI0
I1
O0
q4
R
O4
ANDI0
I1
O0
q5
R
O5
ANDI0
I1
O0
q6
R
O6
ANDI0
I1
O0
q7
R
O7

Ctrl+G → name WORD8. Pins: inputs D0, D1, D2, D3, D4, D5, D6, D7, W, R; outputs O0, O1, O2, O3, O4, O5, O6, O7.

Step 4. What is selected: area and row

The cell address is the low bits of the command. ir4 = 0 — RAM (addresses 0–7); ir4 = 1 — the rest: 16–23 the permanent memory (selP), 24 the try counter (selTRY), 28–29 the IO wire (selIO). The row inside the area is chosen by DEC8 from ir0–ir2 — one decoder for the RAM and the permanent memory.

PartPinLabel
NOTI0
O0
ir4
selRAM
NOTI0
O0
ir3
nir3
NOTI0
O0
ir2
nir2
ANDI0
I1
O0
ir4
nir3
selP
AND3A
B
C
Y
ir4
ir3
nir2
selTRY
AND3A
B
C
Y
ir4
ir3
ir2
selIO
DEC8I0
I1
I2
Y0
Y1
Y2
Y3
Y4
Y5
Y6
Y7
ir0
ir1
ir2
row0
row1
row2
row3
row4
row5
row6
row7

Step 5. The write window and the rows

A latch writes while it is open. So ST opens the row only in the second half of the clock (CLK = 0, nCLK = 1): by then the address and A have long settled, and the window is closed by the CLK edge itself — before PC changes. Two phases of one clock: CLK = 1 — read, CLK = 0 — write to memory. rr is the row for reading, rw for writing.

PartPinLabel
NOTI0
O0
CLK
nCLK
AND3A
B
C
Y
oST
selRAM
nCLK
weRAM
ANDI0
I1
O0
row0
selRAM
rr0
ANDI0
I1
O0
row1
selRAM
rr1
ANDI0
I1
O0
row2
selRAM
rr2
ANDI0
I1
O0
row3
selRAM
rr3
ANDI0
I1
O0
row4
selRAM
rr4
ANDI0
I1
O0
row5
selRAM
rr5
ANDI0
I1
O0
row6
selRAM
rr6
ANDI0
I1
O0
row7
selRAM
rr7
ANDI0
I1
O0
row0
weRAM
rw0
ANDI0
I1
O0
row1
weRAM
rw1
ANDI0
I1
O0
row2
weRAM
rw2
ANDI0
I1
O0
row3
weRAM
rw3
ANDI0
I1
O0
row4
weRAM
rw4
ANDI0
I1
O0
row5
weRAM
rw5
ANDI0
I1
O0
row6
weRAM
rw6
ANDI0
I1
O0
row7
weRAM
rw7

Step 6. Eight RAM rows

Each row is 8 latches. D0–D7 come from A (what to write), O is what is read: a row that is not selected gives zeros there.

PartPinLabel
WORD8D0
D1
D2
D3
D4
D5
D6
D7
W
R
O0
O1
O2
O3
O4
O5
O6
O7
acc0
acc1
acc2
acc3
acc4
acc5
acc6
acc7
rw0
rr0
m0_0
m0_1
m0_2
m0_3
m0_4
m0_5
m0_6
m0_7
WORD8D0
D1
D2
D3
D4
D5
D6
D7
W
R
O0
O1
O2
O3
O4
O5
O6
O7
acc0
acc1
acc2
acc3
acc4
acc5
acc6
acc7
rw1
rr1
m1_0
m1_1
m1_2
m1_3
m1_4
m1_5
m1_6
m1_7
WORD8D0
D1
D2
D3
D4
D5
D6
D7
W
R
O0
O1
O2
O3
O4
O5
O6
O7
acc0
acc1
acc2
acc3
acc4
acc5
acc6
acc7
rw2
rr2
m2_0
m2_1
m2_2
m2_3
m2_4
m2_5
m2_6
m2_7
WORD8D0
D1
D2
D3
D4
D5
D6
D7
W
R
O0
O1
O2
O3
O4
O5
O6
O7
acc0
acc1
acc2
acc3
acc4
acc5
acc6
acc7
rw3
rr3
m3_0
m3_1
m3_2
m3_3
m3_4
m3_5
m3_6
m3_7
WORD8D0
D1
D2
D3
D4
D5
D6
D7
W
R
O0
O1
O2
O3
O4
O5
O6
O7
acc0
acc1
acc2
acc3
acc4
acc5
acc6
acc7
rw4
rr4
m4_0
m4_1
m4_2
m4_3
m4_4
m4_5
m4_6
m4_7
WORD8D0
D1
D2
D3
D4
D5
D6
D7
W
R
O0
O1
O2
O3
O4
O5
O6
O7
acc0
acc1
acc2
acc3
acc4
acc5
acc6
acc7
rw5
rr5
m5_0
m5_1
m5_2
m5_3
m5_4
m5_5
m5_6
m5_7
WORD8D0
D1
D2
D3
D4
D5
D6
D7
W
R
O0
O1
O2
O3
O4
O5
O6
O7
acc0
acc1
acc2
acc3
acc4
acc5
acc6
acc7
rw6
rr6
m6_0
m6_1
m6_2
m6_3
m6_4
m6_5
m6_6
m6_7
WORD8D0
D1
D2
D3
D4
D5
D6
D7
W
R
O0
O1
O2
O3
O4
O5
O6
O7
acc0
acc1
acc2
acc3
acc4
acc5
acc6
acc7
rw7
rr7
m7_0
m7_1
m7_2
m7_3
m7_4
m7_5
m7_6
m7_7

Step 7. Reading the RAM

For each bit — OR of all 8 rows: only the selected one is lit, the others give 0.

PartPinLabel
OR8A
B
C
D
E
F
G
H
Y
m0_0
m1_0
m2_0
m3_0
m4_0
m5_0
m6_0
m7_0
ram0
OR8A
B
C
D
E
F
G
H
Y
m0_1
m1_1
m2_1
m3_1
m4_1
m5_1
m6_1
m7_1
ram1
OR8A
B
C
D
E
F
G
H
Y
m0_2
m1_2
m2_2
m3_2
m4_2
m5_2
m6_2
m7_2
ram2
OR8A
B
C
D
E
F
G
H
Y
m0_3
m1_3
m2_3
m3_3
m4_3
m5_3
m6_3
m7_3
ram3
OR8A
B
C
D
E
F
G
H
Y
m0_4
m1_4
m2_4
m3_4
m4_4
m5_4
m6_4
m7_4
ram4
OR8A
B
C
D
E
F
G
H
Y
m0_5
m1_5
m2_5
m3_5
m4_5
m5_5
m6_5
m7_5
ram5
OR8A
B
C
D
E
F
G
H
Y
m0_6
m1_6
m2_6
m3_6
m4_6
m5_6
m6_6
m7_6
ram6
OR8A
B
C
D
E
F
G
H
Y
m0_7
m1_7
m2_7
m3_7
m4_7
m5_7
m6_7
m7_7
ram7

Step 8. Room for the permanent memory

The card's personal data — account number, PIN, key — will live in a matrix, like the ROM of the "Character Generator": rows pr, columns pb, a resistor holds the column at 1, a row transistor pulls it to 0, NOT flips it. We will place the transistors (the data itself) in lesson 6; for now the matrix is empty: everything reads as 0.

PartPinLabel
ANDI0
I1
O0
row0
selP
pr0
ANDI0
I1
O0
row1
selP
pr1
ANDI0
I1
O0
row2
selP
pr2
ANDI0
I1
O0
row3
selP
pr3
ANDI0
I1
O0
row4
selP
pr4
ANDI0
I1
O0
row5
selP
pr5
ANDI0
I1
O0
row6
selP
pr6
Resistorend 1
end 2
VCC
pb0
Resistorend 1
end 2
VCC
pb1
Resistorend 1
end 2
VCC
pb2
Resistorend 1
end 2
VCC
pb3
Resistorend 1
end 2
VCC
pb4
Resistorend 1
end 2
VCC
pb5
Resistorend 1
end 2
VCC
pb6
Resistorend 1
end 2
VCC
pb7
NOTI0
O0
pb0
pq0
NOTI0
O0
pb1
pq1
NOTI0
O0
pb2
pq2
NOTI0
O0
pb3
pq3
NOTI0
O0
pb4
pq4
NOTI0
O0
pb5
pq5
NOTI0
O0
pb6
pq6
NOTI0
O0
pb7
pq7

Step 9. Everything meets in din

Whatever is read — RAM, permanent memory, try counter or the IO wire — meets by OR in din0–din7, and from there goes to the number MUX2s of lesson 2. The try counter (try0, try1) and the IO wire will appear in lessons 5–6: for now their labels are empty, and an AND with an area that is not selected gives 0 anyway.

PartPinLabel
ANDI0
I1
O0
try0
selTRY
t0
ANDI0
I1
O0
try1
selTRY
t1
ANDI0
I1
O0
IO
selIO
io0
OR4A
B
C
D
Y
ram0
pq0
t0
io0
din0
OR3A
B
C
Y
ram1
pq1
t1
din1
ORI0
I1
O0
ram2
pq2
din2
ORI0
I1
O0
ram3
pq3
din3
ORI0
I1
O0
ram4
pq4
din4
ORI0
I1
O0
ram5
pq5
din5
ORI0
I1
O0
ram6
pq6
din6
ORI0
I1
O0
ram7
pq7
din7

Step 10. The program in the ROM

⚙ on ROM → button ⬆ → file 03-shift.rom.json. Only 5 commands:

; Lesson 3 — a light shifted through memory: A + A shifts the bits left, but the second addend must come from somewhere —; the command adds A to a CELL. We put A into cell 0 and add that same cell.start:  LD #1loop:   ST 0             ; cell 0 ← A        ADD 0            ; A ← A + cell 0 = A + A: the light steps left        JNC loop         ; until the one falls out of the 8 bits        JMP start        ; 128 + 128 = 256 → A = 0, C = 1 — from the start

3.5. Checking

ClockPCCommandALamps acc7…acc0CCell 0What you see
10LD #11○○○○○○○●00
21ST 01○○○○○○○●01cell 0 ← 1
32ADD 02○○○○○○●○011 + 1 = 2
43JNC 12○○○○○○●○01C = 0 — once more
51ST 02○○○○○○●○02cell 0 ← 2
62ADD 04○○○○○●○○022 + 2 = 4
73JNC 14○○○○○●○○02C = 0 — once more
81ST 04○○○○○●○○04cell 0 ← 4
92ADD 08○○○○●○○○044 + 4 = 8
103JNC 18○○○○●○○○04C = 0 — once more
111ST 08○○○○●○○○08cell 0 ← 8
122ADD 016○○○●○○○○088 + 8 = 16
133JNC 116○○○●○○○○08C = 0 — once more
141ST 016○○○●○○○○016cell 0 ← 16
152ADD 032○○●○○○○○01616 + 16 = 32
163JNC 132○○●○○○○○016C = 0 — once more
171ST 032○○●○○○○○032cell 0 ← 32
182ADD 064○●○○○○○○03232 + 32 = 64
193JNC 164○●○○○○○○032C = 0 — once more
201ST 064○●○○○○○○064cell 0 ← 64
212ADD 0128●○○○○○○○06464 + 64 = 128
223JNC 1128●○○○○○○○064C = 0 — once more
231ST 0128●○○○○○○○0128cell 0 ← 128
242ADD 00○○○○○○○○1128128 + 128 = 256 → 0, C = 1
253JNC 10○○○○○○○○1128C = 1 — go on
264JMP 00○○○○○○○○1128from the start
270LD #11○○○○○○○●1128
281ST 01○○○○○○○●11cell 0 ← 1

Reset (RST for one or two clocks) — and the clock steps by itself. The light runs left one lamp per 3 clocks (ST, ADD, JNC), after 128 it goes dark for 3 clocks (A = 0, C = 1) and starts again.

  • A changes only on ADD and LD; ST and the jumps do not touch A — the lamps stand still.
  • C lights up when 128 + 128 falls out of 8 bits, and goes off on the next ADD (LD, ST and the jumps do not touch C).
  • The main thing: the command ADD 0 adds A to a memory cell. Without RAM (lesson 2) the shift had to be written with eight LDs.

If it is not like this:

  • A does not double after ADD 0 — check the write window: AND3 → weRAM with oST, selRAM, nCLK; rows rw, rr.
  • It doubles, but the wrong bit — WORD8: D0–D7 on acc0–acc7, O of a row is m<row>_<bit>; OR8 of bit k has inputs m0_k…m7_k.
  • All lamps are lit instead of one light — din does not come from the RAM: check OR in din2–din7, OR3 in din1, OR4 in din0.
  • Orange (Z) labels try0, try1, IO — that is how it should be: their sources appear in lessons 5–6.

Do not fold into a chip.


Lesson 3 paste (Cmd+I)

On top of lesson 2.

# Lesson 3 — RAM from latches, room for the permanent memory. On top of lesson 2; then load 03-shift.rom.json into ROM.# ---------- AND3 ----------chip AND3 {  portIn(A)  portIn(B)  portIn(C)  portOut(Y)  AND(A, B, ab)  AND(ab, C, Y)} # ---------- DEC8 ----------chip DEC8 {  portIn(I0)  portIn(I1)  portIn(I2)  portOut(Y0)  portOut(Y1)  portOut(Y2)  portOut(Y3)  portOut(Y4)  portOut(Y5)  portOut(Y6)  portOut(Y7)  NOT(I0, n0)  NOT(I1, n1)  NOT(I2, n2)  AND3(A=n2, B=n1, C=n0, Y=Y0)  AND3(A=n2, B=n1, C=I0, Y=Y1)  AND3(A=n2, B=I1, C=n0, Y=Y2)  AND3(A=n2, B=I1, C=I0, Y=Y3)  AND3(A=I2, B=n1, C=n0, Y=Y4)  AND3(A=I2, B=n1, C=I0, Y=Y5)  AND3(A=I2, B=I1, C=n0, Y=Y6)  AND3(A=I2, B=I1, C=I0, Y=Y7)} # ---------- WORD8 ----------chip WORD8 {  portIn(D0)  portIn(D1)  portIn(D2)  portIn(D3)  portIn(D4)  portIn(D5)  portIn(D6)  portIn(D7)  portIn(W)  portIn(R)  portOut(O0)  portOut(O1)  portOut(O2)  portOut(O3)  portOut(O4)  portOut(O5)  portOut(O6)  portOut(O7)  DLatch(D=D0, EN=W, Q=q0)  DLatch(D=D1, EN=W, Q=q1)  DLatch(D=D2, EN=W, Q=q2)  DLatch(D=D3, EN=W, Q=q3)  DLatch(D=D4, EN=W, Q=q4)  DLatch(D=D5, EN=W, Q=q5)  DLatch(D=D6, EN=W, Q=q6)  DLatch(D=D7, EN=W, Q=q7)  AND(q0, R, O0)  AND(q1, R, O1)  AND(q2, R, O2)  AND(q3, R, O3)  AND(q4, R, O4)  AND(q5, R, O5)  AND(q6, R, O6)  AND(q7, R, O7)} NOT(ir4, selRAM)NOT(ir3, nir3)NOT(ir2, nir2)AND(ir4, nir3, selP)AND3(A=ir4, B=ir3, C=nir2, Y=selTRY)AND3(A=ir4, B=ir3, C=ir2, Y=selIO)DEC8(I0=ir0, I1=ir1, I2=ir2, Y0=row0, Y1=row1, Y2=row2, Y3=row3, Y4=row4, Y5=row5, Y6=row6, Y7=row7) NOT(CLK, nCLK)AND3(A=oST, B=selRAM, C=nCLK, Y=weRAM)AND(row0, selRAM, rr0)AND(row1, selRAM, rr1)AND(row2, selRAM, rr2)AND(row3, selRAM, rr3)AND(row4, selRAM, rr4)AND(row5, selRAM, rr5)AND(row6, selRAM, rr6)AND(row7, selRAM, rr7)AND(row0, weRAM, rw0)AND(row1, weRAM, rw1)AND(row2, weRAM, rw2)AND(row3, weRAM, rw3)AND(row4, weRAM, rw4)AND(row5, weRAM, rw5)AND(row6, weRAM, rw6)AND(row7, weRAM, rw7) WORD8(D0=acc0, D1=acc1, D2=acc2, D3=acc3, D4=acc4, D5=acc5, D6=acc6, D7=acc7, W=rw0, R=rr0, O0=m0_0, O1=m0_1, O2=m0_2, O3=m0_3, O4=m0_4, O5=m0_5, O6=m0_6, O7=m0_7)WORD8(D0=acc0, D1=acc1, D2=acc2, D3=acc3, D4=acc4, D5=acc5, D6=acc6, D7=acc7, W=rw1, R=rr1, O0=m1_0, O1=m1_1, O2=m1_2, O3=m1_3, O4=m1_4, O5=m1_5, O6=m1_6, O7=m1_7)WORD8(D0=acc0, D1=acc1, D2=acc2, D3=acc3, D4=acc4, D5=acc5, D6=acc6, D7=acc7, W=rw2, R=rr2, O0=m2_0, O1=m2_1, O2=m2_2, O3=m2_3, O4=m2_4, O5=m2_5, O6=m2_6, O7=m2_7)WORD8(D0=acc0, D1=acc1, D2=acc2, D3=acc3, D4=acc4, D5=acc5, D6=acc6, D7=acc7, W=rw3, R=rr3, O0=m3_0, O1=m3_1, O2=m3_2, O3=m3_3, O4=m3_4, O5=m3_5, O6=m3_6, O7=m3_7)WORD8(D0=acc0, D1=acc1, D2=acc2, D3=acc3, D4=acc4, D5=acc5, D6=acc6, D7=acc7, W=rw4, R=rr4, O0=m4_0, O1=m4_1, O2=m4_2, O3=m4_3, O4=m4_4, O5=m4_5, O6=m4_6, O7=m4_7)WORD8(D0=acc0, D1=acc1, D2=acc2, D3=acc3, D4=acc4, D5=acc5, D6=acc6, D7=acc7, W=rw5, R=rr5, O0=m5_0, O1=m5_1, O2=m5_2, O3=m5_3, O4=m5_4, O5=m5_5, O6=m5_6, O7=m5_7)WORD8(D0=acc0, D1=acc1, D2=acc2, D3=acc3, D4=acc4, D5=acc5, D6=acc6, D7=acc7, W=rw6, R=rr6, O0=m6_0, O1=m6_1, O2=m6_2, O3=m6_3, O4=m6_4, O5=m6_5, O6=m6_6, O7=m6_7)WORD8(D0=acc0, D1=acc1, D2=acc2, D3=acc3, D4=acc4, D5=acc5, D6=acc6, D7=acc7, W=rw7, R=rr7, O0=m7_0, O1=m7_1, O2=m7_2, O3=m7_3, O4=m7_4, O5=m7_5, O6=m7_6, O7=m7_7) OR8(A=m0_0, B=m1_0, C=m2_0, D=m3_0, E=m4_0, F=m5_0, G=m6_0, H=m7_0, Y=ram0)OR8(A=m0_1, B=m1_1, C=m2_1, D=m3_1, E=m4_1, F=m5_1, G=m6_1, H=m7_1, Y=ram1)OR8(A=m0_2, B=m1_2, C=m2_2, D=m3_2, E=m4_2, F=m5_2, G=m6_2, H=m7_2, Y=ram2)OR8(A=m0_3, B=m1_3, C=m2_3, D=m3_3, E=m4_3, F=m5_3, G=m6_3, H=m7_3, Y=ram3)OR8(A=m0_4, B=m1_4, C=m2_4, D=m3_4, E=m4_4, F=m5_4, G=m6_4, H=m7_4, Y=ram4)OR8(A=m0_5, B=m1_5, C=m2_5, D=m3_5, E=m4_5, F=m5_5, G=m6_5, H=m7_5, Y=ram5)OR8(A=m0_6, B=m1_6, C=m2_6, D=m3_6, E=m4_6, F=m5_6, G=m6_6, H=m7_6, Y=ram6)OR8(A=m0_7, B=m1_7, C=m2_7, D=m3_7, E=m4_7, F=m5_7, G=m6_7, H=m7_7, Y=ram7) AND(row0, selP, pr0)AND(row1, selP, pr1)AND(row2, selP, pr2)AND(row3, selP, pr3)AND(row4, selP, pr4)AND(row5, selP, pr5)AND(row6, selP, pr6)resistor(VCC, pb0)resistor(VCC, pb1)resistor(VCC, pb2)resistor(VCC, pb3)resistor(VCC, pb4)resistor(VCC, pb5)resistor(VCC, pb6)resistor(VCC, pb7)NOT(pb0, pq0)NOT(pb1, pq1)NOT(pb2, pq2)NOT(pb3, pq3)NOT(pb4, pq4)NOT(pb5, pq5)NOT(pb6, pq6)NOT(pb7, pq7) AND(try0, selTRY, t0)AND(try1, selTRY, t1)AND(IO, selIO, io0)OR4(A=ram0, B=pq0, C=t0, D=io0, Y=din0)OR3(A=ram1, B=pq1, C=t1, Y=din1)OR(ram2, pq2, din2)OR(ram3, pq3, din3)OR(ram4, pq4, din4)OR(ram5, pq5, din5)OR(ram6, pq6, din6)OR(ram7, pq7, din7)

Stuck? Something doesn't work →