So i am comparing my Alu.hdl with the Alu-nostat.tst and i get "Comparison failure at line n" several times in the Hardware simulator.I checked several times my code and syntax seems correct.
Your implementation is not correct.
When the test fails, you need to look at the Compare and Output Views to see what the difference is in the output. There is a horizontal scrolling bug in the HardwareSimulator that makes this difficult for this test. I recommend opening the ALU-nostat.cmp and ALU-nostat.out files in a text editor so that you can see the full lines when the miscompare occurs.
A common problem with ALU is to use arithmetic negation for the nx, ny and no controls. These controls should be binary Nots.
i will go into more details and if you feel i have to many details that would spoil the implementation for others feel free to edit or i will edit it later.
So i still am not able to understand what is wrong.
I checked the circuits f and no and theyr connection, and i am not sure what i should do different, but based on what you said i guess my error should be somewhere arround here?
I also have done a side by side comparison between cmp and out in order to find a similarity between the errors. but i can't seem to find one.What confuses me the most is the fact that i get good results and bad results mixed together during the simulation.If something is wrong in my ALU should't i get only bad results?How does this work?
Read the ALU description carefully. Or16 is an incorrect part.
(In 2's-complement binary numbers, bit 15 is the sign bit so 111..110 is a negative number.
To find the corresponding positive value, invert and add 1.
000..001 + 1 = 000...010 = 2 base 10
so 111..110 is -2 base 10.)