Clean up ugly unconditional 'if(1)' conditionals in field logic. #50

This commit is contained in:
Alex Mykyta
2023-07-19 20:49:38 -07:00
parent da8ff4aaeb
commit 211224116e
6 changed files with 38 additions and 18 deletions

View File

@@ -137,6 +137,7 @@ class PosedgeNonsticky(NextStateConditional):
"""
Positive edge non-stickybit
"""
is_unconditional = True
comment = "posedge nonsticky"
def is_match(self, field: 'FieldNode') -> bool:
return (
@@ -145,9 +146,6 @@ class PosedgeNonsticky(NextStateConditional):
and field.get_property('intr type') == InterruptType.posedge
)
def get_predicate(self, field: 'FieldNode') -> str:
return "1"
def get_assignments(self, field: 'FieldNode') -> List[str]:
I = self.exp.hwif.get_input_identifier(field)
Iq = self.exp.field_logic.get_next_q_identifier(field)
@@ -160,6 +158,7 @@ class NegedgeNonsticky(NextStateConditional):
"""
Negative edge non-stickybit
"""
is_unconditional = True
comment = "negedge nonsticky"
def is_match(self, field: 'FieldNode') -> bool:
return (
@@ -168,9 +167,6 @@ class NegedgeNonsticky(NextStateConditional):
and field.get_property('intr type') == InterruptType.negedge
)
def get_predicate(self, field: 'FieldNode') -> str:
return "1"
def get_assignments(self, field: 'FieldNode') -> List[str]:
I = self.exp.hwif.get_input_identifier(field)
Iq = self.exp.field_logic.get_next_q_identifier(field)
@@ -183,6 +179,7 @@ class BothedgeNonsticky(NextStateConditional):
"""
edge-sensitive non-stickybit
"""
is_unconditional = True
comment = "bothedge nonsticky"
def is_match(self, field: 'FieldNode') -> bool:
return (
@@ -191,9 +188,6 @@ class BothedgeNonsticky(NextStateConditional):
and field.get_property('intr type') == InterruptType.bothedge
)
def get_predicate(self, field: 'FieldNode') -> str:
return "1"
def get_assignments(self, field: 'FieldNode') -> List[str]:
I = self.exp.hwif.get_input_identifier(field)
Iq = self.exp.field_logic.get_next_q_identifier(field)