woai3c / nand2tetris

计算机系统要素-从零开始构建现代计算机
MIT License
2.65k stars 441 forks source link

[ALU] Parameters too many in Mux16. #10

Closed LucasYao93 closed 4 years ago

LucasYao93 commented 4 years ago
woai3c commented 4 years ago

This is the right answer, you can run the ALU test and see the result.

woai3c commented 4 years ago
// no
    Not16(in = o1, out = o2);
    Mux16(a = o1, b = o2, sel = no, out = out, out = o3);

    // zr
    Or16Way(in = o3, out = zr1);
    Not(in = zr1, out = zr);

    // ng
    IsNeg(in = o3, out = ng);
woai3c commented 4 years ago

the or16way need the o3, and the out = out is ALU out.

LucasYao93 commented 4 years ago

the or16way need the o3, and the out = out is ALU out.

You mean that Mux16 outputs two values o3 and out, they are the same. Right ?

woai3c commented 4 years ago

兄弟,我看你是中国人,用中文和你说。Mux16 就一个输出是 out,但是可以将多个逻辑门接在一个引脚上,例如 Or16Way 接在 Mux16 的 out 上,所以就能用 out=o3。另外它还要当成 ALU 的输出,就是 out=out。

LucasYao93 commented 4 years ago

Mux16不是三个输入引脚,一个输出引脚吗, Mux16(a = o1, b = o2, sel = no, out = out, out = o3);这行命令看起来是两个输出引脚

woai3c commented 4 years ago

我估计这就跟一条河一样,在河的出口旁边挖条坑,水也能往旁边出,这就有了两个出口。ALU 这个引脚是指向内部的,对外的出口就只有一个 out。

LucasYao93 commented 4 years ago

我估计这就跟一条河一样,在河的出口旁边挖条坑,水也能往旁边出,这就有了两个出口。ALU 这个引脚是指向内部的,对外的出口就只有一个 out。

ok, 了解了,感谢