这是我的代码:
CHIP PC {
IN in[16],load,inc,reset;
OUT out[16];
PARTS:
Inc16(in = regout, out = incout);
Mux16(a = regout, b = incout, sel = inc, out = incdecision);
Mux16(a = incdecision, b = false, sel = reset, out = resetdecision);
Mux16(a = regout, b = resetdecision, sel = load, out = loaddecision);
Register(in = loaddecision, load = true, out = regout, out = out);
}
基本上,来自寄存器的值是递增的,仅当 inc 为 1(通过 Mux 检查)时才被接受,然后通过另一个可能重置它的 Mux,然后是另一个可能会或可能不会写入它的 Mux,具体取决于负载值。然后从中产生的任何值(无论是更改的值还是来自旧寄存器的值)都被放入寄存器中。
我究竟做错了什么?