Builtin CPU test failed

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

Builtin CPU test failed

JYK
I am doing the project 5 via the online IDE, when I first try to run the builtin CPU as usual, it failed with the test script CPU.tst, does anybody face the same issue? And when I switched to CPU-external.tst it passes the test no matter what you write in hdl, very weird situation. I checked closely the CPU-external.tst it turns out this test script doesnt include any compare file that's why it passes hdl all the time. What should I do? Becuase if  the CPU.tst failed with the buitin CPU and the CPU-external.tst passes the design all the time, how can I know if my hdl is gonna be correct??
Reply | Threaded
Open this post in threaded view
|

Re: Builtin CPU test failed

Skittle2132
I ran into the same issue in the online IDE. This screenshot includes all of the errors I'm getting:



I isolated it to the builtin ALU. When the c-bits are set to 111010, such as in the instruction 1110 1110 1001 0000 (code for D=-1), the ALU should output all 1's (-1 in 2's complement). The ALU outputs all 0's instead though. There may be an issue with the third c-bit? I noticed when I set the c-bits to 110010, e.g. 1110 1100 1001 0000 (code for D=A-1), the ALU output switched to all 1's.

I replaced the builtin ALU with my own ALU that I built in chapter 2, by copying + pasting the chips in the PARTS section of my ALU and changing all the pin names that needed to be changed, and it passed all tests.

As I tried to reproduce the bug with the builtin CPU, sometimes it would pass the tests and sometimes it would fail. These steps more reliably reproduced the bug for me:
1. Run CPU tests on my own implementation of the CPU using the builtin ALU (which will get errors)
2. Toggle the "Builtin" switch at the top of the page
3. Run CPU tests on the builtin CPU

Resetting and rerunning the tests in this state seems to always get the same errors.

These steps appear to make the builtin CPU pass though:
1. Run CPU tests on my own implementation of the CPU using a custom implementation of the ALU (that works according to the chapter 2 ALU tests)
2. Toggle the "Builtin" switch at the top of the page
3. Run CPU tests on the builtin CPU

I originally encountered this bug on Zen browser (a Firefox fork), but the same thing happens for me on Chromium (a browser upstream from Google Chrome, Edge, and most other browsers). All steps described above reproduce the bug on both Zen and Chromium for me.

I'd attach my CPU implementation, but this is my first post here and I don't know if there are any rules about that.