ALU failing ALU-nostat.tst but not ALU.tst?

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

ALU failing ALU-nostat.tst but not ALU.tst?

mchtx
Hi all, I created the ALU all the way including the flags, and felt pretty good about it. I ran it with ALU.tst and it passed. Simply for the sake of completeness, I decided to run it on ALU-nostat.tst. It failed on only the two lines below:

OUTPUT:
| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 0 | 1 | 1 | 0011101011001110 |
| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 1 | 1 | 1 | 1100010100110010 |

CORRECT(CMP):

| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 0 | 1 | 1 | 0011110011001110 |
| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 1 | 1 | 1 | 1100001100110010 |

Bits 10 and 11 are flipped in each case. All other lines it passes.

I can post more about my implementation but just wanted to know, am I missing something very obvious?
Reply | Threaded
Open this post in threaded view
|

Re: ALU failing ALU-nostat.tst but not ALU.tst?

WBahn
Administrator
So what operation is being performed by each of those test cases?

If you perform the operation by hand on the two inputs, what do you get?

If you walk through your implementation with those two inputs and the control bits as specified, what do you get?
Reply | Threaded
Open this post in threaded view
|

Re: ALU failing ALU-nostat.tst but not ALU.tst?

mchtx
The operations here are x-y and y-x. So I assumed it was an error in either my negation or addition logic. What was confusing was that it passed prior separate negation and addition tests.

Anyway I walked through every step by hand, and got the correct answer, so I felt the idea was solid, most likely then a coding error. Since I walked through every step, I was able to compare the internal pin values that I got by hand with the hardware simulator, and saw that the error was occurring after the addition step. I went through my ALU implementation and everything seemed correctly hooked up.

So, despite my Add16 chip passing it's test when I made it, I moved it from the project file, forcing the ALU implementation to use the built-in Add16. The ALU then passed all the tests.

So I went back to my Add16 chip and found a single typo (carrying the wrong bit in one of the adders). Apparently I had made a mistake in a particular area that had not tripped any tests up to this point.  So now that's fixed and everything works.