Python as an HVL?
June 08, 2006
These days it seems Python is all the rage. I've been looking into ways to build dynamic web content using Plone - a Python-based Content Management System (CMS). Since Plone is written in Python I've been attempting to familiarize myself with the language. I've also been trying to understand what the point was of knowing yet another way to write "Hello World".
What first struck me about Python is the fact that it is much more straightforward to use it in an object oriented fashion than Perl. Plus, it's far easier to write interesting code in Python than in C++ (and without having to worry about memory management issues). It's also possible to combine Python and C++ using tools such as SWIG to create an objected oriented programming environment with the flexibility and ease of use of Python with the performance (where needed) of raw C/C++.
This means it should be feasible to create a verification environment in Python that works through the PLI directly, or better yet, wraps around SystemC to free system modelers and verification engineers of some of the pitfalls of working with the SystemC and SCV libraries (namely, that you'll frequently come across times where you need to know far more C++ than the creators of SystemC would have you believe was necessary).
Since Python is interpreted (actually, it gets compiled into bytecode the first time it's run), it would be much faster to build and run an environment including a system model, BFMs, monitors, and checkers than might otherwise be possible given the compile time requirements of some environments. Python could also be used to allow users to dynamically load tests, and would cut down on the number of memory leaks in testbenches written without taking full advantage of the shared_ptr<> template.
A quick Google search came up with a couple of interesting links of people who have done a bit of work mapping Python to the PLI interface:
- http://www.nelsim.com/scriptsim/python_man.html
- http://embedded.eecs.berkeley.edu/Alumni/pinhong/scriptEDA/ (hard to read due to a strange background image)
I'd be interested to hear if anyone has actually done any work with Python and SystemC, or otherwise used SWIG for a similar purpose.