Re: [myhdl-list] my myHDL Unit test framework so far. please critique
Brought to you by:
jandecaluwe
From: <dan...@we...> - 2005-12-16 15:01:25
|
George Pantazopoulos wrote: > How do you automate it so the same file performs steps 1 and 2 in the > same run? Currently I have a unit test file that takes command-line > arguments. If I run "python module_ut.py -v" it does a myHDL-only > unittest. If I add the -cosim option, as in "python module_ut.py -v > -cosim" then it does a unit test w/cosimulation. So I need two seperate > runs w/different arguments. I use a Makefile to have it automatically > run steps 1 and 2 in sequence (as well as step #3). I'm interested in > eliminating the need for a pesky Makefile :) Let unittest do the job for you. What you can do is have different test cases that perform what your makefile is doing. A split might be here appropriate. So you have, I call it testbench code, that performs the test with your logic. In the first step this is the myhdl logic. This code will be the same whether you test myhdl for now or the verilog generated code later. Put this testbench code in a test case and run it. If that works, add a second unittest test case. This one will generate the verilog code and then run your testbench code again, this time with cosimulation. Here comes the beauty of myhdl, as you have one testbench that tests both myhdl and verilog code. To run the test, you just call your unittest file. If the project becomes more complex you can group them. At the end you only have one file that you call which will run all the tests. Have a look at the examples that come along with myhdl. I believe you just ran some to test you cosimulation. They show this grouping of test cases very nice. You can call them individual or all together, just depends on which file you start. Guenter |