[go: up one dir, main page]

CN116204461A - Data bit width conversion method and system - Google Patents

Data bit width conversion method and system Download PDF

Info

Publication number
CN116204461A
CN116204461A CN202310215241.7A CN202310215241A CN116204461A CN 116204461 A CN116204461 A CN 116204461A CN 202310215241 A CN202310215241 A CN 202310215241A CN 116204461 A CN116204461 A CN 116204461A
Authority
CN
China
Prior art keywords
data
bit width
sub
storage units
write
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310215241.7A
Other languages
Chinese (zh)
Inventor
刘晓峰
牛晓威
周成龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Anlu Information Technology Co ltd
Original Assignee
Shanghai Anlu Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Anlu Information Technology Co ltd filed Critical Shanghai Anlu Information Technology Co ltd
Priority to CN202310215241.7A priority Critical patent/CN116204461A/en
Publication of CN116204461A publication Critical patent/CN116204461A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/16Handling requests for interconnection or transfer for access to memory bus
    • G06F13/1668Details of memory controller
    • G06F13/1678Details of memory controller using bus width
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4004Coupling between buses
    • G06F13/4009Coupling between buses with data restructuring
    • G06F13/4018Coupling between buses with data restructuring with data-width conversion
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Read Only Memory (AREA)

Abstract

The invention provides a data bit width conversion method, which comprises splitting data to be converted of bit width according to preset bit width to sequentially write into a plurality of storage units, wherein the data to be converted of bit width comprises a plurality of sub data, the size of the sub data is m bytes, m is an integer larger than 0, the data are sequentially read from the plurality of storage units according to target bit width to splice so as to obtain data after the bit width conversion, the split data are stored through the plurality of storage units, when the data are read, splicing can be carried out according to the read data of the target bit width, and the size of the combinable bit width is greatly increased because the data after the data to be converted of bit width are split is smaller, so that the flexibility of the bit width conversion is increased. The invention also provides a data bit width conversion system.

Description

数据位宽变换方法及系统Data bit width conversion method and system

技术领域technical field

本发明涉及数据处理技术领域,尤其涉及一种数据位宽变换方法及系统。The invention relates to the technical field of data processing, in particular to a data bit width conversion method and system.

背景技术Background technique

在视频领域、通信领域以及同一个领域不同协议规定中,很多涉及到位宽变换的应用场景。不同的应用场景有着不同的字节位宽转换,以视频领域VBO协议为例,不同的像素色深,视频数据包有3byte、4byte、5byte字节位宽之分,而串行器/解串器(SERDES)传输接口位宽往往是固定的,固定位宽一般为2byte或者4byte。如果跟随视频数据包的位宽变换SERDES传输接口位宽,往往会增加设计的复杂性,因此一般通过固定SERDES传输接口位宽,通过对视频数据包的字节位宽转换来实现功能要求,但却严重限制了位宽变换的灵活性,应用场景严重受限。In the video field, communication field, and different protocol regulations in the same field, there are many application scenarios involving bit width conversion. Different application scenarios have different byte width conversions. Taking the VBO protocol in the video field as an example, different pixel color depths, video data packets have 3byte, 4byte, and 5byte byte widths, and the serializer/deserializer The bit width of the device (SERDES) transmission interface is often fixed, and the fixed bit width is generally 2byte or 4byte. If the bit width of the SERDES transmission interface is changed according to the bit width of the video data packet, the complexity of the design will often be increased. Therefore, the functional requirements are generally realized by fixing the bit width of the SERDES transmission interface and converting the byte width of the video data packet, but However, the flexibility of bit width transformation is severely limited, and the application scenarios are severely limited.

因此,有必要提供一种新型的数据位宽变换方法及系统以解决现有技术中存在的上述问题。Therefore, it is necessary to provide a novel data bit width conversion method and system to solve the above-mentioned problems existing in the prior art.

发明内容Contents of the invention

本发明的目的在于提供一种数据位宽变换方法及系统,增加位宽变换的灵活性。The object of the present invention is to provide a data bit width conversion method and system to increase the flexibility of bit width conversion.

为实现上述目的,本发明的所述数据位宽变换方法,包括:In order to achieve the above object, the data bit width conversion method of the present invention includes:

将位宽待变换数据按照预设位宽进行拆分,以依次写入若干存储单元,所述位宽待变换数据包括若干子数据,所述子数据的大小为m字节,m为大于0的整数;Splitting the data to be converted according to the preset bit width to sequentially write into several storage units, the data to be converted by the bit width includes several sub-data, the size of the sub-data is m bytes, and m is an integer greater than 0 ;

按照目标位宽依次从若干存储单元中读取数据进行拼接,以得到位宽变换后的数据。According to the target bit width, the data is sequentially read from several storage units for splicing, so as to obtain the data after the bit width conversion.

