Login  Register

Program Counter Implementation

Posted by Zebo on May 23, 2011; 5:05am
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/Program-Counter-Implementation-tp2974049.html

I keep getting a comparison failure at line 9 with my implementation that seems perfectly fine.  All the internal pins seem to be giving what I need but I think that I need one more clock delay.  However, when I try remedy this by adding another register then I get a comparison failure at line 5.

Here is the chip:

CHIP PC {

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

    PARTS:
    Mux16(a=new, b=in, sel=load, out=out1);
    Mux16(a=false, b[1..15]=false, b[0]=true, sel=inc, out=out2);
    Add16(a=out1, b=out2, out=out3);
    Mux16(a=out3, b=false, sel=reset, out=out4);
    Register(in=out4, load=true, out=new, out=out);
}

Any general advice?

By the way, thank you Mark for your help in my other 2 threads, that helped me out a ton.