Re: [myhdl-list] difficulty using itertools with MyHDL
Brought to you by:
jandecaluwe
From: George P. <ge...@ga...> - 2006-10-20 17:43:57
|
On Fri, October 20, 2006 10:51 am, Jan Decaluwe wrote: > George Pantazopoulos wrote: > >> Sorry for the confusion earlier. Does this help you understand what I >> want to accomplish? This is already working for me, except that I have >> to redefine izip() and ichain() myself. Perhaps you know of a better w= ay >> to do this? > > George: > > Yes, I understand now. I think this qualifies as Truly Advanced Usage := -) Thanks ;-) A real need arose as I was unit testing my ring buffer, and this was my creative answer to it. Good stuff happens when you're having fun (er, well not always) ;-) > > I understand why you want to use itertools - not for performance, > but as a clear and concise way to manipulate iterators. > Exactly! > So at this point I would look for a workaround and convert > iterator objects to the "officially" supported types > (for behavior or structure) as desired. The advantage is > of course that no change to MyHDL would be required. > > A workaround for your case could be the following. Just use > itertools to set up your iterator as desired. Then convert > it to a generator using a one-liner generator expression, e.g.: > > ordered_tests =3D (t for t in chain(stage1, stage2, stopsim())) > > This should work for any iterator you can imagine. > That sonds like an excellent solution. Thanks! George http://www.gammaburst.net |