PyHDI / veriloggen

Veriloggen: A Mixed-Paradigm Hardware Construction Framework
Apache License 2.0
306 stars 58 forks source link

iverilog libdir option #15

Closed sgherbst closed 6 years ago

sgherbst commented 6 years ago

Thanks for the great work on this module! I suggest adding support for the iverilog -y option (libdir, see http://iverilog.wikia.com/wiki/Iverilog_Flags). This makes it easy to run simulations with stub modules instantiated from existing Verilog libraries.

Here's how I implemented this modification veriloggen/simulation/simulation.py @ line 119

if libdirs:
   for libdir in libdirs:
      cmd.append('-y')
      cmd.append(libdir)

libdirs was then passed as an optional argument through run and run_iverilog.

shtaxxx commented 6 years ago

Thank you for your nice suggestion! I have implemented the proposed idea on the latest version. Please see the example code in "veriloggen/tests/simulation/simulator/libdir/simulation_simulator_libdir.py".