From e2fc3ed0717bf3b3cc7ee04106007f253e9dbccc Mon Sep 17 00:00:00 2001 From: Kia <kia@special-circumstanc.es> Date: Sat, 14 Dec 2019 14:49:16 -0700 Subject: [PATCH] begin correction of the critical bug --- stack.py | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/stack.py b/stack.py index 9582853..b489178 100644 --- a/stack.py +++ b/stack.py @@ -115,11 +115,33 @@ class InspectableStack(Elaboratable): -# this subcomponent is NOT pipelined. It is fully combinatorial: -# every clock cycle, it ingests the entire stack and reports all -# the matches before the next clock cycle. +# Hit Or Miss is the current rule lookup engine. # -# Further work should be dedicated towards exploring the design space +# It is fully combinatorial; every cycle it ingests the current state +# of the stack and the new item, and determines: +# +# 1. Fast Reject: Whether the new item can be immediately rejected. +# This corresponds to a blank space in an LR parser table +# +# 2. Force Shift: Whether the new item must be shifted onto the stack +# *without* looking at possible reduction rules to apply to the current +# state of the stack. +# +# 3. Reduce Select: Which reduction rule applies to the current stack, and +# if multiple rules apply, which rule to select. +# +# Note that this list is in decreasing priority -- if Fast Reject triggers +# the results of Force Shift or Reduce Select are immaterial. Similarly, if +# Force Shift triggers, we must ignore the results of Reduce Select. +# +# Fast Reject allows to, well, immediately reject invalid data and avoid +# getting the stack in an invalid state. Force Shift allows the resolving of +# Shift/Reduce conflicts -- otherwise, the parser would immediately reduce +# everything it sees, as far as possible. Reduce Select resolves Reduce/Reduce +# conflicts. + + +# Further work will be dedicated towards exploring the design space # to see whether LUT usage / timing can be optimized by splitting the # lookup over several clock cycles -- since we can preselect the subset # of relevant-to-our-interest rules based on what is *already* on the stack @@ -179,6 +201,8 @@ class HitOrMiss(Elaboratable): self.item_width = item_width self.stack_depth = stack_depth + # Signals + self.new_item_in = Signal(item_width) self.stack_view_in = Array([Signal(item_width) for _ in range(stack_depth)]) self.occupancy_bitmap_in = Signal(stack_depth) -- GitLab