StanfordAHA/lassen

asr doesn't work at all

Closed this issue · 6 comments

Kuree commented

When I was running Jeff's end-to-end tests, based on the waveform I've seen asr is not implemented correctly in RTL. See the waveform below.
image

Then I went ahead and poked around inside lassen. Even if I added asr to RTL, the tests is still passing. That's odd. I then ask pytest to print out everything, and here are the things I found:

  1. asr is not working
  2. fault is not reporting error even though verilator fails.
  3. (maybe a problem) where is the SMT formal check on the RTL? Or this is not how formal works? (please forgive me if I make a wrong assertion.)

Here is the link to the print out: https://travis-ci.org/StanfordAHA/lassen/builds/532629001#L1217
You can reproduce the individual test using test_asr branch with the following command:

pytest tests/test_rtl.py -k "test_rtl[False-mode0-asr]" -s

You should see the verilator assertion failed but pytest passed.

I'd call for a thorough manually examination on every single op we have a manually test them to prevent these kinds of mistake from happening again.

Fault missing the error is from a regression introduced recently (good news because that means that errors could only have slipped through due to recent changes, which I hope there haven't been many).

This PR (leonardt/fault#88) changed the logic to redirect stdout to a file (https://github.com/leonardt/fault/blob/7e117e56c4e414631bb1c40c1e1f28848f9cedc3/fault/verilator_target.py#L379) but a side-effect of that change was that the exit code for the first command in the pipe is now dropped (which means fault misses the assertion).

Working on a fix now (will also add a test that makes sure that an assertion occurs for a failing test so we catch issues like this in the future).

Not sure what the issue with asr is yet though.

Kuree commented

asr is not padding signed bits in RTL. The functional model is correct though. I will take a look at the RTL today to see what's wrong there.

EDIT: Can you just throw an exception in verilator? That should definitely stop the testing and report an error.

This fixes the verilator silent failure issue: leonardt/fault#100 by setting -o pipefail before the verilator run command, investigating the RTL bug now, I suspect it's because it's generating a logical shift from mantle (instead of an arithmetic shift).

First issue was that mantle was not setting the __rshift__ operator on the SIntType to be asr (so it defaulted to LSR inherited from the BitsType, fixed by phanrahan/mantle#147

Test is still failing, I suspect due to a polymorphism (lack of magma support) issue, investigating this now

Tests is passing locally for me now, opened a PR #69, but depends on some upstream branches being merged.

Kuree commented

Thanks for the quick fix!