From 4a896dda81c73842ac747cea47d487f7cde9a048 Mon Sep 17 00:00:00 2001 From: Kia <kia@special-circumstanc.es> Date: Thu, 22 Apr 2021 09:49:20 -0600 Subject: [PATCH] redoing the table/stack Layouts to just take the language parameters; also fixed bug where we were mistakenly indexing by nonterminals and not reduce rules --- unoptimized_lr/simple_lr_tables.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/unoptimized_lr/simple_lr_tables.py b/unoptimized_lr/simple_lr_tables.py index 03ce891..6d838fb 100644 --- a/unoptimized_lr/simple_lr_tables.py +++ b/unoptimized_lr/simple_lr_tables.py @@ -198,7 +198,10 @@ class GOTOtable(Elaboratable): class OneDimensionTableBusLayout(Layout): - def __init__(self, *, row_input_width, output_width): + def __init__(self, *, parameters): + output_width = (parameters.W_max_RHS + parameters.W_nonterminal) + row_input_width = parameters.W_rule + super().__init__([ # INPUTS ("row_idx", unsigned(row_input_width)), # FROM SOURCE @@ -213,8 +216,8 @@ class OneDimensionTableBusLayout(Layout): ]) class OneDimensionTableBus(Record): - def __init__(self, *, row_input_width, output_width): - super().__init__(OneDimensionTableBusLayout(row_input_width=row_input_width, output_width=output_width)) + def __init__(self, *, parameters): + super().__init__(OneDimensionTableBusLayout(parameters=parameters)) class ReduceRuleTable(Elaboratable): @@ -231,14 +234,12 @@ class ReduceRuleTable(Elaboratable): # This means that the length of each element has to be: # TIW = (WLongestRule + number of bits to index the nonterminals) - - self.table_width = (lang_params.W_max_RHS + lang_paramsW_nonterminal) - self.table_depth = lang_param.number_of_nonterminals + self.table_width = (lang_params.W_max_RHS + lang_params.W_nonterminal) + self.table_depth = lang_param.number_of_reduce_rules # Interfaces - self.bus = OneDimensionTableBus(row_input_width=W_nonterminal, - output_width=self.table_width) + self.bus = OneDimensionTableBus(parameters=lang_params) self.mem = Memory(width=self.table_width, depth=self.table_depth, init=input_array) -- GitLab