CPu.hdl does not pass the test

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

CPu.hdl does not pass the test

bader
hi there, my CPU.hdl does not pass the test : it tells me --> comparison failute at line 27.
i,v spent two hours and could not fix it,
it would be great if there is anyone  i can send my code and give me a hint where the error could be.

thanks,
bader.

Reply | Threaded
Open this post in threaded view
|

Re: CPu.hdl does not pass the test

cadet1620
Administrator
bader wrote
it would be great if there is anyone  i can send my code and give me a hint where the error could be.
You can send your code to me and I'll be happy to take a look at it for you.

--Mark

Reply | Threaded
Open this post in threaded view
|

Re: CPu.hdl does not pass the test

bader
This post was updated on .
i'v sent it to cadet1620, and thanks for the fast reply ! :)

bader
Reply | Threaded
Open this post in threaded view
|

Re: CPu.hdl does not pass the test

bader
In reply to this post by cadet1620
thanks alot for your time, it works now (didn't know how i missed this !! :) ).



bader.
Reply | Threaded
Open this post in threaded view
|

Re: CPu.hdl does not pass the test

rbrisi
Hi there,

i'm dealing with the same exact problem bader had right now (cpu test line 27 miscompare).

The problems seems to be my pc value which gives 14 instead of 15, which should be the right value according to the cmp file.

Could someone give me a clue?

An extra question: I think my jump logic is not the most optimized one, could someone help with hints to how I can simplify it?

Thanks a lot
Reply | Threaded
Open this post in threaded view
|

Re: CPu.hdl does not pass the test

WBahn
Administrator
rbrisi wrote
Hi there,

i'm dealing with the same exact problem bader had right now (cpu test line 27 miscompare).

The problems seems to be my pc value which gives 14 instead of 15, which should be the right value according to the cmp file.

Could someone give me a clue?
It's very difficult to figure out what is wrong with a design when we have to guess what that design even is. The only thing I can speculate about given so little to go on is that your jump logic and/or PC has issues. That because just before where the mismatch occurred there is a D;jlt instruction and the A register is set to 14 and the D register, upon which the jump is based, is set to -1. So the jump should be taken (PC changes from 11 to 14), but then, if I understand your verbal description of the error (it would sure be nice to see an except of the .out file with the last few lines so that we can see exactly what the state of everything was), the next instruction, @999, should just change the A register and the PC should advance to 15, but it doesn't. So something is preventing the PC from incrementing. But what I can't tell is whether it is simply holding at the present value, or actually jumping again to the value that was in the A register again.

An extra question: I think my jump logic is not the most optimized one, could someone help with hints to how I can simplify it?
This is like telling someone that your car isn't working and asking them for hints on how to fix it. How can we give you hints on how to simplify your logic when we have no idea what your logic is?
Reply | Threaded
Open this post in threaded view
|

Re: CPu.hdl does not pass the test

rbrisi
Hi there, thanks for the help!

I found a mistake in my program and corrected it, but instead of getting an error on line 27, now I'm having one on line 45. It seems to be concerned with PC as well:



Instead of jumping to the next instruction, in this case 26, my PC is feeding in the A-register address directly (PC counter goes to 1000).

Here's what I thought for my jump logic:

1) Create pos flag by XORing ng and zr flags;
2) pos=1 AND j3=1 makes jumppos=1;
3) zr=1 AND j2=1 makes jumpzr=1;
4) ng=1 AND j1=1 makes jumpng=1;
5) jumppos=1 OR jumpzr=1 makes a1=1;
6) a1=1 OR jumpng=1 makes a2=1;
7) a2=1 AND instruction[15]=1 makes jump=1; % If it is a C-instruction and jump condition is satisfied, then JUMP

Hope this is a specific enough explanation of the problem without posting my code.

Thanks for the help!




Reply | Threaded
Open this post in threaded view
|

Re: CPu.hdl does not pass the test

rbrisi
Sorry, moments after I posted the previous question, I realized I needed an NotOR to make a pos flag out of zr and ng instead of an XOR, I corrected it my CPU passed the test!

I appreciate your help and sorry for my lack of details in previous questions!