diff --git a/unoptimized_lr/simple_lr_tables.py b/unoptimized_lr/simple_lr_tables.py index 03ce8916f223618a858220a545fb60ca853f580b..6d838fbd747dc5423f6f1fdcd08f33d350d19cb6 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)