Quantcast

Help in PC

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Help in PC

nikol29799
Hello,
Can anyone help me find the problem in my CPU code?
Many thanks to all helpers!! :)


Mux16(a=instruction , b=outalu , sel=instr-type , out=outab );
Mux16(a=outreg , b=inM , sel=a-bit , out=outac );
ALU(x=outb , y=outac , zx=c1-bit , nx=c2-bit , zy=c3-bit , ny=c4-bit , f=c5-bit , no=c6-bit , out=outalu , zr=outzr , ng=outng );
And(a=instr-type, b=d2-bit, out=out3);
DRegister(in=outalu , load=out3 , out=outreg1);
Not(in=instr-type, out=out1);
Or(a=out1, b=d1-bit, out=out2);
ARegister(in=outab , load=out2 , out=outreg , out[0..14]=outadd);
And(a=j1-bit, b=outng, out=outand1);
And(a=j2-bit, b=outzr, out=outand2);
Or(a=outand1, b=outand2, out=outor1);
Not(in=outzr, out=outnotzr);
Not(in=outng, out=outnotng);
And(a=j3-bit, b=outnotzr, out=outand3);
And(a=outand3, b=outnotng, out=outand4);
Or(a=outor1, b=outand3, out=outpc1);
And(a=outpc1, b=outand4, out=outpc2);
PC(in=outreg , load=loadpc , inc=true , reset=reset , out[0..14]=out);
       
}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help in PC

ybakos
Hi,
You seem to be missing some fundamentals, which is going to cause you some problems in getting this right. For example, where does the instr-type pin come from? You have it wired to the input of a few chips, but this pin does not exist. The same is true for things like j1-bit and j2-bit.

At some point in the CPU needs to break apart the C instruction, I don't see your implementation doing this.
Loading...