Get email delivery of the Cadence blog featured here
Do you know from where Python technology gets its name? It is not from the snake, it is named after the Monty Python comedy group. And indeed, one of the main guidelines behind it is to be fun to use (check out the Zen of Python). Therefore, Python is intuitive, readable, and easy to learn - all of these make it not only fun to use but also highly productive. Does this sound familiar? If you are an e user, it should. Apparently, e and Python share many common characteristics.
Why supporting Python?
Specman has already interfaces with C and SystemVerilog DPI. However, if you want to extract data during Specman’s runs, analyze it for either debugging or machine learning modules- Python might be the right language since there are many open source libraries for graphs, mathematical calculations, machine learning, etc.
Can I connect to Python with old Specman?
Yes, you can. Both Specman and Python have interface to C. Therefore, you can write a C glue code to bridge the two. However, this is not trivial, and it means you need to get familiar with Python Interpreter. Since e like Python is mainly about usability and productivity - having an easy way to connect e code to Python code seems almost a MUST.
What are we adding in 19.05?
In 19.05, all C glue code is generated behind the scenes by Specman during the run. In your e code, you just need to specify that the methods you are calling should be invoked from external Python module (a Python module is a file containing Python definitions and statements).
What is the syntax?
To define a method that is imported from Python, you need do two things:
Let’s look at the following simple example:
In this example, every call to setVal calls the Python setVal method defined in pyModuleEx.py:
Do I need to add any configuration?
Can I pass a struct from e to Python?
Yes, you can pass a struct from e to Python as shown in the following example:
Are there limitations?
In 19.05, only Python 2 is supported and exporting e methods (calling e methods from Python) is not supported yet. These limitations will be removed in future versions.
There are many things you can do now that you have an easy way to export data during the run to improve your verification environment. It might be a call for you to think of using Machine Learning knowledge to make your verification a state of the art. We will publish few examples soon, stay tuned!
We fully recommend to stay up to date for more examples and updates by joining the Specman Users Groups in Linkedin or Team Specman in Facebook.