cpu problem in inM pin loading

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

cpu problem in inM pin loading

karam
This post was updated on .
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);
   
Reply | Threaded
Open this post in threaded view
|

Re: cpu problem in inM pin loading

WBahn
Administrator
There are NINE comparison files that come with Project 05. Do you really expect people to go hunting through them hoping that they are able to identify the specific one you are referring to? Or do you think that we have crystal balls that allow us to read your mind?

An * in the comparison file matches ANY character in the corresponding position of the output file.
Reply | Threaded
Open this post in threaded view
|

Re: cpu problem in inM pin loading

karam
i meant the cpu tst file and i wrote it on the header
Reply | Threaded
Open this post in threaded view
|

Re: cpu problem in inM pin loading

WBahn
Administrator
Thanks for updating the initial post with that information.

In the CPU.cmp file, the inM is never '*', it is always either 0 or 11111.

The outM, on the other hand, is usually '*' except for a few times when it's value should be a specific, known value.

It's hard to tell you what you're doing wrong until you tell US what went wrong.

If the test says that there was a comparison failure on a certain line, then tell us what line and provide the output, at least for that line, from both the .out and the .cmp file. The feedback is give to you to help you track down the error, don't deny that feedback to the people you are asking for help from.
Reply | Threaded
Open this post in threaded view
|

Re: cpu problem in inM pin loading

karam
Reply | Threaded
Open this post in threaded view
|

Re: cpu problem in inM pin loading

WBahn
Administrator
The text comparer program is just that -- it compares two text files and reports the first line in which the text in one file is not exactly equal to the text in the other file. It doesn't know that an asterisk should match any character.

The key is that the simulator is telling you that there is a mismatch on line 3. Look at line 3 of the .cmp file and you will see that the value in the "addre" column is 12345 while your output in that column is 0.

So look for why your value is different than what is expected.
Reply | Threaded
Open this post in threaded view
|

Re: cpu problem in inM pin loading

karam
i did it ther was aproblem in the first Mux i swiched between instruction and the aluoutput
and ther was some problem in my jump condtion
i rely need to practice the debugging
thanks a lot for your help
Reply | Threaded
Open this post in threaded view
|

Re: cpu problem in inM pin loading

WBahn
Administrator
You get the practice by doing it -- and it's a painful process. Glad you got it solved.