Skip to content

Commit

Permalink
Merge pull request #6 from rsetaluri/upstream-circt
Browse files Browse the repository at this point in the history
Upstream CIRCT repo
  • Loading branch information
rsetaluri committed Nov 23, 2021
2 parents b6809e2 + 61c8923 commit 46a993f
Show file tree
Hide file tree
Showing 124 changed files with 9,567 additions and 11,787 deletions.
10 changes: 6 additions & 4 deletions src/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ def emit(self) -> str:
@dataclasses.dataclass
class ModuleOp(MlirOp):
def __post_init__(self):
self.regions.append(MlirRegion())
self.regions[0].blocks.append(MlirBlock())
self._block = self.regions[0].blocks[0]
self._block = self.new_region().new_block()

@property
def block(self) -> MlirBlock:
return self._block

def add_operation(self, operation: MlirOp):
self._block.operations.append(operation)
self._block.add_operation(operation)

def print_op(self, printer: PrinterBase):
printer.print("module")
Expand Down
5 changes: 1 addition & 4 deletions src/comb.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@ def print_op(self, printer: PrinterBase):
print_names(self.results, printer)
printer.print(f" = comb.concat ")
print_names(self.operands, printer)
printer.print(" : (")
printer.print(" : ")
print_types(self.operands, printer)
printer.print(") -> (")
print_types(self.results, printer)
printer.print(")")


@dataclasses.dataclass
Expand Down
8 changes: 6 additions & 2 deletions src/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def make_unique_name() -> str:
return name


def default_list_field(**kwargs):
return dataclasses.field(default_factory=list, **kwargs)
def default_field(cons, **kwargs):
return dataclasses.field(default_factory=cons, **kwargs)


@dataclasses.dataclass
Expand All @@ -61,3 +61,7 @@ def replace_all(s: str, replacements: Dict[str, str]) -> str:
for old, new in replacements.items():
s = s.replace(old, new)
return s


def constant(value: Any):
return lambda: value
Loading

0 comments on commit 46a993f

Please sign in to comment.