|
This post was updated on .
I'm working on a new type of CPU chip for an assignment, the difference is that the D register is replace by a bank of 4 register and the input to that bank is controlled by 2 read access outa[2] and outb[2], 1 write access inc[2]. on top of that their is an added Jump instruction. I have modified the code to suit the new changes but the problem is that every time after the new input line shows up the register banks load pin would change after the register has been loaded, but the input line does not have a bit that set register load to 1, but it would stay on 1 from the previous line and change after the data in A register is sent to register bank.
Mux16(a=ALUOut, b=instruction, sel=Noper, out=Muxout);
Not(in=instruction[15],out=Noper);
And(a=instruction[0],b=instruction[2],out=destA);
Or(a=Noper, b=destA, out=loadA);
ARegister(in=Muxout, load=loadA, out[0..14]=addressM, out=RegA);
Not(in=instruction[2],out=Dbar);
And(a=instruction[15],b=instruction[14],out=Dinst); CHANGES HERE
And(a=Dbar,b=Dinst,out=loadD);
RegisterBank4(in=ALUOut,load=loadD,ina=instruction[5..6],inb=instruction[3..4],inc=instruction[0..1],outa=Da,outb=Db); CHANGES HERE IN inc
Mux4Way16(a=false,b=Db,c=RegA,d=inM, sel=instruction[12..13], out=DbAM);
ALU(x=Da, y=DbAM, zx=instruction[11], nx=instruction[10], zy=false, ny=instruction[8], f=instruction[7], no=instruction[6], out=outM, out=ALUOut, zr=O, ng=lt);
And(a=instruction[2],b=instruction[1],out=toM);
And(a=toM, b=instruction[14], out=writeM);
Or(a=O, b=lt, out=lte);
Not(in=lte, out=pos);
And(a=instruction[2], b=lt, out=jlt);
And(a=instruction[1], b=O, out=jeq);
And(a=instruction[0], b=pos, out=jgt);
Or(a=jlt, b=jeq, out=tempj);
Or(a=tempj, b=jgt, out=jumpor);
Not(in=instruction[14],out=J);
And(a=instruction[15],b=J,out=Jjump);
And(a=Jjump, b=jumpor, out=jump);
PC(in=RegA, load=jump, inc=true, reset=reset, out[0..14]=pc, out[15]=abc);
Since I can't attach files, I can't show the new line structure and related information, but if anyone has a vague idea of the error, any help is appreciated
|