Re: please help with best way how to construct unittest testbench
Marcel Hellwig <[email protected]> Fri, 29 Jan 2016 16:31:12 +0100
| Newsgroups | gmane.comp.python.myhdl |
|---|---|
| Message-ID | <[email protected]> |
On 29.01.2016 16:05, David Belohrad wrote: > Dear all, > > my question is simple: when using unittest/testcase, one can write more testbenches. I have wrote one, like the one below. As you can see, the 'testbench' is quite long, as one has to initialize all the signals, instantiate the DUT, provide reset and clock, and it does nothing (yet). > > I want to add a second test-bench, but I'd like to re-use the fraction of instantiation and initialization of the DUT. This is quite a work (not for this design, but for more complex designs). So far I have seen only testbenches, which were implementing each test case as a separate test function, which contained each time copy of signal assignments and instantiation of DUT. Is there any way, how to write a second test bench, and re-use the instances and signal assignments aready done? In fact, it would be great if I could just instantiate it once, assign signals, and then in the test functions just by driving the signals and compare with expected *without re-starting the simulation*. > > Any hint appreciated. I had the same issue this week and decided to make up my mind and try some things out. I decided to use decoraters to wrap the tests to instantiate the clock etc. https://gist.github.com/punkkeks/9594800803bff9c57853 You have to use the _@myhdltest_ decoratetor to use this. In the setup method you have to instantiate all your signals (for an example, just see the gist). To trace a testcase you can use one of the three methods: 1. @trace decorator 2. self.trace = True in the setUp method 3. --trace as commandline argument If you have any improvements, let me know ;) Regards Marcel ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 _______________________________________________ myhdl-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/myhdl-list
signature.asc
(application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCgAGBQJWq4XHAAoJEIROXYQnkAHp4HsP/1qht47sjCplAEn8MfYQezWL m78DNc5xetvW3fIExGbuowWcZIjucyF8t2e7ags6j7nHIwEvMIKl2Ak5lRwI1O2L Vnyc3dczM36VOvrjuAIBG5llPT7sy8vEo644JdgAnMdh82x1O2q7PdIERFq3azlh LZUitNCew/tIeyjSBEH8wunrFxRgeZBYyXCckcuuoIsP0RVEG/IY0a4n6cGvN7ih 1BX7pM0OBOw+BGJKlBRTOMiVzUJdISmAEmMJMb9627ugnMwpRSbOr7bzD3BRPgRl 9UduKSni2hQENVogYNMG4388PxcFUcYlWlfBcyFR2XUGSfMSm1ni1/wLHgI9y559 RnG5EQHYAvi2JSuFYFDzH9IjVHfjZZoIyQDCxOpsG/BMZ27+txLeil97ic1WiFuk iBqK6nydS2GDYFuSsKrNVon0FAzg4BHkgN+07Jp/A0jMeyk4wGuMVoJ1S2cUl8et 8/aUTLHHFp82MCXCArGYd3GzrJNAnQHlYoRopcRCGAdwOxkMmGyDGw4Dhk3TtYMD f2Mgp8yNaLx6XpSeVfdJUILHPqUUT0geR3kvJ0oP6ldyk0Xra/i7igqT8v0nF2gq eiDJYH9dOaysuppf79wBSNiHLL4GhK6jPrfuZGr6+r7Di3zoRdWssDJQLTngLB3h VpVY1WL2YNxjM9YUCz3S =VS5j -----END PGP SIGNATURE-----