Re: [myhdl-list] difficulty using itertools with MyHDL
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2006-10-20 08:13:53
|
George Pantazopoulos wrote: > Hi Jan, > > I'm having difficulty using itertools objects in MyHDL simulations. > > It seems this is the case because, from some crazy reason, the Python > itertools objects are *not* of type GeneratorType! In fact, it looks > like each one is its own type! (eg itertools.izip, itertools.chain). > > This causes myhdl._Simulation._checkArgs to raise an "Inappropriate > Argument Type" SimulationError. > > I'd really like to be able to use itertools.izip() and > itertools.chain() at least. What could be done about the situation? Is > there anyway to "coerce" the iterools into GeneratorTypes? George: You have hinted at this before, but until you post a concrete, simple example, I think I'm not going to get it. What are you trying to achieve? Coercing an iterable into a generator would mean that you use it to describe MyHDL behavior. I just don't see how that works. If on the other hand, it's used to describe structure (like lists, tuples or sets of generators), then you certainly don't want to turn it into a generator. Look into _util._flatten - you want to add the itertools types you want to use to the list of other "structural" iterators. But then still - why? I understand that itertools objects are useful when dealing with a very large number of elements. I just don't see how we can get at that point in structural MyHDL - moreover, it only affects the elaboration phase, not the simulation. What's the problem with using standard list operations? Jan -- Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com Losbergenlaan 16, B-3010 Leuven, Belgium From Python to silicon: http://myhdl.jandecaluwe.com |