llvm / llvm/circt

Discrepancy between behavioral simulation and post-implementation simulation/ hardware execution

Open
#3,121 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

Hello,

I am using the most current version of CIRCT and I am having issues getting even some "basic" RTL to work properly. The behavioral simulation in Vivado 2021.2 is working correctly, but the post-implementation timing simulation shows incorrect behavior. I even tried the sample dot.mlir code from the circt/integration_test/Dialect/Handshake/ folder and using the driver code provided I get the same results. Below are screenshots of simulating the RTL generated from dot.mlir using the provided lowering commands:

Behavioral simulation:
![Screenshot from 2022-05-12 16-31-42](https://user-images.githubusercontent.com/70769188/168169337-91f0771c-b835-4b2b-a3a6-b2663107c690.png)
![Screenshot from 2022-05-12 16-32-17](https://user-images.githubusercontent.com/70769188/168169346-1ef6d147-7efe-40bd-976b-754522551b5d.png)

Post-implementation timing simulation:
![Screenshot from 2022-05-12 16-43-01](https://user-images.githubusercontent.com/70769188/168169376-41142a36-52a3-4591-891d-05c6a730cb10.png)

When I programmed the FPGA, the hardware was effectively not working. In both cases, it seems the RTL halts executing very early on.

Doing some debugging, I noticed in both the example code and my design, the multiplication module (arith_multi) is combinational. I do not know if this is the expected behavior but tracing things, the output of the multiplier is never computed in post-implementation simulation or in actual hardware (checked using an ILA). To make matters worse, the operation is mapped to a DSP with the clock tied to 0 so it never completes any computation.

Below are screenshots of the multi modules in both RTL and Synthesis schematic:

RTL:
![Screenshot from 2022-05-12 17-28-38](https://user-images.githubusercontent.com/70769188/168171245-eaba4502-42b5-4612-8828-7e8aaf4e9899.png)

Synthesized
![Screenshot from 2022-05-12 17-29-13](https://user-images.githubusercontent.com/70769188/168171259-297ccd58-30f9-4ae7-8b66-aa6db9f1b740.png)

Any insights if I am doing anything wrong would be appreciated.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with circt/integration_test/Dialect/Handshake/dot.mlir and reproduce the reported lowering and simulation flow in Vivado 2021.2. Inspect the generated arith_multi RTL and its synthesized DSP connection, comparing behavioral simulation, post-implementation timing simulation, and ILA observations. Done means explaining the discrepancy and identifying a correction that makes the multiplier compute on hardware.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.