From 4705feb9d849baff5e891cd5ed788d9a75b570b2 Mon Sep 17 00:00:00 2001 From: Kia <kia@special-circumstanc.es> Date: Mon, 27 Jan 2020 18:55:31 -0700 Subject: [PATCH] final results go up top --- combinatorial_LR_parser.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/combinatorial_LR_parser.py b/combinatorial_LR_parser.py index 09a09b2..0c3a816 100644 --- a/combinatorial_LR_parser.py +++ b/combinatorial_LR_parser.py @@ -304,22 +304,31 @@ class HitOrMiss(Elaboratable): one_hot = Signal(1) m.d.comb += one_hot.eq(0 == (stack_state_onehot & (stack_state_onehot - 1))) - with m.If(one_hot == 0): - m.d.comb += self.internal_fault.eq(1) + # we've identified which stack state description corresponds to the current state of the stack, # aka, which row of the LR table we are on. Now we will identify which outcome applies for the # combination of the current stack state and also the new item. + all_new_item_predicates = [] + all_shift_predicates = [] + + reduce_rule_bitmap = [] + + # Random-access (at synth time) bitmap without combinatorial loop issues + for i in range(self.reduction_rule_count): + bitmap_component = Signal(1) + reduce_rule_bitmap.append(bitmap_component) with m.If(one_hot == 1): # only do this if the signal is one-hot + validitem_result = Signal(1) + forceshift_result = Signal(1) for rule_idx in range(len(self.stack_state_descriptions)): with m.If(stack_state_onehot[rule_idx] == 1): validitem_rule = self.validitem_ruleset[rule_idx] forceshift_rule = self.forceshift_ruleset[rule_idx] reduce_rule = self.reduce_ruleset[rule_idx] - new_item_in_acceptset = Signal(1) new_item_predicates = [] @@ -344,15 +353,6 @@ class HitOrMiss(Elaboratable): shift_item_predicates.append(shift_item_predicate_status) m.d.comb += new_item_in_shiftset.eq(reduce(lambda x, y: x | y, shift_item_predicates)) - - reduce_selected = Signal(1) - reduce_rule_bitmap = [] - - # Random-access (at synth time) bitmap without combinatorial loop issues - for i in range(self.reduction_rule_count): - bitmap_component = Signal(1) - reduce_rule_bitmap.append(bitmap_component) - for candidate in reduce_rule: reduce_item_predicate_status = Signal(1) (newitem, reduce_rule_number) = candidate -- GitLab