Skip to content

Commit

Permalink
eDSL: no cells list when defining new component (#2038)
Browse files Browse the repository at this point in the history
* Neaten mul_group

* Neaten another helper

* A little more neatening

* Less use of Cell

* Reduce manual imports

* Catch up to main

* Stray doctring issue

* No cells when defining component

* More thoroughly remove the power to init a component with list of cells
  • Loading branch information
anshumanmohan authored May 15, 2024
1 parent 16f7c3f commit 1be68ce
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions calyx-py/calyx/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ def __init__(self):
self.import_("primitives/core.futil")
self._index: Dict[str, ComponentBuilder] = {}

def component(self, name: str, cells=None, latency=None) -> ComponentBuilder:
def component(self, name: str, latency=None) -> ComponentBuilder:
"""Create a new component builder."""
cells = cells or []
comp_builder = ComponentBuilder(self, name, cells, latency)
comp_builder = ComponentBuilder(self, name, latency)
self.program.components.append(comp_builder.component)
self._index[name] = comp_builder
return comp_builder
Expand Down Expand Up @@ -67,25 +66,20 @@ def __init__(
self,
prog: Builder,
name: str,
cells: Optional[List[ast.Cell]] = None,
latency: Optional[int] = None,
):
"""Contructs a new component in the current program. If `cells` is
provided, the component will be initialized with those cells."""
cells = cells if cells else list()
"""Contructs a new component in the current program."""
self.prog = prog
self.component: ast.Component = ast.Component(
name,
attributes=[],
inputs=[],
outputs=[],
structs=cells,
structs=list(),
controls=ast.Empty(),
latency=latency,
)
self.index: Dict[str, Union[GroupBuilder, CellBuilder]] = {}
for cell in cells:
self.index[cell.id.name] = CellBuilder(cell)
self.continuous = GroupBuilder(None, self)
self.next_gen_idx = 0

Expand Down

0 comments on commit 1be68ce

Please sign in to comment.