dan-fritchman / Hdl21

Hardware Description Library
BSD 3-Clause "New" or "Revised" License
56 stars 10 forks source link

Nested Generator Naming #207

Open dan-fritchman opened 8 months ago

dan-fritchman commented 8 months ago

Example:

@h.paramclass 
class InnerParams:
  n = h.Param(dtype=int)
  bazillions_of_other_complicated_params = ... 

@h.generator
def Inner(p: InnerParams) -> h.Module:
  ...

@h.paramclass 
class OuterParams:
  n = h.Param(dtype=int)
  # that's it, just the one 

@h.generator
def Outer(p: OuterParams) -> h.Module:
  return Inner(n=p.n, **some_source_of_those_other_params())

Running this down:

What is, and what should be, the name of that module?
Currently, assuming Inner's "bazillions of complicated params" get hashed in naming, it's something like:
Inner_{HASH_VALUE}_n_{OUTER_N_VALUE}

I.e. the "suffix naming" gets added by both the calls to Inner and Outer.
That may not be ideal, especially in the cases where