VCD Dumps Possible in PyMTL3?

59 views
Skip to first unread message

Sebastian

unread,
Nov 18, 2020, 10:25:33 PM11/18/20
to pymtl-users
Hello,

Still just kicking the tires on PyMTL3 (messing around with RegIncr stuff) (an example of the test I'm running is below the sign off)

Once simple thing I can't do is VCD dumps (i.e. the old --dump-vcd command line options is rejected).  Is that something that the public version of PyMTL3 doesn't do yet?

Thanks,
Sebastian

def test_small( ):
run_test_vector_sim( RegIncr(8), [
('in_ out*'),
[ 0x00, '?' ],
[ 0x03, 0x01 ],
[ 0x06, 0x04 ],
[ 0x00, 0x07 ],
], )

Peitian Pan

unread,
Nov 18, 2020, 10:45:05 PM11/18/20
to pymtl-users
Hi Sebastian,

Glad you are interested in exploring more about PyMTL3! And yes, the public version of PyMTL3 still supports generating VCD dumps, but there is some syntax change in order to do that. To enable dump-vcd, you need to pass cmdline_opts argument to run_test_vector_sim like this:

def test_small( cmdline_opts ):
  run_test_vector_sim( RegIncr(8), [
    ('in_ out*'),
    [0x00, '?'],
    [0x03, 0x01],
    [0x06, 0x04],
    [0x00, 0x07],
  ], cmdline_opts )

`cmdline_opts` is a pytest fixture provided by the pytest-pymtl3 plugin. It parses your command line options and generates a `cmdline_opts` dictionary that is recognized by most pymtl3 simulation helpers (e.g., run_test_vector_sim). Now if you rerun this test with `--dump-vcd`:

  % pytest regincr_test.py --dump-vcd

PyMTL3 should dump out the vcd file in your current working directory.

Sebastian

unread,
Nov 18, 2020, 11:01:26 PM11/18/20
to pymtl-users
Thanks Peitian!  Yes, it worked.  Funny I thought I had tried that after looking through test_helpers.py, but I guess not.

Quick side note: Do you by chance run --test-verilog on a Mac?  That's something I rarely used (even in PyMTL2)...running it now (on RegIncr again), I see an error reported (below sign off), but it seems that viable SystemVerilog is indeed generated in my build directory (just by inspection).  I'll have to take a deeper look just wondering if this general issue (i.e. some errors reported, but otherwise working SystemVerilog generated).

Thanks again,

Sebastian

E   pymtl3.passes.backends.verilog.errors.VerilogImportError: 
    Error trying to perform import on s:
    - Failed to compile Verilated model into a shared library:


Peitian Pan

unread,
Nov 18, 2020, 11:11:55 PM11/18/20
to pymtl-users
I have seen this before on an alpha version of PyMTL3 -- we saw really weird shared library issues and figured the solution would be to use "-fno-gnu-unique" option of gcc. Unfortunately clang-based gcc on Mac doesn't seem to support this option, and that's probably why PyMTL3 failed to compile a shared lib.

Apart from that option, Shunning (PyMTL3 lead developer) tried to optimize for shared library compile time which lead to more gcc options being used. Not sure if those options are compatible with clang-gcc though, so the best practice as of now is to run translation-import (--test-verilog) on a Linux platform.
Reply all
Reply to author
Forward
0 new messages