question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

python control file/function (instead of Makefile)

See original GitHub issue

What would be your opinion to have python control file for the cocotb instead of makefile.

Initially one can start with simple a wrapper for Makefile. A module that will generate a local Makefile based on python code and execute it (subprocess). This should be backward compatible. Later can recede makefiles to just compile liberalises and run simulator directly form python.

Could look something like this at the end of test file:

from cocotb.runcontrol import Run

def test_run():
    Run(
        sources = ['../hdl/dff.v'],
        top_level = 'dff',
        incdir = ['../hdl'],
        defines=['TEST=1'],
    )

if __name__ == "__main__":
    test_run()

This could automatic discoverable by pytest. If we get #517 we could run in parallel.

It needs bit of thinking and trying but would like to know your opinion. Somehow related to #437, #508, #667 In case of positive feedback can make a working demo.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
imphilcommented, Nov 16, 2018

I’ve done something going into this direction with cocotb-testrunner (https://github.com/imphil/cocotb-testrunner). It works like this:

We use this testrunner extensively internally, and in Open SoC Debug and in OpTiMSoC. Unfortunately, none of the test runs are publicly available in CI since we mostly use Synopsys VCS.

2reactions
themperekcommented, Nov 16, 2018

I think both works, it’s more a matter of taste. In the end I don’t think it highly matters.

Actually one should be able to do something like this:

from cocotb.runcontrol import Run

def test_run(): 
    Run(**yaml.load('manifest.yaml'))

if __name__ == "__main__":
    test_run()
Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a Python Makefile - Earthly Blog
It is a tool which controls the generation of executable and other non-source files from a program's source file. It can automate the...
Read more >
Python Tutorial - File and Text Processing
If you just want to read or write a file, use built-in function open() . If you just want to manipulate paths (files,...
Read more >
How to Write a Makefile - Automating Python Setup ...
Makefile uses the make utility, and if we're to be completely accurate, Makefile is just a file that houses the code that the...
Read more >
How do I create a file at a specific path? - python
The file path "c:\Test\blah" will have a tab character for the `\T'. You need to use either: "C:\\Test". or r"C:\Test".
Read more >
3. Configure Python — Python 3.11.1 documentation
Compile the Python main() function and link Python executable with C++ ... Build the _decimal extension module using a thread-local context rather than...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found