Exemple #1
0
    def read(self,
             t: HdlType,
             tmpl: Optional[TransTmpl] = None,
             frames: Optional[List[FrameTmpl]] = None,
             id_=0) -> Union[UnionSource, StructIntf, Handshaked]:
        """
        :param ~.t: instance of HStruct which specifies data format to download
        :param ~.tmpl: instance of TransTmpl for this t
        :param ~.frames: list of FrameTmpl instances for this tmpl
        :param ~.id_: id_ value for axi
        :note: if tmpl and frames are None they are resolved from structT parseTemplate
        :note: A single transaction can be split to multiple frames, if they are specified by "frames".
        """
        axi = self.end

        r = StructReader(t, tmpl=tmpl, frames=frames)
        r.ID_WIDTH = 0
        r.ADDR_WIDTH = axi.ADDR_WIDTH
        r.DATA_WIDTH = axi.DATA_WIDTH

        setattr(self.parent, self._findSuitableName("rReader"), r)
        self._propagateClkRstn(r)

        dp = Axi_rDatapump(axi.__class__)
        dp.ADDR_WIDTH = axi.ADDR_WIDTH
        dp.ID_WIDTH = axi.ID_WIDTH
        dp.DATA_WIDTH = axi.DATA_WIDTH
        dp.USE_STRB = False
        dp.ID_VAL = id_
        dp.MAX_TRANS_OVERLAP = self.max_trans_overlap
        dp.ALIGNAS = self.alignas

        if isinstance(t, HStream):
            raise NotImplementedError()
        else:
            dp.MAX_CHUNKS = 1
            dp.CHUNK_WIDTH = r.rDatapump.MAX_BYTES * 8

        setattr(self.parent, self._findSuitableName("rDataPump"), dp)
        self._propagateClkRstn(dp)

        connectDp(self.parent, r, dp, self.end)
        return r.get, r.dataOut
Exemple #2
0
 def test_multiframe(self):
     tmpl = TransTmpl(s0)
     DATA_WIDTH = 64
     frames = list(
         FrameTmpl.framesFromTransTmpl(tmpl,
                                       DATA_WIDTH,
                                       maxPaddingWords=0,
                                       trimPaddingWordsOnStart=True,
                                       trimPaddingWordsOnEnd=True))
     u = StructReader(s0, tmpl=tmpl, frames=frames)
     self._test_s0(u)
Exemple #3
0
    def _declr(self):
        addClkRstn(self)

        with self._paramsShared():
            self.axi_m = Axi3()._m()

        a = self.packetAddr = Handshaked()
        a._replaceParam(a.DATA_WIDTH, self.ADDR_WIDTH)

        with self._paramsShared():
            self.rxPacketLoader = StructReader(frameHeader)
            self.rxDataPump = Axi_rDatapump(Axi3_addr)

            self.txPacketUpdater = StructWriter(frameHeader)
            self.txDataPump = Axi_wDatapump(Axi3_addr, Axi3_w)
        for o in (self.txPacketUpdater, self.txDataPump):
            o.USE_STRB.set(True)
Exemple #4
0
 def test_simpleFields(self):
     u = StructReader(s0)
     self._test_s0(u)
Exemple #5
0
 def _config(self):
     StructReader._config(self)
     self.MAX_OVERLAP = Param(2)
     self.WRITE_ACK = Param(False)