所述数据位宽变换方法的有益效果在于:将位宽待变换数据按照预设位宽进行拆分,以依次写入若干存储单元,所述位宽待变换数据包括若干子数据,所述子数据的大小为m字节,m为大于0的整数,按照目标位宽依次从若干存储单元中读取数据进行拼接,以得到位宽变换后的数据,通过若干存储单元存储拆分后的数据,在读取数据时能够根据目标位宽读取数据进行拼接,因位宽待变换数据拆分后数据变小,可组合位宽大小极大增加,从而增加了位宽变换的灵活性。The beneficial effect of the data bit width conversion method is that the bit width to be converted data is split according to the preset bit width to write into several storage units in sequence, the bit width to be converted data includes several sub-data, and the sub-data The size is m bytes, and m is an integer greater than 0. According to the target bit width, the data is sequentially read from several storage units for splicing to obtain the data after bit width conversion, and the split data is stored through several storage units. When reading data, the data can be read and spliced according to the target bit width, because the data becomes smaller after the data to be transformed is split, and the size of the combinable bit width is greatly increased, thereby increasing the flexibility of bit width conversion.

可选地,所述将位宽待变换数据按照预设位宽进行拆分,以依次写入若干存储单元,包括:Optionally, the splitting of the data to be converted in bit width according to the preset bit width, so as to sequentially write into several storage units, includes:

将所述子数据拆分成m个8位的数据,以依次写入m个存储单元中。The sub-data is split into m pieces of 8-bit data to be sequentially written into the m storage units.

可选地,所述数据位宽变换方法还包括有效数据深度计算步骤,所述有效数据深度计算步骤包括:Optionally, the data bit width conversion method further includes an effective data depth calculation step, and the effective data depth calculation step includes:

根据写入位置和读出位置计算得到有效数据深度。The effective data depth is calculated according to the writing position and the reading position.

可选地,所述数据位宽变换方法还包括写入位置计算步骤,所述写入位置计算步骤包括:Optionally, the data bit width conversion method further includes a writing position calculation step, and the writing position calculation step includes:

根据所述存储单元中已写入的子数据的数量、所述子数据的大小以及所述存储单元的内存大小,得到写入位置。The writing position is obtained according to the quantity of sub-data written in the storage unit, the size of the sub-data and the memory size of the storage unit.

可选地,所述数据位宽变换方法还包括读出位置计算步骤,所述读出位置计算步骤包括:Optionally, the data bit width conversion method further includes a readout position calculation step, and the readout position calculation step includes:

根据从所述存储单元读取数据的次数、所述目标位宽以及所述存储单元的内存大小,得到读出位置。The readout position is obtained according to the times of reading data from the storage unit, the target bit width and the memory size of the storage unit.

可选地,所述存储单元的内存大小为8位。Optionally, the memory size of the storage unit is 8 bits.

本发明还提供了一种数据位宽变换系统,包括若干存储单元、写入控制单元和读出控制单元,所述写入控制单元用于将位宽待变换数据按照预设位宽进行拆分,以依次写入若干所述存储单元,所述位宽待变换数据包括若干子数据,所述子数据的大小为m字节,m为大于0的整数;所述读出控制单元用于按照目标位宽依次从若干存储单元中读取数据进行拼接,以得到位宽变换后的数据。The present invention also provides a data bit width conversion system, including several storage units, a write control unit and a read control unit, the write control unit is used to split the data to be converted according to the preset bit width, To sequentially write into several storage units, the data to be converted in bit width includes several sub-data, the size of the sub-data is m bytes, and m is an integer greater than 0; the read control unit is used to The data is sequentially read from several storage units and spliced to obtain the data after the bit width conversion.

所述数据位宽变换系统的有益效果在于:所述写入控制单元用于将位宽待变换数据按照预设位宽进行拆分,以依次写入若干所述存储单元,所述位宽待变换数据包括若干子数据,所述子数据的大小为m字节,m为大于0的整数,所述读出控制单元用于按照目标位宽依次从若干存储单元中读取数据进行拼接,以得到位宽变换后的数据,通过若干存储单元存储拆分后的数据,在读取数据时能够根据目标位宽读取数据进行拼接,因位宽待变换数据拆分后数据变小,可组合位宽大小极大增加,从而增加了位宽变换的灵活性。The beneficial effect of the data bit width conversion system is that: the write control unit is used to split the bit width to be converted data according to the preset bit width, so as to sequentially write into several storage units, and the bit width to be converted data Including several sub-data, the size of the sub-data is m bytes, m is an integer greater than 0, and the read control unit is used to sequentially read data from several storage units according to the target bit width for splicing, so as to obtain bit The data after width conversion stores the split data through several storage units. When reading the data, the data can be read and spliced according to the target bit width. Because the data becomes smaller after the bit width is converted and the data is split, the bit width can be combined. Greatly increased, thus increasing the flexibility of bit width transformation.

