diff --git a/unoptimized_lr/simple_lr_automaton.py b/unoptimized_lr/simple_lr_automaton.py index 28ca4c36f3f466ad5d070d0ae652cc0064927cbb..8bb4cc4b5a7e42cc8b9236db9843faef92202fb5 100644 --- a/unoptimized_lr/simple_lr_automaton.py +++ b/unoptimized_lr/simple_lr_automaton.py @@ -102,35 +102,32 @@ from functools import reduce # (Parser action: {shift terminal, accept, error, reduce with rule k}) # # +# Reduce rule table: # -# GOTO table: -# -# (current state number, nonterminal created by reduce rule) -# WStates WNonterminal +# (reduce rule number) +# WRules # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # / \ # /----------------------\ /---------------------\ -# | Parse State Machine | | GOTO Table | +# | Parse State Machine | | Reduce Rule Table | # \----------------------/ \---------------------/ # \ / # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -# (validity bit, next state number) -# +# (nonterminal created, number of stack items to pop) # # -# Reduce rule table: +# GOTO table: # -# (reduce rule number) -# WRules +# (current state number, nonterminal created by reduce rule) +# WStates WNonterminal # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # / \ # /----------------------\ /---------------------\ -# | Parse State Machine | | Reduce Rule Table | +# | Parse State Machine | | GOTO Table | # \----------------------/ \---------------------/ # \ / # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -# (nonterminal created, number of stack items to pop) -# +# (validity bit, next state number) # # # Parse item stack: @@ -216,7 +213,24 @@ class ParametrizationConstants(): self.W_parsetree_index = len(dummy_signal) - +class LR_automaton_internal(Layout): + def __init__(self, *, parameters): + super().__init__([ + # TABLES + ("ShiftReduce_table_bus"), + ("GOTO_table_bus"), + ("Reduce_table_bus"), + + # STACKS + ("parse_stack_bus"), + ("index_stack_bus"), + + # INPUT + ("input_stream"), + # OUTPUTS + ("serialization_bus"), + ("sideband_bus") + ]) class SimpleLRAutomaton(Elaboratable): def __init__(self, *, lr_tables, parameters):