Source: cirosantilli/verilator-interactive-example

= Verilator interactive example
{c}

The example under \a[verilog/interactive] showcases how to create a simple interactive visual <Verilog> example using <Verilator> and <SDL>.

\Image[https://raw.githubusercontent.com/cirosantilli/media/master/verilog-interactive.gif]

You could e.g. expand such an example to create a simple (or complex) <video game> for example if you were insane enough. But please don't waste your time doing that, <backward design>[Ciro Santilli begs you].

The example is also described at: https://stackoverflow.com/questions/38108243/is-it-possible-to-do-interactive-user-input-and-output-simulation-in-vhdl-or-ver/38174654#38174654

Usage: install dependencies:
``
sudo apt install libsdl2-dev verilator
``
then run as either:
``
make run RUN=and2
make run RUN=move
``
Tested on Verilator 4.038, Ubuntu 22.04.

File overview:
* and2
  * \a[verilog/interactive/and2.cpp]
  * \a[verilog/interactive/and2.v]
* move
  * \a[verilog/interactive/move.cpp]
  * \a[verilog/interactive/move.v]
* \a[verilog/interactive/display.cpp]

In those examples, the more interesting application specific logic is delegated to Verilog (e.g.: move game character on map), while boring timing and display matters can be handled by SDL and C++.