I have problems getting to run the NandToTetris Hack CPU I built on the Harware Simulator

I was able to get the CPU for the most part to load in, but when I pass in the tst file into the system, it is showing comparison errors while using the A instruction when the output seems to be working just fine. I never had issues with the course so far and I honestly didn’t have trouble with any other part of the build until now. However, I still feel like some of the specifications were a little vague and I had to make a lot of assumptions on how to structure the bits.

Here is the HDL for my cpu

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>CHIP CPU {
IN inM[16], // M value input (M = contents of RAM[A])
instruction[16], // Instruction for execution
reset; // Signals whether to re-start the current
// program (reset==1) or continue executing
// the current program (reset==0).
OUT outM[16], // M value output
writeM, // Write to M?
addressM[15], // Address in data memory (of M)
pc[15]; // address of next instruction
PARTS:
//// Replace this comment with your code.
Not(in=instruction[15], out=isAinstruct);
Mux16(a=ALUOUT, b=instruction, sel=isAinstruct, out=mux1out);
Xor(a=chooseA, b=isAinstruct, out=Aload);
ARegister(in=mux1out, load= chooseA, out=Areg);
DRegister(in=ALUOUT, load= Aload, out= Dreg);
Mux16(a=Areg, b=inM, sel=chooseM, out=mux2out);
ALU(x=Dreg,y=mux2out,zx=instruction[11],nx=instruction[10],zy=instruction[9],ny=instruction[8],f=instruction[7],no=instruction[6],out=ALUOUT, zr=zero, ng=neg);
//destination bits
DMux8Way(in = instruction[15], sel=instruction[3..5], a=noDest,b=selM,c=selD,d=selMD,e=selA,f=selAM,g=selAD,h=selALL);
Or8Way(in[0]=selM, in[1]=selMD, in[2]=selAM, in[3]=selALL, out=chooseM);
Or8Way(in[0]=selD, in[1]=selMD, in[2]=selAD, in[3]=selALL, out=chooseD);
Or8Way(in[0]=selA, in[1]=selAM, in[2]=selAD, in[3]=selALL, out=chooseA);
Mux16(a=inM, b=ALUOUT, sel=chooseM, out=outM);
And(a=instruction[15], b=instruction[3], out=writeM);
//Jmp bits and pc
DMux8Way(in=instruction[15], sel=instruction[0..2], a=nojmp, b=JGT, c=JEQ, d=JGE, e=JLT, f=JNE, g=JLE, h=JMP);
Not(in=zero, out=notZero);
Not(in=neg, out=notNeg);
And(a=notZero, b=notNeg, out=pos);
Not(in=pos, out=notPos);
And(a=JGT, b=pos, out=jmp1);
And(a=JEQ, b=zero, out=jmp2);
And(a=JGE, b=notNeg, out=jmp3);
And(a=JLT, b=neg, out = jmp4);
And(a=JNE, b=notZero, out=jmp5);
And(a=JLE, b=notPos, out=jmp6);
Or8Way(in[0]=jmp1,in[1]=jmp2,in[2]=jmp3,in[3]=jmp4,in[4]=jmp5,in[5]=jmp6,in[6]=JMP,out=JUMP);
PC(in=Areg, inc=true, load=JUMP, reset=reset, out[0..14]=pc);
//jmp bits
}
</code>
<code>CHIP CPU { IN inM[16], // M value input (M = contents of RAM[A]) instruction[16], // Instruction for execution reset; // Signals whether to re-start the current // program (reset==1) or continue executing // the current program (reset==0). OUT outM[16], // M value output writeM, // Write to M? addressM[15], // Address in data memory (of M) pc[15]; // address of next instruction PARTS: //// Replace this comment with your code. Not(in=instruction[15], out=isAinstruct); Mux16(a=ALUOUT, b=instruction, sel=isAinstruct, out=mux1out); Xor(a=chooseA, b=isAinstruct, out=Aload); ARegister(in=mux1out, load= chooseA, out=Areg); DRegister(in=ALUOUT, load= Aload, out= Dreg); Mux16(a=Areg, b=inM, sel=chooseM, out=mux2out); ALU(x=Dreg,y=mux2out,zx=instruction[11],nx=instruction[10],zy=instruction[9],ny=instruction[8],f=instruction[7],no=instruction[6],out=ALUOUT, zr=zero, ng=neg); //destination bits DMux8Way(in = instruction[15], sel=instruction[3..5], a=noDest,b=selM,c=selD,d=selMD,e=selA,f=selAM,g=selAD,h=selALL); Or8Way(in[0]=selM, in[1]=selMD, in[2]=selAM, in[3]=selALL, out=chooseM); Or8Way(in[0]=selD, in[1]=selMD, in[2]=selAD, in[3]=selALL, out=chooseD); Or8Way(in[0]=selA, in[1]=selAM, in[2]=selAD, in[3]=selALL, out=chooseA); Mux16(a=inM, b=ALUOUT, sel=chooseM, out=outM); And(a=instruction[15], b=instruction[3], out=writeM); //Jmp bits and pc DMux8Way(in=instruction[15], sel=instruction[0..2], a=nojmp, b=JGT, c=JEQ, d=JGE, e=JLT, f=JNE, g=JLE, h=JMP); Not(in=zero, out=notZero); Not(in=neg, out=notNeg); And(a=notZero, b=notNeg, out=pos); Not(in=pos, out=notPos); And(a=JGT, b=pos, out=jmp1); And(a=JEQ, b=zero, out=jmp2); And(a=JGE, b=notNeg, out=jmp3); And(a=JLT, b=neg, out = jmp4); And(a=JNE, b=notZero, out=jmp5); And(a=JLE, b=notPos, out=jmp6); Or8Way(in[0]=jmp1,in[1]=jmp2,in[2]=jmp3,in[3]=jmp4,in[4]=jmp5,in[5]=jmp6,in[6]=JMP,out=JUMP); PC(in=Areg, inc=true, load=JUMP, reset=reset, out[0..14]=pc); //jmp bits } </code>
CHIP CPU {

    IN  inM[16],         // M value input  (M = contents of RAM[A])
        instruction[16], // Instruction for execution
        reset;           // Signals whether to re-start the current
                         // program (reset==1) or continue executing
                         // the current program (reset==0).

    OUT outM[16],        // M value output
        writeM,          // Write to M? 
        addressM[15],    // Address in data memory (of M)
        pc[15];          // address of next instruction

    PARTS:
    //// Replace this comment with your code.
    Not(in=instruction[15], out=isAinstruct);
    Mux16(a=ALUOUT, b=instruction, sel=isAinstruct, out=mux1out);
    Xor(a=chooseA, b=isAinstruct, out=Aload);
    ARegister(in=mux1out, load= chooseA, out=Areg);
    DRegister(in=ALUOUT, load= Aload, out= Dreg);
    Mux16(a=Areg, b=inM, sel=chooseM, out=mux2out);
    ALU(x=Dreg,y=mux2out,zx=instruction[11],nx=instruction[10],zy=instruction[9],ny=instruction[8],f=instruction[7],no=instruction[6],out=ALUOUT, zr=zero, ng=neg);
    //destination bits
    DMux8Way(in = instruction[15], sel=instruction[3..5], a=noDest,b=selM,c=selD,d=selMD,e=selA,f=selAM,g=selAD,h=selALL);
    Or8Way(in[0]=selM, in[1]=selMD, in[2]=selAM, in[3]=selALL, out=chooseM);
    Or8Way(in[0]=selD, in[1]=selMD, in[2]=selAD, in[3]=selALL, out=chooseD);
    Or8Way(in[0]=selA, in[1]=selAM, in[2]=selAD, in[3]=selALL, out=chooseA);
    Mux16(a=inM, b=ALUOUT, sel=chooseM, out=outM);
    And(a=instruction[15], b=instruction[3], out=writeM);
    //Jmp bits and pc
    DMux8Way(in=instruction[15], sel=instruction[0..2], a=nojmp, b=JGT, c=JEQ, d=JGE, e=JLT, f=JNE, g=JLE, h=JMP);
    Not(in=zero, out=notZero);
    Not(in=neg, out=notNeg);
    And(a=notZero, b=notNeg, out=pos);
    Not(in=pos, out=notPos);
    And(a=JGT, b=pos, out=jmp1);
    And(a=JEQ, b=zero, out=jmp2);
    And(a=JGE, b=notNeg, out=jmp3);
    And(a=JLT, b=neg, out = jmp4);
    And(a=JNE, b=notZero, out=jmp5);
    And(a=JLE, b=notPos, out=jmp6);
    Or8Way(in[0]=jmp1,in[1]=jmp2,in[2]=jmp3,in[3]=jmp4,in[4]=jmp5,in[5]=jmp6,in[6]=JMP,out=JUMP);
    PC(in=Areg, inc=true, load=JUMP, reset=reset, out[0..14]=pc);




    //jmp bits
}

I tried checking if the issue was related to the output of one of the mux gates and the A register wasn’t supposed to take in the value; however I realized this wasn’t the case after rewatching the video.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật