edaplayground / eda-playground

EDA Playground -- The FREE IDE for SystemVerilog, Verilog, and VHDL
http://www.edaplayground.com
48 stars 17 forks source link

Support for cocotb #5

Closed chiggs closed 11 years ago

chiggs commented 11 years ago

Feature request: Cocotb support.

Cocotb is an open-source Python verification framework (see the documentation). Cocotb support any VPI compliant simulator including Icarus and would therefore work well on the public version of eda-playground.

It could work something like this:

Select cocotb somewhere in the configuration section. This would turn the left text-box into a python script rather than verilog. The right hand side stays the same.

Under the hood this should be relatively straightforward - executing cocotb is very similar to executing any simulator, it's just a case of passing in a few extra arguments. I'd be happy to help get this running.

Minimum requirements (on top of Icarus) are Python 2.6 and the python-dev packages. Are you sandboxing in a VM?

getvictor commented 11 years ago

That sounds like a great idea. I will look into it this week.

I'm using a Linux container (Docker) to run the sims, which is like a VM.

getvictor commented 11 years ago

The EDA Playground stdout/stderr results currently do not support colors. Is there a way to turn off color output for cocotb, like an environment variable? Currently I'm just piping the results through

sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"

I will add color support once I have the mono version working.

chiggs commented 11 years ago

Setting the environment variable COCOTB_ANSI_OUTPUT=0 will override the default behaviour of annotating output with ANSI if the output is a terminal.

getvictor commented 11 years ago

@chiggs Setting COCOTB_ANSI_OUTPUT=0 doesn't seem to be working for me. I'm using cocotb 0.2

This is not a big deal. I can just use sed for now.

getvictor commented 11 years ago

Another question. What is the output that I should be seeing from examples/demo? I'm seeing the following, but example_test is failing with TestError, which doesn't seem right. This is with Icarus Verilog 0.9.6, cocotb-0.2, Ubuntu 13.04

     0.00ns INFO     cocotb.gpi                                  gpi_embed.c:188  in embed_sim_init                  Python interpreter initialised and cocotb loaded!
     0.00ns INFO     cocotb.gpi                                  __init__.py:89   in _initialise_testbench           Seeding Python random module with 1376917280
{}
     0.00ns INFO     cocotb.regression.0x29d6bd0               regression.py:102  in initialise                      Found test demo.example_test
     0.00ns INFO     cocotb.regression.0x29d6bd0               regression.py:102  in initialise                      Found test demo.example_test2
     0.00ns INFO     cocotb.regression.0x29d6bd0               regression.py:164  in execute                         Running test 1/2: example_test
     0.00ns INFO     cocotb.coroutine.example_test.0x2..       decorators.py:166  in send                            Starting test: "example_test"
                                                                                                                     Description: This is an example test
     0.00ns INFO     cocotb.first_counter.0x29d69d0                  demo.py:76   in example_test                    Example test got DUT:first_counter @0x28afd80
     0.00ns INFO     cocotb.gpi                                  gpi_embed.c:205  in embed_sim_init                  _initialise_testbench successful
VCD info: dumpfile dump.vcd opened for output.
    10.00ns INFO     cocotb.first_counter.0x29d69d0                  demo.py:85   in example_test                    first_counter.clock @0x2965f90
    10.00ns WARNING  cocotb.scheduler                           scheduler.py:252  in schedule                        Coroutine completed execution with TestError: reset_dut
    10.00ns WARNING  cocotb.regression.0x29d6bd0               regression.py:152  in handle_result                   Test Failed: example_test (result was TestError)
    10.00ns INFO     cocotb.regression.0x29d6bd0               regression.py:164  in execute                         Running test 2/2: example_test2
    10.00ns INFO     cocotb.coroutine.example_test2.0x..       decorators.py:166  in send                            Starting test: "example_test2"
                                                                                                                     Description: This is another example test
  1010.00ns WARNING  cocotb.first_counter.0x29d69d0                  demo.py:111  in example_test2                   test complete!
  1010.00ns WARNING  cocotb.scheduler                           scheduler.py:252  in schedule                        Coroutine completed execution with TestSuccess: example_test2
  1010.00ns INFO     cocotb.regression.0x29d6bd0               regression.py:137  in handle_result                   Test Passed: example_test2
  1010.00ns INFO     cocotb.regression.0x29d6bd0               regression.py:117  in tear_down                       Shutting down...

When running with Icarus Verilog 0.10.0 (a recent trunk), there are a few more error messages, but result is the same:

0.00ns INFO cocotb.gpi gpi_embed.c:188 in embed_sim_init Python interpreter initialised and cocotb loaded!
0.00ns INFO cocotb.gpi __init__.py:89 in _initialise_testbench Seeding Python random module with 1376918130
{}
0.00ns INFO cocotb.regression.0x7f234a4c4510 regression.py:102 in initialise Found test testbench.example_test
0.00ns INFO cocotb.regression.0x7f234a4c4510 regression.py:102 in initialise Found test testbench.example_test2
0.00ns INFO cocotb.regression.0x7f234a4c4510 regression.py:164 in execute Running test 1/2: example_test
0.00ns INFO cocotb.coroutine.example_test.0x7.. decorators.py:166 in send Starting test: "example_test"
Description: This is an example test
0.00ns INFO cocotb.first_counter.0x7f234a4c4310 testbench.py:76 in example_test Example test got DUT:first_counter @0x1f83f10
0.00ns INFO cocotb.gpi gpi_embed.c:205 in embed_sim_init _initialise_testbench successful
VCD info: dumpfile dump.vcd opened for output.
10.00ns CRITICAL cocotb.gpi gpi_vpi.c:399 in gpi_copy_name VPI: NULL came back from VPI

10.00ns CRITICAL cocotb.gpi gpi_vpi.c:399 in gpi_copy_name VPI: NULL came back from VPI

10.00ns CRITICAL cocotb.gpi gpi_vpi.c:399 in gpi_copy_name VPI: NULL came back from VPI

10.00ns CRITICAL cocotb.gpi gpi_vpi.c:399 in gpi_copy_name VPI: NULL came back from VPI

10.00ns INFO cocotb.first_counter.0x7f234a4c4310 testbench.py:85 in example_test NUL @0x201df40
10.00ns WARNING cocotb.scheduler scheduler.py:252 in schedule Coroutine completed execution with TestError: reset_dut
vpi error: cannot put a value with a delay on automatically allocated variable 'clock'
vpi error: cannot put a value with a delay on automatically allocated variable 'reset'
vpi error: cannot put a value with a delay on automatically allocated variable 'enable'
10.00ns WARNING cocotb.regression.0x7f234a4c4510 regression.py:152 in handle_result Test Failed: example_test (result was TestError)
10.00ns INFO cocotb.regression.0x7f234a4c4510 regression.py:164 in execute Running test 2/2: example_test2
10.00ns INFO cocotb.coroutine.example_test2.0x.. decorators.py:166 in send Starting test: "example_test2"
Description: This is another example test
1010.00ns WARNING cocotb.first_counter.0x7f234a4c4310 testbench.py:111 in example_test2 test complete!
1010.00ns WARNING cocotb.scheduler scheduler.py:252 in schedule Coroutine completed execution with TestSuccess: example_test2
1010.00ns INFO cocotb.regression.0x7f234a4c4510 regression.py:137 in handle_result Test Passed: example_test2
1010.00ns INFO cocotb.regression.0x7f234a4c4510 regression.py:117 in tear_down Shutting down...
chiggs commented 11 years ago

We need to do another release, COCOTB_ANSI_OUTPUT was put in after 0.2

We don't currently work on Icarus 0.10.0 since it won't allow us to put VPI values. We're looking into this but it's a low priority currently since most distributions are on 0.9.x

I'm afraid the "demo" does indeed fail, I've been meaning to write a more meaningful demo example.

Can you try running the tests in examples/functionality/tests? One of these tests will fail on Icarus (test_discovery.access_single_bit) since Icarus doesn't permit access to individual bits of vectors.

getvictor commented 11 years ago

Yes, examples/functionality/tests work as expected.

When do you think you'll do another release? I shooting to have at least a demo of EDA Playground with cocotb-0.2 by Monday.

chiggs commented 11 years ago

I've raised an issue to track sorting out the examples (see potentialventures/cocotb#77) and have removed old code.

We'll try and release 0.3 of cocotb this week.

getvictor commented 11 years ago

@chiggs can you send me your email to "victor at victoreda.com" so I can send you a link to the demo deployment?

chiggs commented 11 years ago

@getvictor sent.

getvictor commented 11 years ago

cocotb 0.2 is now up on http://www.edaplayground.com along with an example