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

@@ -10,7 +10,10 @@ class AlwaysWrite(NextStateConditional):
"""
hw writable, without any qualifying we/wel
"""
is_unconditional = True
comment = "HW Write"
def is_match(self, field: 'FieldNode') -> bool:
return (
field.is_hw_writable
@@ -18,10 +21,6 @@ class AlwaysWrite(NextStateConditional):
and not field.get_property('wel')
)
def get_predicate(self, field: 'FieldNode') -> str:
# TODO: make exporter promote this to an "else"?
return "1"
def get_assignments(self, field: 'FieldNode') -> List[str]:
hwmask = field.get_property('hwmask')
hwenable = field.get_property('hwenable')
@@ -42,6 +41,7 @@ class AlwaysWrite(NextStateConditional):
]
class WEWrite(AlwaysWrite):
is_unconditional = False
comment = "HW Write - we"
def is_match(self, field: 'FieldNode') -> bool:
return (
@@ -59,6 +59,7 @@ class WEWrite(AlwaysWrite):
return identifier
class WELWrite(AlwaysWrite):
is_unconditional = False
comment = "HW Write - wel"
def is_match(self, field: 'FieldNode') -> bool:
return (