可选地,所述数据位宽变换系统还包括有效数据深度计算单元,用于根据写入位置和读出位置计算得到有效数据深度。Optionally, the data bit width conversion system further includes an effective data depth calculation unit, configured to calculate and obtain the effective data depth according to the writing position and the reading position.

可选地,所述数据位宽变换系统还包括写入位置计算单元,根据所述存储单元中已写入的子数据的数量、所述子数据的大小以及所述存储单元的内存大小,得到写入位置。Optionally, the data bit width conversion system further includes a write position calculation unit, which is obtained according to the number of sub-data written in the storage unit, the size of the sub-data and the memory size of the storage unit Write location.

可选地,所述数据位宽变换系统还包括读出位置计算单元,根据从所述存储单元读取数据的次数、所述目标位宽以及所述存储单元的内存大小,得到读出位置。Optionally, the data bit width conversion system further includes a readout position calculation unit, which obtains the readout position according to the number of times data is read from the storage unit, the target bit width, and the memory size of the storage unit.

附图说明Description of drawings

图1为本发明一些实施例的结构框图;Fig. 1 is a structural block diagram of some embodiments of the present invention;

图2为本发明一些实施例中数据位宽变换方法的流程图;Fig. 2 is a flowchart of a data bit width conversion method in some embodiments of the present invention;

图3为本发明一些实施例中数据位宽变换方法的数据模型示意图。Fig. 3 is a schematic diagram of a data model of a data bit width conversion method in some embodiments of the present invention.

具体实施方式Detailed ways

为使本发明的目的、技术方案和优点更加清楚,下面将结合本发明的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明的一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。除非另外定义,此处使用的技术术语或者科学术语应当为本发明所属领域内具有一般技能的人士所理解的通常意义。本文中使用的“包括”等类似的词语意指出现该词前面的元件或者物件涵盖出现在该词后面列举的元件或者物件及其等同,而不排除其他元件或者物件。In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the present invention. Obviously, the described embodiments are part of the present invention Examples, not all examples. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention. Unless otherwise defined, the technical terms or scientific terms used herein shall have the usual meanings understood by those skilled in the art to which the present invention belongs. As used herein, "comprising" and similar words mean that the elements or items appearing before the word include the elements or items listed after the word and their equivalents, without excluding other elements or items.

针对现有技术存在的问题,本发明的实施例提供了一种数据位宽变换系统。参照图1,所述数据位宽变换系统100包括若干存储单元101、写入控制单元102和读出控制单元103。所述写入控制单元102用于将位宽待变换数据按照预设位宽进行拆分,以依次写入若干所述存储单元101,所述位宽待变换数据包括若干子数据,所述子数据的大小为m字节,m为大于0的整数;所述读出控制单元103用于按照目标位宽依次从若干存储单元101中读取数据进行拼接,以得到位宽变换后的数据。Aiming at the problems existing in the prior art, the embodiment of the present invention provides a data bit width conversion system. Referring to FIG. 1 , the data bit width conversion system 100 includes several storage units 101 , a write control unit 102 and a read control unit 103 . The writing control unit 102 is used for splitting the data to be converted in bit width according to the preset bit width, so as to sequentially write into several storage units 101, the data to be converted in bit width includes several sub-data, the sub-data The size is m bytes, and m is an integer greater than 0; the readout control unit 103 is used to sequentially read data from several storage units 101 according to the target bit width for splicing, so as to obtain data after bit width conversion.

一些实施例中,所述数据位宽变换系统还包括有效数据深度计算单元,用于根据写入位置和读出位置计算得到有效数据深度。In some embodiments, the data bit width conversion system further includes an effective data depth calculation unit, configured to calculate and obtain the effective data depth according to the writing position and the reading position.

一些实施例中,所述数据位宽变换系统还包括写入位置计算单元,根据所述存储单元中已写入的子数据的数量、所述子数据的大小以及所述存储单元的内存大小,得到写入位置。In some embodiments, the data bit width conversion system further includes a write position calculation unit, according to the number of sub-data written in the storage unit, the size of the sub-data and the memory size of the storage unit, Get the write location.

一些实施例中,所述数据位宽变换系统还包括读出位置计算单元,根据从所述存储单元读取数据的次数、所述目标位宽以及所述存储单元的内存大小,得到读出位置。In some embodiments, the data bit width conversion system further includes a readout position calculation unit, which obtains the readout position according to the number of times data is read from the storage unit, the target bit width, and the memory size of the storage unit .

一些实施例中,所述存储单元的内存大小为8位。In some embodiments, the memory size of the storage unit is 8 bits.

图2为本发明一些实施例中数据位宽变换方法的流程图。参照图2,所述数据位宽变换方法包括以下步骤:Fig. 2 is a flowchart of a data bit width conversion method in some embodiments of the present invention. With reference to Fig. 2, described data bit width conversion method comprises the following steps:

