ASIC/FPGA Design and Verification Out Source Services
A simple c-code program to read a memory array from verilog RTL, using
VPI.
-
The former
page
discussed the simple verilog file, which served as the example's DUT. Then I
explained the
c code.
This page presents the script, which used to compile and run this simple
test.
-
The script is generic and it assumes that both verilog and c code use the very
same name. If any step in the script compilation (c, verilog, simulation)
fails, the script stops.
-
I used the free verilog simulator, icarus. It has a special command to
compile the c-code vpi, iverilog-vpi, which makes life easier:
clear;./cmp.unx itr | tee 1.txt
#!/bin/bash
rm $1.vvp *.vcd
iverilog-vpi $1.c || exit
iverilog -o$1.vvp $1.v || exit
vvp -M. -m$1 $1.vvp || exit
-
The code can be downloaded
from:
|