예제 #1
0
파일: HSD.py 프로젝트: hnikolov/pihdf
    def hs_arbdemux(rst, clk, hsi, ls_hso, sel, ARBITER_TYPE="priority"):
        """(One-to-many) Arbitrates to multiple output handshake interfaces
            Arbitrates only between autputs that currently have active ready
            hsi    - a input (ready, valid) tuple
            ls_hso - list of output (ready, valid) tuples
            sel    - output that indicates the currently selected output handshake interface
            ARBITER_TYPE - selects the type of arbiter to be used, priority or roundrobin
        """
        shi_rdy, hsi_vld = hsi
        ls_rdy = [hs[0] for hs in ls_hso]
        s = Signal(intbv(0), min=0, max=len(ls_rdy))
        prio_update = Signal(bool(0))

        @always_comb
        def comb():
            prio_update.next = shi_rdy and hsi_vld
            sel.next = s

        if (ARBITER_TYPE == "priority"):
            arb = arbiter.priority(ls_rdy, s)
        elif (ARBITER_TYPE == "roundrobin"):
            arb = arbiter.roundrobin(rst, clk, ls_rdy, s, prio_update)
        else:
            assert "hs_arbdemux: Unknown arbiter type: {}".format(ARBITER_TYPE)

        demux = HSD.hs_demux(s, hsi, ls_hso)

        return instances()
예제 #2
0
파일: HSD.py 프로젝트: hnikolov/pihdf
    def hs_arbdemux(rst, clk, hsi, ls_hso, sel, ARBITER_TYPE="priority"):
        """(One-to-many) Arbitrates to multiple output handshake interfaces
            Arbitrates only between autputs that currently have active ready
            hsi    - a input (ready, valid) tuple
            ls_hso - list of output (ready, valid) tuples
            sel    - output that indicates the currently selected output handshake interface
            ARBITER_TYPE - selects the type of arbiter to be used, priority or roundrobin
        """
        shi_rdy, hsi_vld = hsi
        ls_rdy = [hs[0] for hs in ls_hso]
        s = Signal(intbv(0), min=0, max=len(ls_rdy))
        prio_update = Signal(bool(0))

        @always_comb
        def comb():
            prio_update.next = shi_rdy and hsi_vld
            sel.next = s

        if (ARBITER_TYPE == "priority"):
            arb = arbiter.priority(ls_rdy, s)
        elif (ARBITER_TYPE == "roundrobin"):
            arb = arbiter.roundrobin(rst, clk, ls_rdy, s, prio_update)
        else:
            assert "hs_arbdemux: Unknown arbiter type: {}".format(ARBITER_TYPE)

        demux = HSD.hs_demux(s, hsi, ls_hso)

        return instances()
예제 #3
0
파일: HSD.py 프로젝트: hnikolov/pihdf
    def hs_arbmux(rst, clk, ls_hsi, hso, sel, ARBITER_TYPE="priority"):
        """ (Many-to-one) Arbitrates multiple input handshake interfaces
            Arbitrated only between inputs that currently have active valid
            ls_hsi - list of input (ready, valid) tuples
            hso    - a output (ready, valid) tuple
            sel    - output that indicates the currently selected input handshake interface
            ARBITER_TYPE - selects the type of arbiter to be used, priority or roundrobin
        """
        ls_vld = [hs[1] for hs in ls_hsi]
        sho_rdy, hso_vld = hso
        s = Signal(intbv(0), min=0, max=len(ls_vld))
        prio_update = Signal(bool(0))

        @always_comb
        def comb():
            prio_update.next = sho_rdy and hso_vld
            sel.next = s

        if (ARBITER_TYPE == "priority"):
            arb = arbiter.priority(ls_vld, s)
        elif (ARBITER_TYPE == "roundrobin"):
            arb = arbiter.roundrobin(rst, clk, ls_vld, s, prio_update)
        else:
            assert "hs_arbmux: Unknown arbiter type: {}".format(ARBITER_TYPE)

        mux = HSD.hs_mux(s, ls_hsi, hso)

        return instances()
예제 #4
0
파일: HSD.py 프로젝트: hnikolov/pihdf
    def hs_arbmux(rst, clk, ls_hsi, hso, sel, ARBITER_TYPE="priority"):
        """ (Many-to-one) Arbitrates multiple input handshake interfaces
            Arbitrated only between inputs that currently have active valid
            ls_hsi - list of input (ready, valid) tuples
            hso    - a output (ready, valid) tuple
            sel    - output that indicates the currently selected input handshake interface
            ARBITER_TYPE - selects the type of arbiter to be used, priority or roundrobin
        """
        ls_vld = [hs[1] for hs in ls_hsi]
        sho_rdy, hso_vld = hso
        s = Signal(intbv(0), min=0, max=len(ls_vld))
        prio_update = Signal(bool(0))

        @always_comb
        def comb():
            prio_update.next = sho_rdy and hso_vld
            sel.next = s

        if (ARBITER_TYPE == "priority"):
            arb = arbiter.priority(ls_vld, s)
        elif (ARBITER_TYPE == "roundrobin"):
            arb = arbiter.roundrobin(rst, clk, ls_vld, s, prio_update)
        else:
            assert "hs_arbmux: Unknown arbiter type: {}".format(ARBITER_TYPE)

        mux = HSD.hs_mux(s, ls_hsi, hso)

        return instances()