The course课程
16 lessons · 16 chips · on X Layer16 节课 · 16 颗芯片 · 在 X Layer 上
From one gate to a computer.从一个门,
到一台计算机。
Every lesson ends with a chip of your own, made and graded on X Layer. Each chip becomes a part you build the later ones from.每一节课的结尾,都是一颗属于你自己的芯片,在 X Layer 上制造并评分。每一颗芯片,都会成为你搭建后面芯片的零件。
Part 1 of 4第 1 部分,共 4 部分
Gates逻辑门
Five kinds of gate, all made from the one part you are given.
五种逻辑门,全部用你拿到的那一种零件做成。
- 01NOT gateMake the output the opposite of the input: 1 becomes 0, and 0 becomes 1.让输出与输入相反:1 变成 0,0 变成 1。
- 02AND gateThe output is 1 only when A and B are both 1.只有 A 和 B 都是 1 时,输出才是 1。
- 03OR gateThe output is 1 when A is 1, or B is 1, or both.A 是 1,或者 B 是 1,或者两个都是 1 时,输出为 1。
- 04XOR gateThe output is 1 when A and B are different.A 和 B 不相同时,输出为 1。
- 05MultiplexerA switch for signals. When pick is 0 the output follows A; when pick is 1 it follows B.一个信号选择器。pick 为 0 时输出跟随 A;pick 为 1 时输出跟随 B。
Part 2 of 4第 2 部分,共 4 部分
Numbers数字
Chips that add, add one, and spot a zero.
会相加、会加一、会认出零的芯片。
- 06Half adderAdd two bits. The sum is 1 when exactly one input is 1. The carry is 1 when both are.把两位数相加。恰好有一个输入为 1 时,和为 1;两个都为 1 时,进位为 1。
- 07Full adderAdd three bits: A, B and a carry coming in. Give the sum and the carry going out.把三位数相加:A、B 和进来的进位。给出和,以及向外的进位。
- 084-bit adderAdd two 4-bit numbers and a carry in. Five lamps show the answer.把两个 4 位数和一个进位相加,用五盏灯显示结果。
- 09IncrementerAdd one to a 4-bit number. Fifteen goes back to zero.给一个 4 位数加一。十五加一回到零。
- 10Zero detectorThe output is 1 only when all four inputs are 0.只有四个输入全是 0 时,输出才是 1。
Part 3 of 4第 3 部分,共 4 部分
Orders and memory命令与记忆
A chip that reads orders, and chips that remember.
一颗读得懂命令的芯片,和几颗会记忆的芯片。
- 11Instruction decoderThree inputs carry a number from 0 to 7. Light the first output for 1, the second for 2, and so on up to 6. For 0 and 7, light nothing.三个输入表示 0 到 7 的一个数。数是 1 时点亮第一个输出,是 2 时点亮第二个,依此类推到 6。数是 0 或 7 时,一个都不亮。
- 12Memory bitRemember one bit. When load is 1, take in data. When load is 0, keep what you hold. The output shows the bit held before this beat.记住一位数据。load 为 1 时,存入 data;load 为 0 时,保持原来的值。输出显示这一拍之前保存的那一位。
- 134-bit registerFour memory bits side by side, sharing one load input.四个记忆位并排放在一起,共用一个 load 输入。
- 144-bit counterCount up by one on every beat. When reset is 1, go to zero. The output shows the new count.每一拍加一。reset 为 1 时回到零。输出显示新的计数值。
Part 4 of 4第 4 部分,共 4 部分
The computer计算机
Everything you made, inside one chip that runs a program.
把你做过的一切,装进一颗能运行程序的芯片。
- 15ALUThe arithmetic part of a computer. Control lines choose what it does with A and B: pass B through, add them, NAND them, or leave A as it is.计算机里负责运算的部分。控制线决定它对 A 和 B 做什么:直接输出 B、相加、做 NAND,或者保持 A 不变。
- 16Sillu-4 computerA computer. Each beat it reads one instruction: a 3-bit operation and a 4-bit number. It keeps a program counter, an accumulator and a carry flag.一台计算机。每一拍读入一条指令:3 位的操作码和 4 位的数字。它保存着程序计数器、累加器和进位标志。