Example #1
0
    def construct(s):
        s.read = CalleePort(method=s.rd)
        s.write = CalleePort(method=s.wr)

        s.v = 0

        s.add_constraints(M(s.rd) > M(s.wr), )
Example #2
0
    def construct(s, size):
        s.queue = deque(maxlen=size)

        s.enq = CalleePort(method=s.enq_)
        s.enq_rdy = CalleePort(method=s.enq_rdy_)

        s.deq = CalleePort(method=s.deq_)
        s.deq_rdy = CalleePort(method=s.deq_rdy_)
Example #3
0
    def construct(s):
        s.resp = CalleePort()
        s.resp_rdy = CalleePort()
        s.entry = None

        s.add_constraints(
            M(s.req) == M(s.resp),
            M(s.req_rdy) == M(s.resp_rdy),
        )
Example #4
0
    def construct(s, msgs):
        s.msgs = list(msgs)
        s.queue = deque(maxlen=1)
        s.idx = 0

        s.resp = CalleePort(method=s.resp_)
        s.resp_rdy = CalleePort(method=s.resp_rdy_)

        s.v = None

        @update_once
        def up_sink():
            s.v = None

            if s.queue:
                msg = s.queue.popleft()
                s.v = msg

                if s.idx >= len(s.msgs):
                    raise TestSinkError("""
  The test sink received a message that !
  - sink name    : {}
  - msg number   : {}
  - actual msg   : {}
  """.format(s, s.idx, msg))
                else:
                    ref = s.msgs[s.idx]
                    s.idx += 1

                    if msg != ref:
                        raise TestSinkError("""
  The test sink received an incorrect message!
  - sink name    : {}
  - msg number   : {}
  - expected msg : {}
  - actual msg   : {}
  """.format(s, s.idx, ref, msg))

        s.add_constraints(
            U(up_sink) < M(s.resp_),  # pipe behavior
            U(up_sink) < M(s.resp_rdy_),
        )
Example #5
0
    def construct(s, msgs):
        s.msgs = list(msgs)
        s.idx = 0

        s.resp = CalleePort(method=s.resp_)
        s.resp_rdy = CalleePort(method=s.resp_rdy_)
Example #6
0
 def construct(s, recv=None, rdy=None):
     s.recv = CalleePort(method=recv)
     s.rdy = CalleePort(method=rdy)