sonar/interfaces/axi4_stream.py
def _f2s_bin_data(self, data_str, endian):
        """
        A file parsing function for file_to_stream. Assumes a binary file that
        contains only tdata

        Args:
            data_str (str): Read data from the file as a string
            endian (str): little|big

        Returns:
            list: Contains dicts representing each beat of AXI4Stream transaction
        """

        transactions = []
        data = bytearray(data_str)
        file_size = len(data)
        beat_count = (ceil(file_size / 8.0)) * 8
        beat = 0
        tdata_bytes = int(self.get_signal("tdata").size / 8)

        while beat < beat_count:
            tdata = 0
            for i in range(beat, beat + tdata_bytes):
                if endian == "little":
                    if i < file_size:
                        tdata = (tdata >> 8) | (data[i] << 56)
                    elif i < beat + tdata_bytes:
                        tdata = tdata >> 8
                else:  # big endian
                    if i < file_size:
                        tdata = (tdata << 8) | (data[i])
                    elif i < beat + tdata_bytes:
                        tdata = tdata << 8
            # payload = self._payload(tdata="0x" + format(tdata, "08x"))
            payload = self._payload(tdata=tdata)

            if self.has_signal("tkeep"):
                tkeep = self._f2s_tkeep(file_size, tdata_bytes, beat, endian)
                payload = self._payload(payload, tkeep=tkeep)
            if self.has_signal("tlast"):
                tlast = self._f2s_tlast(file_size, beat)
                payload = self._payload(payload, tlast=tlast)

            transactions.append(payload)
            beat = beat + tdata_bytes

        return transactions

        A file parsing function for file_to_stream. Assumes a binary file that
        contains only tdata

        Args:
            data_str (str): Read data from the file as a string
            endian (str): little|big

        Returns:
            list: Contains dicts representing each beat of AXI4Stream transaction
        
A file parsing function for file_to_stream. Assumes a binary file that
contains only tdata
A file parsing function for file_to_stream . Assumes a binary file that contains only tdata
def _f2s_bin_data(self, data_str, endian):
        transactions = []
        data = bytearray(data_str)
        file_size = len(data)
        beat_count = (ceil(file_size / 8.0)) * 8
        beat = 0
        tdata_bytes = int(self.get_signal("tdata").size / 8)
        while beat < beat_count:
            tdata = 0
            for i in range(beat, beat + tdata_bytes):
                if endian == "little":
                    if i < file_size:
                        tdata = (tdata >> 8) | (data[i] << 56)
                    elif i < beat + tdata_bytes:
                        tdata = tdata >> 8
                else:  
                    if i < file_size:
                        tdata = (tdata << 8) | (data[i])
                    elif i < beat + tdata_bytes:
                        tdata = tdata << 8
            payload = self._payload(tdata=tdata)
            if self.has_signal("tkeep"):
                tkeep = self._f2s_tkeep(file_size, tdata_bytes, beat, endian)
                payload = self._payload(payload, tkeep=tkeep)
            if self.has_signal("tlast"):
                tlast = self._f2s_tlast(file_size, beat)
                payload = self._payload(payload, tlast=tlast)
            transactions.append(payload)
            beat = beat + tdata_bytes
        return transactions
def _f2s_bin_data ( self , data_str , endian ) : transactions = [ ] data = bytearray ( data_str ) file_size = len ( data ) beat_count = ( ceil ( file_size / 8.0 ) ) * 8 beat = 0 tdata_bytes = int ( self . get_signal ( "tdata" ) . size / 8 ) while beat < beat_count : tdata = 0 for i in range ( beat , beat + tdata_bytes ) : if endian == "little" : if i < file_size : tdata = ( tdata >> 8 ) | ( data [ i ] << 56 ) elif i < beat + tdata_bytes : tdata = tdata >> 8 else : if i < file_size : tdata = ( tdata << 8 ) | ( data [ i ] ) elif i < beat + tdata_bytes : tdata = tdata << 8 payload = self . _payload ( tdata = tdata ) if self . has_signal ( "tkeep" ) : tkeep = self . _f2s_tkeep ( file_size , tdata_bytes , beat , endian ) payload = self . _payload ( payload , tkeep = tkeep ) if self . has_signal ( "tlast" ) : tlast = self . _f2s_tlast ( file_size , beat ) payload = self . _payload ( payload , tlast = tlast ) transactions . append ( payload ) beat = beat + tdata_bytes return transactions
A file parsing function for file_to_stream.
A file parsing function for file_to_stream .
"""
        A file parsing function for file_to_stream. Assumes a binary file that
        contains only tdata

        Args:
            data_str (str): Read data from the file as a string
            endian (str): little|big

        Returns:
            list: Contains dicts representing each beat of AXI4Stream transaction
        """ # big endian # payload = self._payload(tdata="0x" + format(tdata, "08x"))
Contains dicts representing each beat of AXI4Stream transaction
Contains dicts representing each beat of AXI4Stream transaction
list
self
data_str
Read data from the file as a string
Read data from the file as a string
endian
None