From 701c5fddc2d25d8d370995ac7fec6762b6aeaed4 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Mon, 1 Oct 2018 19:16:54 -0700 Subject: Clean up warnings from -1 case --- cpu_dsl.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cpu_dsl.py') 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]: -- cgit v1.2.3