Re: co-simuation

Christopher Felton <[email protected]>
Newsgroups gmane.comp.python.myhdl
Message-ID <[email protected]>
On 8/31/2015 12:25 PM, Edward Vidal wrote:
> Hello All,
> I am testing VHD2VL and trying to test the outputted file ifchain.v with MyHDL & Iverilog
> co-simulation on a Raspberry Pi 2 B.
>
> I created the files and folder vcd
> https://github.com/develone/raspberrypi2_yocto/tree/master/vhd2vl/examples/tb
>
> ifchain  myhdl.vpi  tb_ifchain.v  test_ifchain.py  vcd
>
<snip>
> If in stimlus section of test_ifchain.py.
> I comment the lines 25 & 26 I get the results below.
>
>      python test_ifchain.py
>      Running test...
>       0
>        *{'a': Signal(intbv(0L)), 'status': Signal(False), 'b': Signal(intbv(0L)),
>      compiling ...
>        iverilog -o ifchain ../ifchain.v ./tb_ifchain.v
>      cosimulation setup ...
>        vvp -m ./myhdl.vpi ifchain
>      VCD info: dumpfile vcd/ifchain1.vcd opened for output.
>        <myhdl._Cosimulation.Cosimulation object at 0x769f6870>
>      back from prep cosim
>      start (co)simulation ...
>
> This appears to work okay but when I gtkwave vcd/ifchain1.vcd
> The signals a,b and clk red and status is yellow.
>
> When the I uncomment lines 25 & 26 try send values to the co-simulation.
> The program does not run to completion but crashes with the following error.
>    File "/usr/lib/python2.7/site-packages/myhdl-1.0dev-py2.7.egg/myhdl/_Waiter.py", line 142, in next
>      clause = next(self.generator)
>    File "test_ifchain.py", line 25, in stimlus
>      a.next = 10
>

This actually is not a cosimulation error.  I ran your
code and the resulting error is:

     ValueError: intbv value 10 >= maximum 8

In your code your `a` and `b` are:

     a = Signal(intbv(0)[3:])
     b = Signal(intbv(0)[3:])

Now remember, in Python the upper limit is exclusive,
you created 3bit bit-vectors.  The max value that can
be used is 7.  You probably intended it to be:

     a = Signal(intbv(0)[4:])
     b = Signal(intbv(0)[4:])

When I make the changes, you code executes without
error.

Regards,
Chris


------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.