Beispiel #1
0
    def construct(s, DutType=ChecksumCL):
        s.recv = NonBlockingCalleeIfc(Bits128)
        s.give = NonBlockingCalleeIfc(Bits32)

        s.checksum_unit = DutType()
        s.out_q = BypassQueueCL(num_entries=1)

        s.connect(s.recv, s.checksum_unit.recv)
        s.connect(s.checksum_unit.send, s.out_q.enq)
        s.connect(s.out_q.deq, s.give)
  def construct( s ):

    s.recv = NonBlockingCalleeIfc( Req  )
    s.give = NonBlockingCalleeIfc( Resp )

    s.checksum_xcel = ChecksumXcelCL()
    s.out_q = BypassQueueCL( num_entries=1 )
    s.connect_pairs(
      s.recv,                    s.checksum_xcel.xcel.req,
      s.checksum_xcel.xcel.resp, s.out_q.enq,
      s.out_q.deq,               s.give,
    )
Beispiel #3
0
  def construct( s, DutType=ChecksumCL ):
    s.recv = CalleeIfcCL( Type=Bits128 )
    s.give = CalleeIfcCL( Type=Bits32  )

    s.checksum_unit = DutType()
    s.out_q = BypassQueueCL( num_entries=1 )

    connect_pairs(
      s.recv,               s.checksum_unit.recv,
      s.checksum_unit.send, s.out_q.enq,
      s.out_q.deq,          s.give,
    )
    def construct(s):

        # Interface

        ReqType, RespType = mk_xcel_msg(5, 32)
        s.RespType = RespType

        s.xcel = XcelMinionIfcCL(ReqType, RespType)

        # State encoding

        s.XCFG = 0
        s.WAIT = 1
        s.BUSY = 2

        # Local paramters

        RD = XcelMsgType.READ
        WR = XcelMsgType.WRITE

        # Components

        s.in_q = NormalQueueCL(num_entries=2)
        s.reg_file = [b32(0) for _ in range(6)]
        s.checksum_unit = ChecksumCL()

        s.state = s.XCFG

        s.out_q = BypassQueueCL(num_entries=1)

        s.connect(s.checksum_unit.send, s.out_q.enq)
        s.connect(s.xcel.req, s.in_q.enq)

        @s.update
        def up_tick():
            if s.state == s.XCFG:
                # Dequeue a request message from input queue and send response.
                if s.in_q.deq.rdy() and s.xcel.resp.rdy():
                    req = s.in_q.deq()
                    if req.type_ == RD:
                        s.xcel.resp(s.RespType(RD, s.reg_file[int(req.addr)]))
                    elif req.type_ == WR:
                        s.reg_file[int(req.addr)] = req.data
                        s.xcel.resp(s.RespType(WR, 0))

                        # If the go bit is written
                        if req.addr == 4:
                            if s.checksum_unit.recv.rdy():
                                s.state = s.BUSY
                                words = s.get_words()
                                s.checksum_unit.recv(words_to_b128(words))
                            else:
                                s.state = s.WAIT

            elif s.state == s.WAIT:
                if s.checksum_unit.recv.rdy():
                    words = s.get_words()
                    s.checksum_unit.recv(words_to_b128(words))
                    s.state = s.BUSY

            else:  # s.state == s.BUSY
                if s.out_q.deq.rdy():
                    s.reg_file[5] = s.out_q.deq()
                    s.state = s.XCFG