S1:将位宽待变换数据按照预设位宽进行拆分,以依次写入若干存储单元,所述位宽待变换数据包括若干子数据,所述子数据的大小为m字节,m为大于0的整数;S1: Split the data to be converted in bit width according to the preset bit width, so as to sequentially write into several storage units, the data to be converted in bit width includes several sub-data, the size of the sub-data is m bytes, and m is greater than 0 an integer of

S2:按照目标位宽依次从若干存储单元中读取数据进行拼接,以得到位宽变换后的数据。S2: Reading data from several storage units sequentially according to the target bit width for splicing, so as to obtain data after bit width conversion.

一些实施例中,所述将位宽待变换数据按照预设位宽进行拆分,以依次写入若干存储单元,包括:将所述子数据拆分成m个8位的数据,以依次写入m个存储单元中。In some embodiments, the splitting the bit width to be converted data according to the preset bit width to sequentially write into several storage units includes: splitting the sub-data into m 8-bit data to sequentially write m storage units.

一些实施例中,所述数据位宽变换方法还包括有效数据深度计算步骤,所述有效数据深度计算步骤包括:根据写入位置和读出位置计算得到有效数据深度。In some embodiments, the data bit width conversion method further includes a step of calculating an effective data depth, and the step of calculating the effective data depth includes: calculating the effective data depth according to the writing position and the reading position.

一些实施例中,所述数据位宽变换方法还包括写入位置计算步骤,所述写入位置计算步骤包括:根据所述存储单元中已写入的子数据的数量、所述子数据的大小以及所述存储单元的内存大小,得到写入位置。具体地,根据所述子数据的大小和所述存储单元的内存大小计算得到存储一个所述子数据所需要的存储单元的数量,然后将存储一个所述子数据所需要的存储单元的数量与所述存储单元中已写入的子数据的数量相乘,以得到写入位置。In some embodiments, the data bit width conversion method further includes a write position calculation step, and the write position calculation step includes: according to the number of sub-data written in the storage unit, the size of the sub-data and the memory size of the storage unit to obtain the write location. Specifically, the number of storage units required to store one sub-data is calculated according to the size of the sub-data and the memory size of the storage unit, and then the number of storage units required to store one sub-data is compared with the The number of sub-data written in the storage unit is multiplied to obtain the writing position.

一些实施例中,所述数据位宽变换方法还包括读出位置计算步骤,所述读出位置计算步骤包括:根据从所述存储单元读取数据的次数、所述目标位宽以及所述存储单元的内存大小,得到读出位置。具体地,根据所述目标位宽和所述存储单元的内存大小计算得到一次读取的存储单元的数量,然后将一次读取的存储单元的数量与从所述存储单元读取数据的次数相乘,得到读出位置。In some embodiments, the data bit width conversion method further includes a readout position calculation step, the readout position calculation step includes: according to the number of times data is read from the storage unit, the target bit width and the storage unit The memory size of the unit, get the read position. Specifically, calculate the number of storage units read once according to the target bit width and the memory size of the storage unit, and then compare the number of storage units read once with the number of times data is read from the storage unit Multiply to get the readout position.

图3为本发明一些实施例中数据位宽变换方法的示意图。Fig. 3 is a schematic diagram of a data bit width conversion method in some embodiments of the present invention.

参照图3,若干所述存储单元的内存大小均为8位,分别为第一寄存器mem[0]、第二寄存器mem[1]、第三寄存器mem[2]、第四寄存器mem[3]、第五寄存器mem[4]、第六寄存器mem[5]、第七寄存器mem[6]、第八寄存器mem[7]、第九寄存器mem[8]、第十寄存器mem[9]、第三寄存器mem[10]至第六十四寄存器mem[63],所述位宽待变换数据包括第一子数据D0、第二子数据D1、第三子数据D2至第n-1子数据Dn,且第一子数据D0、第二子数据D1、第三子数据D2至第n-1子数据Dn的大小均为5字节。With reference to Fig. 3, the memory size of several described storage units is 8 bits, is respectively the first register mem[0], the second register mem[1], the third register mem[2], the fourth register mem[3] , the fifth register mem[4], the sixth register mem[5], the seventh register mem[6], the eighth register mem[7], the ninth register mem[8], the tenth register mem[9], the Three registers mem[10] to sixty-fourth register mem[63], the bit width to be converted data includes the first sub-data D0, the second sub-data D1, the third sub-data D2 to the n-1th sub-data Dn, In addition, the sizes of the first sub-data D0 , the second sub-data D1 , the third sub-data D2 to the n−1th sub-data Dn are all 5 bytes.

