cpu problem in inM pin loading

Posted by karam on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/cpu-problem-in-inM-pin-loading-tp4034519.html

hello everyone

I'm having trouble understanding why in the comparison file
of the cpu.tst
of project 5 the inM pin input ***** when it dosnt have any value set

in my code im checking if the the instruction is c or A
if A im loading the valu to A
after im checking the abit and MSB
to chose between inM and A regester
but still got wrong output in outM
becouse inM pin send wrong input

can someone tell me what im doing wrong pleas

my code:
 Or(a=instruction[15],b=instruction[5],out=Aord1);
    Mux16(a=aluout,b[0..14]=instruction[0..14],sel=instruction[15],out=adress);
    ARegister(in=adress,load=Aord1,out=outa,out[0..14]=addressM);
    DRegister(in=aluout,load=instruction[4],out=outd);
    And(a=instruction[15],b=instruction[12],out=opandabit);
    Mux16(a=outa,b=inM,sel=opandabit,out=outAorinM);
    And(a=instruction[15],b=instruction[3],out=writeM);
    ALU(x=outd,y=outAorinM,zx=instruction[11],nx=instruction[10],zy=instruction[9],ny=instruction[8],
        f=instruction[7],no=instruction[6],out=aluout,
        out=outM,zr=ozr,ng=ong);
    And(a=instruction[0],b=instruction[1],out=outj1andj2);
    And(a=outj1andj2,b=instruction[2],out=outj1j2j3);
    And(a=outj1j2j3,b=ozr,out=outzrandjump);
    And(a=outzrandjump,b=ong,out=outjmpAndzrAndng);
    Not(in=outjmpAndzrAndng,out=outinc);
    PC(in=outa,inc=outinc,load=outjmpAndzrAndng,reset=reset,out[0..14]=pc);