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
Пример #2
0
def mk_xcel_transaction(words):
    words = [b16(x) for x in words]
    bits = words_to_b128(words)
    reqs = []
    reqs.append(Req(wr, 0, bits[0:32]))
    reqs.append(Req(wr, 1, bits[32:64]))
    reqs.append(Req(wr, 2, bits[64:96]))
    reqs.append(Req(wr, 3, bits[96:128]))
    reqs.append(Req(wr, 4, 1))
    reqs.append(Req(rd, 5, 0))

    resps = []
    resps.append(Resp(wr, 0))
    resps.append(Resp(wr, 0))
    resps.append(Resp(wr, 0))
    resps.append(Resp(wr, 0))
    resps.append(Resp(wr, 0))
    resps.append(Resp(rd, checksum(words)))

    return reqs, resps
def mk_xcel_transaction( words ):
  words = [ b16(x) for x in words ]
  bits = words_to_b128( words )
  reqs = []
  reqs.append( Req( wr, b5(0), bits[0 :32 ] ) )
  reqs.append( Req( wr, b5(1), bits[32:64 ] ) )
  reqs.append( Req( wr, b5(2), bits[64:96 ] ) )
  reqs.append( Req( wr, b5(3), bits[96:128] ) )
  reqs.append( Req( wr, b5(4), b32(1)       ) )
  reqs.append( Req( rd, b5(5), b32(0)       ) )

  resps = []
  resps.append( Resp( wr, b32(0)          ) )
  resps.append( Resp( wr, b32(0)          ) )
  resps.append( Resp( wr, b32(0)          ) )
  resps.append( Resp( wr, b32(0)          ) )
  resps.append( Resp( wr, b32(0)          ) )
  resps.append( Resp( rd, checksum(words) ) )

  return reqs, resps