参照图3,第一次向若干所述存储单元中写入数据时,将第一子数据D0拆分成数据D0[7:0]、数据D0[15:8]、数据D0[23:16]、数据D0[31:24]和数据D0[39:32],将数据D0[7:0]写入所述第一寄存器mem[0],将数据D0[15:8]写入所述第二寄存器mem[1],将数据D0[23:16]写入所述第三寄存器mem[2],将数据D0[31:24]写入所述第四寄存器mem[3],将数据D0[39:32]写入第五寄存器mem[4]。此时已写入所述存储单元中的子数据的数量为1,所述第一子数据D0的大小为5字节,若干所述存储单元的内存大小均为8位,则需要5个寄存器存储所述第一子数据D0,则第一次向若干所述存储单元中写入数据时最后的写入位置为5×1=5,即写入位置为第五寄存器mem[4],第一次写指针①wr_ptr指向第五寄存器mem[4]。相应的,第二次向若干所述存储单元中写入数据的起始写入位置为第六寄存器mem[5]。Referring to Fig. 3, when data is written into several storage units for the first time, the first sub-data D0 is split into data D0[7:0], data D0[15:8], data D0[23:16] ], data D0[31:24] and data D0[39:32], write data D0[7:0] into the first register mem[0], and write data D0[15:8] into the The second register mem[1] writes the data D0[23:16] into the third register mem[2], writes the data D0[31:24] into the fourth register mem[3], and writes the data D0[39:32] is written into the fifth register mem[4]. Now the quantity of the sub-data written in the storage unit is 1, the size of the first sub-data D0 is 5 bytes, and the memory size of several storage units is 8 bits, then 5 registers are needed Storing the first sub-data D0, the last writing position is 5×1=5 when writing data into several storage units for the first time, that is, the writing position is the fifth register mem[4]. A write pointer ①wr_ptr points to the fifth register mem[4]. Correspondingly, the initial writing position of writing data into the plurality of storage units for the second time is the sixth register mem[5].

参照图3,第二次向若干所述存储单元中写入数据时,将第二子数据D1拆分成数据D1[7:0]、数据D1[15:8]、数据D1[23:16]、数据D1[31:24]和数据D1[39:32],将数据D1[7:0]写入所述第六寄存器mem[5],将数据D1[15:8]写入所述第七寄存器mem[6],将数据D1[23:16]写入所述第八寄存器mem[7],将数据D1[31:24]写入所述第九寄存器mem[8],将数据D1[39:32]写入第十寄存器mem[9]。此时已写入所述存储单元中的子数据的数量为2,所述第一子数据D1的大小为5字节,若干所述存储单元的内存大小均为8位,则需要5个寄存器存储所述第一子数据D1,则第一次向若干所述存储单元中写入数据时最后的写入位置为5×2=10,即写入位置为第十寄存器mem[9],第二次写指针②wr_ptr指向第十寄存器mem[9]。后续向若干所述存储单元中写入数据与第一次、第二次向若干所述存储单元中写入数据的流程相同,在此不再一一赘述。Referring to Fig. 3, when data is written into several storage units for the second time, the second sub-data D1 is split into data D1[7:0], data D1[15:8], data D1[23:16] ], data D1[31:24] and data D1[39:32], write data D1[7:0] into the sixth register mem[5], and write data D1[15:8] into the The seventh register mem[6], write the data D1[23:16] into the eighth register mem[7], write the data D1[31:24] into the ninth register mem[8], write the data D1[39:32] is written into the tenth register mem[9]. Now the quantity of sub-data written in the storage unit is 2, the size of the first sub-data D1 is 5 bytes, and the memory size of several storage units is 8 bits, then 5 registers are needed Storing the first sub-data D1, the last writing position is 5×2=10 when writing data to several storage units for the first time, that is, the writing position is the tenth register mem[9]. The secondary write pointer ②wr_ptr points to the tenth register mem[9]. The subsequent writing of data into the storage units is the same as the first and second writing of data into the storage units, and will not be repeated here.

参照图3,所述目标位宽为4字节,所述位宽变换后的数据包括若干变换子数据,分别为第一变换子数据New_D0、第二变换子数据New_D1、第三变换子数据New_D2至第m-1变换子数据New_Dm。Referring to FIG. 3 , the target bit width is 4 bytes, and the data after the bit width conversion includes several transformed sub-data, which are respectively the first transformed sub-data New_D0, the second transformed sub-data New_D1, and the third transformed sub-data New_D2 Up to the m-1th transformed sub-data New_Dm.

