Assembly 试图为NAND2TTERIS书籍构建一台PC(计数器),但我';我在逻辑上有点问题
这是我的密码:Assembly 试图为NAND2TTERIS书籍构建一台PC(计数器),但我';我在逻辑上有点问题,assembly,hdl,nand2tetris,Assembly,Hdl,Nand2tetris,这是我的密码: 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
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,这取决于负载的值。然后,从该寄存器中产生的任何值(无论是更改的值还是来自旧寄存器的值)都被放入寄存器中
我做错了什么?您似乎没有将
中的信号连接到任何东西。如果设置了加载
信号,则需要获得适当的Mux16以将In
值加载到寄存器中。更改重置决策
和加载决策
的顺序。第一个优先级更高
Inc16(in=outpc, out=outincreased);
Mux16(a=outpc, b=outincreased, sel=inc, out=outinc);
Mux16(a=outinc, b=in, sel=load, out=outload);
Mux16(a=outload, b=false, sel=reset, out=outreset);
//And16(a=outLOAD, b[0..15]=reset, out=outreset);
Register(in=outreset, load=true, out=out, out=outpc);
复位Mux16需要在加载Mux16后进行。负载Mux16需要将“in”作为“b”引脚
我的NAND2TTERIS工作代码:
Inc16(in = outandabout, out = incout);
Mux16( a = outandabout, b = incout, sel = inc, out = incinc);
Mux16( a = incinc, b = in, sel = load, out = loadout);
Mux16( a = loadout, b = false, sel = reset, out= outreset);
Register(in = outreset, load = true, out = out, out = outandabout);
不要说需要发生什么,你应该评论为什么事情需要这样发生。这样做可以让将来的其他人从你的答案中学到更多。