试图为 nand2tetris 构建一台 PC计数器,但我在逻辑上遇到了一些问题

问题描述

该项目旨在构建一个程序计数器。

说明如下:

// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken,MIT Press.
// File name: projects/03/a/PC.hdl

/**
 * A 16-bit counter with load and reset control bits.
 * if      (reset[t] == 1) out[t+1] = 0
 * else if (load[t] == 1)  out[t+1] = in[t]
 * else if (inc[t] == 1)   out[t+1] = out[t] + 1  (integer addition)
 * else                    out[t+1] = out[t]
 */

我想出了所有的可能性如下 All possible output 那我来了:

    CHIP PC 
{
    IN in[16],load,inc,reset;
    OUT out[16];

    PARTS:
    // Put your code here:
    Register(in=in,load=true,out=thein);
    Register(in=in,load=false,out=theout);
    Inc16(in=theout,out=forinc);
    Register(in=forinc,out=theinc);
    Mux8Way16(a=theout,b=false,c=theinc,d=false,e=thein,f=false,g=thein,h=false,sel[2]=load,sel[1]=inc,sel[0]=reset,out=out);
}

我尝试了很多次,但是当时钟加载到时间 1+ 或类似的东西时都失败了。

由于这里定义的寄存器是 out(t+1) = out(t)

time 的输出是多少?+。我觉得这很烦人。

任何建议将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)