参照图3,第一次从若干所述存储单元中读取数据时,从所述第一寄存器mem[0]中读取数据D0[7:0]赋值给数据New_D0[7:0],从所述第二寄存器mem[1]中读取数据D0[15:8]赋值给数据New_D0[15:8],从所述第三寄存器mem[2]中读取数据D0[23:16]赋值给数据New_D0[23:16],从所述第四寄存器mem[3]中读取数据D0[31:24]赋值给数据New_D0[31:24],则第一变换子数据New_D0可以表示为数据New_D0[31:0],同时也可以通过寄存器表示为mem[3:0]。所述目标位宽为4字节,若干所述存储单元的内存大小均为8位,则一次读取的存储单元的数量为4,从所述存储单元读取数据的次数为1,则第一次从若干所述存储单元中读取数据时的最后的读出位置为4×1=4,即读出位置为第四寄存器mem[3],第一次读指针rd_ptr①指向第四寄存器mem[3]。相应的,第二次从若干所述存储单元中读取数据的起始读出位置为第五寄存器mem[4]。Referring to Fig. 3, when reading data from several described storage units for the first time, read data D0[7:0] from the first register mem[0] and assign to data New_D0[7:0], from The data D0[15:8] read from the second register mem[1] is assigned to the data New_D0[15:8], and the data D0[23:16] is read from the third register mem[2] and assigned For the data New_D0[23:16], read the data D0[31:24] from the fourth register mem[3] and assign it to the data New_D0[31:24], then the first transformation sub-data New_D0 can be expressed as data New_D0[31:0] can also be expressed as mem[3:0] through registers. The target bit width is 4 bytes, and the memory size of several storage units is 8 bits, then the number of storage units read at one time is 4, and the number of times of reading data from the storage unit is 1, then the first The last readout position when reading data from several memory cells at a time is 4*1=4, promptly readout position is the 4th register mem[3], and the first read pointer rd_ptr 1. points to the 4th register mem [3]. Correspondingly, the starting reading position of reading data from several storage units for the second time is the fifth register mem[4].

参照图3,第二次从若干所述存储单元中读取数据时,从所述第五寄存器mem[4]读取数据D0[39:32]赋值给数据New_D1[7:0],从所述第六寄存器mem[5]读取数据D1[7:0]赋值给数据New_D1[15:8],从所述第七寄存器mem[6]读取数据D1[15:8]赋值给数据New_D1[23:16],从所述第八寄存器mem[7]读取数据D1[23:16]赋值给数据New_D1[31:24],则第二变换子数据New_D1可以标示为数据New_D1[31:0],同时也可以通过寄存器表示为mem[7:4]。从所述存储单元读取数据的次数为2,第一次从若干所述存储单元中读取数据时的最后的读出位置为4×2=4,即读出位置为第八寄存器mem[7],第二次读指针rd_ptr②指向第八寄存器mem[7]。后续从若干所述存储单元中读取数据与第一次、第二次从若干所述存储单元中读取数据的流程相同,在此不再一一赘述。With reference to Fig. 3, when reading data from several described storage units for the second time, read data D0[39:32] from the fifth register mem[4] and assign to data New_D1[7:0], from all The sixth register mem[5] reads data D1[7:0] and assigns it to data New_D1[15:8], reads data D1[15:8] from the seventh register mem[6] and assigns it to data New_D1 [23:16], read data D1[23:16] from the eighth register mem[7] and assign it to data New_D1[31:24], then the second converted sub-data New_D1 can be marked as data New_D1[31: 0], and can also be expressed as mem[7:4] through registers. The number of times to read data from the storage unit is 2, and the last read position when reading data from several storage units for the first time is 4×2=4, that is, the read position is the eighth register mem[ 7], the second read pointer rd_ptr② points to the eighth register mem[7]. The subsequent reading of data from several storage units is the same as the process of reading data from several storage units for the first time and the second time, and will not be repeated here.

一些实施例中,当所述存储单元写满数据后被读空,则可以继续写入新的子数据。例如,参照图3,当所述第六十四寄存器mem[63]被写满,且所述第一寄存器mem[0]中的数据被读出,则所述第一寄存器mem[0]可以作为所述第六十四寄存器mem[63]的下一个寄存器使用,继续写入新的子数据。In some embodiments, when the storage unit is read empty after being filled with data, new sub-data can be continuously written. For example, referring to FIG. 3, when the sixty-fourth register mem[63] is filled, and the data in the first register mem[0] is read, the first register mem[0] can be Used as the next register of the sixty-fourth register mem[63], continue to write new sub-data.

一些实施例中,第一次从若干所述存储单元中读取数据可以在第一次向若干所述存储单元中写入数据后,也可以在第二次向若干所述存储单元中写入数据后,取决于是否能完成一次数据位宽的转换。In some embodiments, after reading data from several storage units for the first time, after writing data to several storage units for the first time, it is also possible to write data to several storage units for the second time. After the data, it depends on whether a conversion of the data bit width can be completed.

