Skip to content

Commit

Permalink
[Python] Reword CompRegLike helper for clarity, NFC.
Browse files Browse the repository at this point in the history
This was migrated to a helper class with a static method rather than a
base class in 812cbe9. But the method naming accepting a `self`
parameter is confusing, and a `@staticmethod` annotation would also be
appropriate. This adds the annotations and renames `self` to `op` for
clarity.
  • Loading branch information
mikeurbach committed Dec 20, 2024
1 parent acd9ae2 commit c5f2875
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/Bindings/Python/dialects/seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def create_initial_value(self, index, data_type, arg_name):

class CompRegLike:

def init(self,
@staticmethod
def init(op,
data_type,
input,
clk,
Expand All @@ -74,10 +75,10 @@ def init(self,
attributes = {}
results.append(data_type)
operand_segment_sizes = [1, 1]
if isinstance(self, CompRegOp):
if isinstance(op, CompRegOp):
if clockEnable is not None:
raise Exception("Clock enable not supported on compreg")
elif isinstance(self, CompRegClockEnabledOp):
elif isinstance(op, CompRegClockEnabledOp):
if clockEnable is None:
raise Exception("Clock enable required on compreg.ce")
operands.append(clockEnable)
Expand Down Expand Up @@ -120,11 +121,11 @@ def init(self,
if sym_name is not None:
attributes["inner_sym"] = hw.InnerSymAttr.get(StringAttr.get(sym_name))

self._ODS_OPERAND_SEGMENTS = operand_segment_sizes
op._ODS_OPERAND_SEGMENTS = operand_segment_sizes

OpView.__init__(
self,
self.build_generic(
op,
op.build_generic(
attributes=attributes,
results=results,
operands=operands,
Expand Down

0 comments on commit c5f2875

Please sign in to comment.