<commit_before>#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from hwt.synthesizer.rtlLevel.rtlSignal import RtlSignal
from hwtLib.amba.axi_comp.oooOp.outOfOrderCummulativeOp import OutOfOrderCummulativeOp


class OooOpExampleCounterArray(OutOfOrderCummulativeOp):

    def _config(self):
        OutOfOrderCummulativeOp._config(self)
        # the transaction always just increments the counter
        # so there is no need for transaction state
        self.TRANSACTION_STATE_T = None

    def main_op(self,  dst_main_state: RtlSignal, src_main_state: RtlSignal):
        return dst_main_state.data(src_main_state.data + 1)


if __name__ == "__main__":
    from hwt.synthesizer.utils import to_rtl_str
    # u = _example_OutOfOrderCummulativeOp()
    u = OooOpExampleCounterArray()
    u.ID_WIDTH = 2
    u.ADDR_WIDTH = 2 + 3
    u.DATA_WIDTH = u.MAIN_STATE_T.bit_length()

    print(to_rtl_str(u))<commit_msg>OooOpExampleCounterArray.main_op fix type hints<commit_after>#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from hwtLib.amba.axi_comp.oooOp.outOfOrderCummulativeOp import OutOfOrderCummulativeOp
from hwtLib.amba.axi_comp.oooOp.utils import OOOOpPipelineStage


class OooOpExampleCounterArray(OutOfOrderCummulativeOp):

    def _config(self):
        OutOfOrderCummulativeOp._config(self)
        # the transaction always just increments the counter
        # so there is no need for transaction state
        self.TRANSACTION_STATE_T = None

    def main_op(self,  dst_main_state: OOOOpPipelineStage, src_main_state: OOOOpPipelineStage):
        return dst_main_state.data(src_main_state.data + 1)


if __name__ == "__main__":
    from hwt.synthesizer.utils import to_rtl_str
    # u = _example_OutOfOrderCummulativeOp()
    u = OooOpExampleCounterArray()
    u.ID_WIDTH = 2
    u.ADDR_WIDTH = 2 + 3
    u.DATA_WIDTH = u.MAIN_STATE_T.bit_length()

    print(to_rtl_str(u))
{'fraction_non_alphanumeric': 0.08373078961314255, 'fraction_numerical': 0.006359300476947536, 'mean_word_length': 3.968421052631579, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2646226', 'n_tokens_mistral': 673, 'n_tokens_neox': 639, 'n_words': 126}