summaryrefslogtreecommitdiffstats
path: root/algorithm.tex
diff options
context:
space:
mode:
authorJohn Wickerson <j.wickerson@imperial.ac.uk>2021-08-14 12:19:13 +0000
committernode <node@git-bridge-prod-0>2021-08-18 05:52:26 +0000
commit02cad5f3082fb3661a121be62c09b8356e36a584 (patch)
tree3b5863852b8802bab53447966256e890df9f699b /algorithm.tex
parent89a6940481b95b096fc6790184737f3c4ff7b3d7 (diff)
downloadoopsla21_fvhls-02cad5f3082fb3661a121be62c09b8356e36a584.tar.gz
oopsla21_fvhls-02cad5f3082fb3661a121be62c09b8356e36a584.zip
Update on Overleaf.
Diffstat (limited to 'algorithm.tex')
-rw-r--r--algorithm.tex2
1 files changed, 2 insertions, 0 deletions
diff --git a/algorithm.tex b/algorithm.tex
index 130d403..2aff9bb 100644
--- a/algorithm.tex
+++ b/algorithm.tex
@@ -88,6 +88,7 @@ It has an unlimited number of pseudo-registers, and is represented as a control
This section will introduce Verilog for readers who may not be familiar with the language, concentrating on the features that are used in the output of \vericert{}. Verilog is a hardware description language (HDL) and is used to design hardware ranging from complete CPUs that are eventually produced as an integrated circuit, to small application-specific accelerators that are placed on an FPGA. Verilog is a popular language because it allows for fine-grained control over the hardware, and also provides high-level constructs to simplify the development.
Verilog behaves quite differently to standard software programming languages due to it having to express the parallel nature of hardware. The basic construct to achieve this is the always-block, which is a collection of assignments that are executed every time some event occurs. In the case of \vericert{}, this event is either a positive (rising) or a negative (falling) clock edge. All always-blocks triggering on the same event are executed in parallel. Always-blocks can also express control-flow using if-statements and case-statements.
+\NR{Might be useful to talk about registers must be updated only within an always block.} \JW{That's important for Verilog programming in general, but is it necessary for understanding this paper?}
\begin{figure}
\centering
@@ -136,6 +137,7 @@ endmodule
\label{fig:tutorial:state_machine}
\end{figure}
+
A simple state machine can be implemented as shown in Figure~\ref{fig:tutorial:state_machine}.
At every positive edge of the clock (\texttt{clk}), both of the always-blocks will trigger simultaneously. The first always-block controls the values in the register \texttt{x} and the output \texttt{z}, while the second always-block controls the next state the state machine should go to. When the \texttt{state} is 0, \texttt{x} will be assigned to the input \texttt{y} using nonblocking assignment, denoted by \texttt{<=}. Nonblocking assignment assigns registers in parallel at the end of the clock cycle, rather than sequentially throughout the always-block. In the second always-block, the input \texttt{y} will be checked, and if it's high it will move on to the next state, otherwise it will stay in the current state. When \texttt{state} is 1, the first always-block will reset the value of \texttt{x} and then set \texttt{z} to the original value of \texttt{x}, since nonblocking assignment does not change its value until the end of the clock cycle. Finally, the last always-block will set the state to be 0 again.