To make full use of MyHDL, it is strongly recommended to install and configure cosimulation modules. So that the output (Verilog/VHDL code) of MyHDL compiler backend can be evaluated, and the current MyHDL code can work with the conventional code base and migrate into industrial EDA workflow.
At this time, only Verilog users have to install it for cosimulation. So that we can use
to_myhdl in our example.
Here, I assume that MyHDL has been installed by the steps in the previous post.
Installing Icarus Verilog
MyHDL supports several popular RTL simulators. At this time, Icarus Verilog, GHDL, cver, and ModelSim were supported. Here, Icarus Verilog will be used as an example.
Icarus Verilog is already in some Linux distributions. For example, in Ubuntu, type the following command to install Icarus Verilog:
For Windows users, Windows binaries might be useful.
VPI module provides an interface for Verilog to share data with MyHDL.
Compiling VPI module
In the source code of MyHDL, the
cosimulation folder contains several types of simulator that supported. In each subfolder, the README file describes how to install MyHDL support for these simulators.
For Icarus Verilog, go to
cosimulation/icarus, and then use command
make to compile the vpi module. Then, you will get
myhdl.vpi after compiling.
You can copy
myhdl.vpi to other places while needed.
Follow cosimulation chapter of the manual could also make sense, especially when you want to get a direct message of why the cosimulation does not work.
Please refer to corresponding manpages to get the meanings of options for
Notes on Windows Installation
The process of Windows installation is almost the same, but there are still some difference. Here are the notes that may help your installation.
After installing iverilog, remember to add the path of
iverilog-vpi.exeto the system path.
Before compiling VPI files, a MinGW implementation should be installed and added into system path.
When compiling VPI modules,
myhdl.cwill probably be overwritten and fail to compile. If this situation occurs, please replace
myhdl.cwith the original one, and then copy the
myhdl_table.cto the end of
myhdl.c, and then execute