虽然在上文中详细说明了本发明的实施方式,但是对于本领域的技术人员来说显而易见的是,能够对这些实施方式进行各种修改和变化。但是,应理解,这种修改和变化都属于权利要求书中所述的本发明的范围和精神之内。而且,在此说明的本发明可有其它的实施方式,并且可通过多种方式实施或实现。Although the embodiments of the present invention have been described in detail above, it will be apparent to those skilled in the art that various modifications and changes can be made to the embodiments. However, it should be understood that such modifications and changes are within the scope and spirit of the present invention described in the claims. Furthermore, the invention described herein is capable of other embodiments and of being practiced or carried out in various ways.

Claims (10)

1.一种数据位宽变换方法,其特征在于,包括:1. A data bit width conversion method, characterized in that, comprising: 将位宽待变换数据按照预设位宽进行拆分,以依次写入若干存储单元,所述位宽待变换数据包括若干子数据,所述子数据的大小为m字节,m为大于0的整数;Splitting the data to be converted according to the preset bit width to sequentially write into several storage units, the data to be converted by the bit width includes several sub-data, the size of the sub-data is m bytes, and m is an integer greater than 0 ; 按照目标位宽依次从若干存储单元中读取数据进行拼接,以得到位宽变换后的数据。According to the target bit width, the data is sequentially read from several storage units for splicing, so as to obtain the data after the bit width conversion. 2.根据权利要求1所述的数据位宽变换方法,其特征在于,所述将位宽待变换数据按照预设位宽进行拆分,以依次写入若干存储单元,包括:2. The data bit width conversion method according to claim 1, wherein said data to be converted in bit width is split according to a preset bit width, so as to write into several storage units sequentially, comprising: 将所述子数据拆分成m个8位的数据,以依次写入m个存储单元中。The sub-data is split into m pieces of 8-bit data to be sequentially written into the m storage units. 3.根据权利要求1所述的数据位宽变换方法,其特征在于,还包括有效数据深度计算步骤,所述有效数据深度计算步骤包括:3. The data bit width conversion method according to claim 1, further comprising an effective data depth calculation step, the effective data depth calculation step comprising: 根据写入位置和读出位置计算得到有效数据深度。The effective data depth is calculated according to the writing position and the reading position. 4.根据权利要求3所述的数据位宽变换方法,其特征在于,还包括写入位置计算步骤,所述写入位置计算步骤包括:4. The data bit width conversion method according to claim 3, further comprising a write position calculation step, the write position calculation step comprising: 根据所述存储单元中已写入的子数据的数量、所述子数据的大小以及所述存储单元的内存大小,得到写入位置。The writing position is obtained according to the quantity of sub-data written in the storage unit, the size of the sub-data and the memory size of the storage unit. 5.根据权利要求3所述的数据位宽变换方法,其特征在于,还包括读出位置计算步骤,所述读出位置计算步骤包括:5. The data bit width conversion method according to claim 3, further comprising a readout position calculation step, the readout position calculation step comprising: 根据从所述存储单元读取数据的次数、所述目标位宽以及所述存储单元的内存大小,得到读出位置。The readout position is obtained according to the times of reading data from the storage unit, the target bit width and the memory size of the storage unit. 6.根据权利要求1~5任意一项所述的数据位宽变换方法,其特征在于,所述存储单元的内存大小为8位。6. The data bit width conversion method according to any one of claims 1-5, characterized in that the memory size of the storage unit is 8 bits. 7.一种数据位宽变换系统,其特征在于,包括若干存储单元、写入控制单元和读出控制单元,所述写入控制单元用于将位宽待变换数据按照预设位宽进行拆分,以依次写入若干所述存储单元,所述位宽待变换数据包括若干子数据,所述子数据的大小为m字节,m为大于0的整数;所述读出控制单元用于按照目标位宽依次从若干存储单元中读取数据进行拼接,以得到位宽变换后的数据。7. A data bit width conversion system, characterized in that it includes several storage units, a write control unit and a read control unit, the write control unit is used to split the bit width to be converted data according to the preset bit width , to sequentially write into several storage units, the bit width to be converted data includes several sub-data, the size of the sub-data is m bytes, and m is an integer greater than 0; the read control unit is used for according to the target The bit width sequentially reads data from several storage units and splicing to obtain the data after bit width conversion. 8.根据权利要求7所述的数据位宽变换系统,其特征在于,还包括有效数据深度计算单元,用于根据写入位置和读出位置计算得到有效数据深度。8. The data bit width conversion system according to claim 7, further comprising an effective data depth calculation unit, configured to calculate and obtain the effective data depth according to the writing position and the reading position. 9.根据权利要求8所述的数据位宽变换系统,其特征在于,还包括写入位置计算单元,根据所述存储单元中已写入的子数据的数量、所述子数据的大小以及所述存储单元的内存大小,得到写入位置。9. The data bit width conversion system according to claim 8, further comprising a write position calculation unit, based on the number of sub-data written in the storage unit, the size of the sub-data and the The memory size of the above storage unit is obtained to obtain the write location. 10.根据权利要求8所述的数据位宽变换系统,其特征在于,还包括读出位置计算单元,根据从所述存储单元读取数据的次数、所述目标位宽以及所述存储单元的内存大小,得到读出位置。10. The data bit width conversion system according to claim 8, further comprising a read position calculation unit, based on the number of times data is read from the storage unit, the target bit width, and the storage unit Memory size, get the read position.
CN202310215241.7A 2023-03-06 2023-03-06 Data bit width conversion method and system Pending CN116204461A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310215241.7A CN116204461A (en) 2023-03-06 2023-03-06 Data bit width conversion method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310215241.7A CN116204461A (en) 2023-03-06 2023-03-06 Data bit width conversion method and system

