diff options
author | Yann Herklotz <ymh15@ic.ac.uk> | 2020-12-17 14:04:42 +0000 |
---|---|---|
committer | overleaf <overleaf@localhost> | 2020-12-31 14:48:38 +0000 |
commit | a5249eb597549437802d2ed852919e5b9a923840 (patch) | |
tree | 29a32aa1fba1dc0211be88497884d0c7a2db1690 /old | |
parent | ea9289245fbc493530e9435faf498cc4a824c70f (diff) | |
download | fccm21_esrhls-a5249eb597549437802d2ed852919e5b9a923840.tar.gz fccm21_esrhls-a5249eb597549437802d2ed852919e5b9a923840.zip |
Update on Overleaf.
Diffstat (limited to 'old')
-rw-r--r-- | old/old_legup_bug.tex | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/old/old_legup_bug.tex b/old/old_legup_bug.tex new file mode 100644 index 0000000..00a61da --- /dev/null +++ b/old/old_legup_bug.tex @@ -0,0 +1,24 @@ +\begin{example}[A miscompilation bug in LegUp] + +The test-case in Figure~\ref{fig:eval:legup:wrong} produces an incorrect Verilog in LegUp 4.0 and 7.5, which means that the results of RTL simulation is different to the C execution. + +\begin{figure} +\begin{minted}{c} +volatile int a = 0; +int b = 1; + +int main() { + int d = 1; + if (d + a) + b || 1; + else + b = 0; + return b; +} +\end{minted} +\caption{An output mismatch: LegUp HLS returns 0 but the correct result is 1.}\label{fig:eval:legup:wrong} +\end{figure} + +In the code above, \texttt{b} has value 1 when run in GCC, but has value 0 when run with LegUp. If the \texttt{volatile} keyword is removed from \texttt{a}, then the Verilog produces the correct result. As \texttt{a} and \texttt{d} are constants, the \code{if} statement should always produce go into the \texttt{true} branch, meaning \texttt{b} should never be set to 0. The \texttt{true} branch of the \code{if} statement only executes an expression which is not assigned to any variable, meaning the initial state of all variables should not change. However, LegUp HLS generates a design which enters the \texttt{else} branch instead and assigns \texttt{b} to be 0. The cause of this bug seems to be the use of \texttt{volatile} keyword, which interferes with the analysis that attempts to simplify the \code{if} statement. + +\end{example}
\ No newline at end of file |