Re: [myhdl-list] MyHDL code clean-up - please review
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2008-09-15 11:52:30
|
I have just pushed the latest changes that implement everything as described below. Every leaf block in the structure should now use a decorator, if you want to do things like tracing signals and conversion. This introduces a small backwards incompatibility (probably mostly for my own older unit tests) but simplifies the implementation tremendously. Code using decorators is also clearer as to its purpose. If you see a problem (e.g. "no instances found") with older code, the workaround should be easy: use a @instance decorator. Regards, Jan Jan Decaluwe wrote: > I think the introduction of decorators in MyHDL 0.5 has been > a success, and by now everybody uses them. > > For pure modelling, you can construct generators in any way, > including directly without decorators, and that will always > remain so. > > However, some more implementation-oriented features, such > as hierarchy extraction, signal tracing and conversion also > contain support for non-decorator generators. This complicates > the code considerably, and in my opinion, unnecessarily. > Before adding new features, I would like to remove this > support to simplify the code. > > Again, if you use decorators, everything should continue to > work as before. Below I will describe the proposed changes > in detail. Please review and give feedback about any objection. > > * remove 'processes' function > This (undocumented) function is obsolete if you use decorators. It > was deprecated in 0.5. > > * change 'instances' function to only return generators from decorators > Currently 'instances' returns any kind of generator. Sometimes people > may want to use a generator for other purposes than hardware description: > currently you can't use 'instances' in that case. By only returning > generators from decorators, this would become possible. > > * remove support for "top-level" generators > > Consider the degenerated case where the top-level is a generator: > > def top(): > <generator_body> > > Hierarchy extraction, signal tracing and conversion have some special > support for this, which I would like to remove. Note that the > above is equivalent to: > > def top(): > @instance > def logic(): > <generator_body> > return logic > > * in general, assume that for hierarchy extraction, signal tracing > and conversion, only generators from decorators need to be considered. > There may be some more places in the code where this assumption can help > to simplify things. > > > Jan > -- Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com Kaboutermansstraat 97, B-3000 Leuven, Belgium From Python to silicon: http://myhdl.jandecaluwe.com |