Publications (1)

Publication Number Publication Date
CN116204461A true CN116204461A (en) 2023-06-02

Family

ID=86517065

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310215241.7A Pending CN116204461A (en) 2023-03-06 2023-03-06 Data bit width conversion method and system

Country Status (1)

Country Link
CN (1) CN116204461A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117194281A (en) * 2023-09-05 2023-12-08 上海芯炽科技集团有限公司 Asymmetric access method for variable-length data in ASIC
CN118535487A (en) * 2024-04-24 2024-08-23 原粒(北京)半导体技术有限公司 Data storage and data reading method, device, electronic device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102012876A (en) * 2010-11-19 2011-04-13 中兴通讯股份有限公司 Big bit width data writing and reading method and controller
CN110554886A (en) * 2018-05-30 2019-12-10 赛灵思公司 Data splitting structure, method and on-chip implementation thereof
CN113094309A (en) * 2019-12-23 2021-07-09 深圳市中兴微电子技术有限公司 Data bit width conversion method and device
CN113485647A (en) * 2021-07-13 2021-10-08 湖南国科微电子股份有限公司 Data writing method, data reading method and first-in first-out memory
CN114265796A (en) * 2021-11-22 2022-04-01 四川和芯微电子股份有限公司 RAM read-write control method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102012876A (en) * 2010-11-19 2011-04-13 中兴通讯股份有限公司 Big bit width data writing and reading method and controller
CN110554886A (en) * 2018-05-30 2019-12-10 赛灵思公司 Data splitting structure, method and on-chip implementation thereof
CN113094309A (en) * 2019-12-23 2021-07-09 深圳市中兴微电子技术有限公司 Data bit width conversion method and device
CN113485647A (en) * 2021-07-13 2021-10-08 湖南国科微电子股份有限公司 Data writing method, data reading method and first-in first-out memory
CN114265796A (en) * 2021-11-22 2022-04-01 四川和芯微电子股份有限公司 RAM read-write control method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117194281A (en) * 2023-09-05 2023-12-08 上海芯炽科技集团有限公司 Asymmetric access method for variable-length data in ASIC
CN118535487A (en) * 2024-04-24 2024-08-23 原粒(北京)半导体技术有限公司 Data storage and data reading method, device, electronic device and storage medium

Similar Documents

Publication Publication Date Title
CN116204461A (en) Data bit width conversion method and system
US11269529B2 (en) Neural network data processing apparatus, method and electronic device
US20100299460A1 (en) Buffer manager and buffer management method based on address pointer linked list
US7979629B2 (en) Memory module and control method of serial peripheral interface using address cache
CN107395565B (en) Serial port receiving preprocessing method under fixed-length single byte format message protocol
CN115577149B (en) Data processing method, device and equipment and readable storage medium
US7111289B2 (en) Method for implementing dual link list structure to enable fast link-list pointer updates
WO2023155531A1 (en) Data read-write method and apparatus and related device
CN105207678A (en) Hardware realizing system for improved LZ4 compression algorithm
US9292549B2 (en) Method and system for index serialization
WO2017177704A1 (en) Method for communication between edma devices having different bandwidths in multi-core dsp
CN116107959A (en) Caching method, image transmission method, electronic device and storage medium
US10489322B2 (en) Apparatus and method to improve performance in DMA transfer of data
US7769965B2 (en) Data processing with data transfer between memories
CN110351562A (en) A kind of 10 bit YUV image storage formats
CN116804915B (en) Data interaction method, processor, device and medium based on memory
CN116166185A (en) Caching method, image transmission method, electronic device and storage medium
CN108681516A (en) The method for promoting MIPI protocol layer transmission speeds, the MIPI interface and computer readable storage medium quickly transmitted
US10853123B2 (en) Memory module
CN105263023A (en) Network code stream real-time receiving method based on high-speed decoding platform
CN101425962B (en) Packet forwarding method and apparatus
US11513852B2 (en) Data transferring apparatus and method for transferring data with overlap
WO2024113448A1 (en) Method and apparatus for processing data block of flexible ethernet, storage medium, and electronic device
JP2000137674A (en) Burst transfer memory mapped register
CN118035162A (en) Data transmission method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination