From bb2eec44abaf806c2131e259d6f53dc151ab6b73 Mon Sep 17 00:00:00 2001 From: Kia <kia@special-circumstanc.es> Date: Thu, 22 Apr 2021 09:55:18 -0600 Subject: [PATCH] shift/reduce table Layout done the right way --- unoptimized_lr/simple_lr_tables.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/unoptimized_lr/simple_lr_tables.py b/unoptimized_lr/simple_lr_tables.py index 58c2659..3aa1080 100644 --- a/unoptimized_lr/simple_lr_tables.py +++ b/unoptimized_lr/simple_lr_tables.py @@ -25,7 +25,11 @@ from functools import reduce class ShiftReduceTableBusLayout(Layout): - def __init__(self, *, row_input_width, column_input_width, output_width): + def __init__(self, *, parameters): + row_input_width = parameters.W_state + column_input_width = parameters.W_terminal + output_width = (parameters.W_rule + 2) + super().__init__([ # INPUTS ("row_idx", unsigned(row_input_width)), # FROM SOURCE @@ -41,8 +45,8 @@ class ShiftReduceTableBusLayout(Layout): ]) class ShiftReduceTableBus(Record): - def __init__(self, *, row_input_width, column_input_width, output_width): - super().__init__(TableBusLayout(row_input_width=row_input_width, column_input_width=column_input_width, output_width=output_width)) + def __init__(self, *, parameters): + super().__init__(TableBusLayout(parameters=parameters)) @@ -76,9 +80,7 @@ class LRTable(Elaboratable): # Interfaces - self.bus = TableBus(row_input_width=lang_params.W_state, - column_input_width=lang_params.W_terminal, - output_width=self.table_width) + self.bus = TableBus(parameters=lang_params) # Interfaces -- GitLab