summaryrefslogtreecommitdiff
path: root/cpu_dsl.py
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2018-10-01 19:16:54 -0700
committerMichael Pavone <pavone@retrodev.com>2018-10-01 19:16:54 -0700
commit701c5fddc2d25d8d370995ac7fec6762b6aeaed4 (patch)
tree226e1803fd7d23542f23fffbb4980bbecac8151b /cpu_dsl.py
parent69f2e0fe14e4af99ddc56b6d7caee38e2150b33c (diff)
Clean up warnings from -1 case
Diffstat (limited to 'cpu_dsl.py')
-rwxr-xr-xcpu_dsl.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/cpu_dsl.py b/cpu_dsl.py
index e81f756..6c9d80d 100755
--- a/cpu_dsl.py
+++ b/cpu_dsl.py
@@ -489,8 +489,9 @@ class Switch(ChildBlock):
def addOp(self, op):
if op.op == 'case':
- self.cases[int(op.params[0])] = self.current_case = []
- self.case_locals[int(op.params[0])] = self.current_locals = {}
+ val = int(op.params[0], 16) if op.params[0].startswith('0x') else int(op.params[0])
+ self.cases[val] = self.current_case = []
+ self.case_locals[val] = self.current_locals = {}
elif op.op == 'default':
self.default = self.current_case = []
self.default_locals = self.current_locals = {}
@@ -543,7 +544,7 @@ class Switch(ChildBlock):
for case in self.cases:
self.current_locals = self.case_locals[case]
self.regValues = dict(self.parent.regValues)
- output.append('\n\tcase {0}: '.format(case) + '{')
+ output.append('\n\tcase {0}U: '.format(case) + '{')
for local in self.case_locals[case]:
output.append('\n\tuint{0}_t {1};'.format(self.case_locals[case][local], local))
for op in self.cases[case]: