The present invention is directed, in general, to computer systems and, more specifically, to an endian mapping engine, a method of endian mapping and a processing system employing the engine or the method.
Endianness refers to the ordering of bytes of data in a multi-byte wide memory, or the sequence in which the bytes are transmitted over some medium usually when the data contains multiple bytes. There are different endian schemes supported by processors, buses, and peripherals today, which include byte invariant, word invariant and double-word invariant endian schemes. In little endian format, the least significant byte of data is stored in the lowest memory address in the range of addresses used to store the quantity. Alternatively, in big endian format, the most significant byte of data is stored in the lowest memory address in the range of addresses used to store the quantity. In little endian format, the bytes are steered to the same byte lanes for the same address when employing each of these three endian schemes. For big endian format, however, the bytes are located in different byte lanes for the same address based on the endian scheme used.
Typically the processor, bus and peripherals for a processing system design use the same endian scheme whether it is byte, word or double-word invariant. For example, the processing system using an ARM9 processor, AMBA AHB/APB buses and associated peripherals would be designed to use a word invariant endian scheme throughout. However, by limiting the processing system design to one endiah scheme, advantages afforded by using different bus architectures and processor features to improve overall performance of the system may be sacrificed. Alternatively, for example, an application may advantageously employ a processing system having the MIPS processor using double-word invariant, the ARM Ltd. AMBA AXI bus using byte invariant, and the ARM Ltd. AMBA AHB/APB buses using word invariant endian schemes.
Additionally, by limiting the processing system design to components of the same endian scheme, time-to-market constraints may arise in addition to performance issues. For example, various peripherals may have been developed and maintained that already use one or more of a particular endian format and scheme. The capability to reuse these peripherals with a variety of processing system designs eliminates redesign and verification efforts thereby reducing both time-to-market concerns and development costs.
Accordingly, what is needed in the art is a way to resolve different endian schemes and formats used by various components of a processing system.
To address the above-discussed deficiencies of the prior art, the present invention provides an endian mapping engine for use with a processing system. In one embodiment, the endian mapping engine includes an identification unit configured to identify sending and receiving endian schemes for data transfers between components of the processing system. Additionally, the endian mapping engine also includes a conversion unit coupled to the identification unit and configured to convert the data transfers between the sending and receiving endian schemes corresponding to an employed endian format. In an alternative embodiment, the endian mapping engine further includes a multiplexing unit coupled to the identification unit and configured to provide multiplexing between endian formats for a given endian scheme.
In another aspect, the present invention provides a method of endian mapping for use with a processing system. The method includes identifying sending and receiving endian schemes for data transfers between components of the processing system and converting the data transfers between the sending and receiving endian schemes corresponding to an employed endian format.
The present invention also provides, in yet another aspect, a processing system including a processor block employing at least one processing unit, an interconnect block, coupled to the processor block, employing an input-output bus and a peripheral block, coupled to the interconnect block, employing at least one peripheral. The processing system also includes an endian mapping engine coupled to the processor, interconnect and peripheral blocks having an identification unit that identifies sending and receiving endian schemes for data transfers between components of the processing system. The endian mapping engine also has a conversion unit, coupled to the identification unit, which converts the data transfers between the sending and receiving endian schemes corresponding to an employed endian format.
The foregoing has outlined preferred and alternative features of the present invention so that those skilled in the art may better understand the detailed description of the invention that follows. Additional features of the invention will be described hereinafter that form the subject of the claims of the invention. Those skilled in the art should appreciate that they can readily use the disclosed conception and specific embodiment as a basis for designing or modifying other structures for carrying out the same purposes of the present invention. Those skilled in the art should also realize that such equivalent constructions do not depart from the spirit and scope of the invention.
For a more complete understanding of the present invention, reference is now made to the following descriptions taken in conjunction with the accompanying drawings, in which:
Referring initially to
The processor block 105 employs at least one processor and may employ a plurality of processors as appropriate to a particular application. The interconnect block 110 is coupled to the processor block 105 and typically employs a plurality of input-output buses although only one may be required. The peripheral block 115 is coupled to the interconnect block 110 and employs at least one peripheral wherein a plurality is usually required.
The endian mapping engine 120 is coupled to the processor, interconnect and peripheral blocks 105, 110, 115. The identification unit 121 identifies sending and receiving endian schemes for data transfers between components of the processing system 100. The conversion unit 122 is coupled to the identification unit 121 and converts the data transfers between the sending and receiving endian schemes corresponding to an employed endian format. The multiplexing unit 123 is coupled to the identification unit 121 and provides multiplexing between endian formats, when both big and little endian formats are not employable for a given endian scheme.
The endian scheme employed for data transfers is selected from the group consisting of byte invariant, half-word invariant, word invariant and double-word invariant Additionally, the endian format is selected from the group consisting of a little endian format and a big endian format. In general, each of the sending and receiving endian schemes may be identified employing at least one of a static and a dynamic endianness signal, usually indicated by the processor block 105. In the illustrated embodiment, each component of the processing system 100 sends and receives data employing its native endian scheme.
Byte invariant means that a byte transfer to a given address passes the eight bits of data on the same data bus wires to the same address location regardless of endianness. Therefore, for a given transaction request size (i.e., byte, half-word or word) in a byte invariant system, the address of each byte of memory remains unchanged when switching between little endian and big endian operation. Alternatively, in a word invariant system, the address of each byte of memory changes when switching between little and big endian operation, but words stored in a multiword address would not change between big and little endian.
Additionally, byte steering is employed to convert the data transfers between the sending and receiving endian schemes. In the illustrated embodiment, the byte steering corresponds to the big endian format and the processing block 105 has a processor that employs a hardware signal to indicate the use of the big endian format.
Turning now to
For more information regarding the commercially available components shown in
The MIPS processor 206 has an input static signal to configure the core to support big or little endian. Table 1 shows endian byte lane usage for the MIPS processor 206. Table 1 shows that the MIPS processor 206 supports a double-word invariant endian scheme since the data is identical for 64-bit transfers for both big and little endian formats. The differences with respect to endianness are only visible for sub-double-word references.
The OCP bus 208 is endian-neutral, since the master and slave are the same bus width, in the illustrated embodiment. OCP addressing in this system is on a double-word granularity. For a 64-bit data bus width, the lower three bits of the address are always ignored. The OCP MAddr signal is aligned with this 64-bit word size.
The AXI bus (ARM Ltd.) uses a byte invariant endian scheme and is not endian-neutral like the OCP bus 208. The read address channel does not have byte strobes, but uses the lower three address bits and the ARSIZE signal to determine where the bytes should be steered. The write address channel uses write strobes (byte enables), the lower three address bits and the AWSIZE signal. For write operations, the AXI slave may use either the write strobes or address and AWSIZE information to determine where the bytes should be steered.
The AHB and APB buses (ARM Ltd.) use a word invariant endian scheme, where a word in this bus architecture is considered to be 32-bits wide. Word transfers are identical using big or little endian formats. The differences with respect to endianness are only visible for sub-word references. For AHB and APB buses of 64-bits wide, the data are treated as individual 32-bit wide units.
In the illustrated embodiment of
LE-64 refers to double-word invariant little endian,
LE-32 refers to word invariant little endian,
LE-8 refers to byte invariant little endian,
BE-64 refers to double-word invariant big endian,
BE-32 refers to word invariant big endian, and
BE-8 refers to byte invariant big endian.
In little endian format, the least significant byte is stored in the lowest memory address in the range of addresses used to store the quantity. Table 2, Table 3, Table 4, and Table 5 show how the byte lanes are specified using the lower address bits for byte, half-word, word, and double-word accesses for LE-8, LE-32 and LE-64. In these tables, the numbers 0-7 represent byte, half-word, word or double-word associated with that part of the data bus where 0 represents the least significant and 7 the most significant. For example, in Table 2 when transferring a byte of data to address[2:0]=b000, byte lane 7:0 is used for LE-8, 7:0 for LE-32 and 7:0 for LE-64. When transferring a byte of data to address[2:0]=b111, byte lane 63:56 is used for LE-8, LE-32 and LE-64.
1Byte 0 is accessed with Addr [2:0] = b000, Byte 1 is accessed with Addr[2:0] = b001, Byte 2 is accessed with Addr[2:0] = b010, Byte 3 is accessed with Addr[2:0] = b011, Byte 4 is accessed with Addr[2:0] = b100, Byte 5 is accessed with Addr[2:0] = b101, Byte 6 is accessed with Addr[2:0] = b110, Byte 7 is accessed with Addr[2:0] = b111
1Half-word 0 is accessed with Addr[2:0] = b000, Half-word 1 is accessed with Addr[2:0] = b010, Half-word 2 is accessed with Addr[2:0] = b100, Half-word 3 is accessed with Addr[2:0] = b110
1Word 0 is accessed with Addr[2:0] = b000, Word 1 is accessed with Addr[2:0] = b100
1Double-word 0 is accessed with Addr[2:0] = b000
Table 6 specifies the conversion between the byte, word and double-word invariant endian schemes for little endian formats. The relationship of byte lane to lower address bits (Addr[2:0]) and transfer size (A*SIZE, HSIZE) specified in Tables 2, 3, 4, and 5 are applied to Table 6. Table 6 uses the following values for byte, half-word, word and double-word examples:
byte=0x0
half word=0x10
word:=0x3210
double-word=0x76543210
Table 6 shows that no byte steering is needed to convert between byte, word and double-word invariant endian schemes for little endian formats. For the same address, byte enables, AWSIZE, ARSIZE and HSIZE settings, the bytes of data are placed in the same byte lanes for each endian scheme.
1Byte En represents the OCP and AXI bus byte enables or write strobes depending on the bus terminology. Each active high bit represents a valid byte.
2A*SIZE represents the AXI signals AWSIZE and ARSIZE that represent the write and read burst size respectively. HSIZE is the AHB bus burst size indicator. 000 = byte, 001 = half-word, 010 = word, and 011 = double-word transfers.
In big endian format, the most significant byte is stored in the lowest memory address in the range of addresses used to store the quantity. Table 7, Table 8, Table 9 and Table 10 show how the byte lanes are specified using the lower address bits for byte, half-word, word and double-word accesses for BE-8, BE-32 and BE-64. In these tables, the numbers 0-7 represent byte, half-word, word or double-word associated with that part of the data bus where 0 represents the least significant and 7 the most significant, as before. For example, in Table 7 when transferring a byte of data to address[2:0]=b000, byte lane 7:0 is used for BE-8, 31:24 for BE-32 and 63:56 for BE-64. When transferring a byte of data to address[2:0]=b111, byte lane 63:56 is used for BE-8, 39:32 for BE-32 and 7:0 for BE-64.
1Byte 0 is accessed with Addr[2:0] = b000, Byte 1 is accessed with Addr[2:0] = b001, Byte 2 is accessed with Addr[2:0] = b010, Byte 3 is accessed with Addr[2:0] = b011, Byte 4 is accessed with Addr[2:0] = b100, Byte 5 is accessed with Addr[2:0] = b101, Byte 6 is accessed with Addr[2:0] = b110, Byte 7 is accessed with Addr[2:0] = b111
1Half-word 0 is accessed with Addr[2:0] = b000, Half-word 1 is accessed with Addr[2:0] = b010, Half-word 2 is accessed with Addr[2:0] = b100, Half-word 3 is accessed with Addr[2:0] = b110
1Word 0 is accessed with Addr[2:0] = b000, Word 1 is accessed with Addr[2:0] = b100
1Double-word 0 is accessed with Addr[2:0] = b000
Table 11 specifies the conversion between the byte, word and double-word invariant endian schemes for big endian formats. The relationship of byte lane to lower address bits (Addr[2:0]) and transfer size (A*SIZE, HSIZE) specified in Tables 7, 8, 9 and 10 are applied to Table 11. Table 11 uses the following values for byte, half-word, word, and double-word examples:
byte=0x0
half word=0x10
word:=0x3210
double-word=0x76543210
Table 11 clearly shows that byte steering is needed to convert between byte, word and double-word invariant endian schemes for big endian formats. For the same address, byte enables, A*SIZE and HSIZE settings, the data bytes are placed in different byte lanes for each endian scheme.
1Byte En represents the OCP and AXI bus byte enables or write strobes depending on the bus terminology. Each active high bit represents a valid byte.
2A*SIZE represents the AXI signals AWSIZE and ARSIZE that represent the write and read burst size respectively. HSIZE is the AHB bus burst size indicator. 000 = byte, 001 = half-word, 010 = word, and 011 = double-word transfers.
Table 12, Table 13, Table 14, Table 15, Table 16, Table 17, and Table 18 show examples of byte, half-word, word and double-word transfers employing a little endian format from the MIPS processor to the AHB/APB bus. For these examples the following values are used:
byte=0xef
half-word=0xcdef
word=0x89abcdef
double-word=0x0123456789abcdef
Table 19, Table 20, Table 21, Table 22, Table 23, Table 24, and Table 25 show examples of byte, half-word, word, and double-word transfers employing a big endian format from the MIPS processor to the AHB/APB bus. For these examples the following values are used:
byte=0xef
half-word=0xcdef
word=0x89abcdef
double-word=0x0123456789abcdef
Tables 19, 20, 21, 22, 23, 24, and 25 show that the boundaries between the different endian schemes are between double-word to byte invariant at the OCP to AXI bridge and byte to word invariant at the BP137-AXI to AHB-lite bridge. The MIPS processor 206 double-word invariant endian scheme rides on the endian-neutral OCP bus 208 transparently. It needs to be converted to AXI byte invariant endian scheme. A reasonable place to do this is in the Ocp2Axi bridge since this is the point where the data transitions between the double-word and byte invariant endian schemes.
The Ocp2Axi bridge 207 will perform the double-word to byte invariant endian scheme conversion. For little endian systems specified with the input signal BIGEND being low, no byte steering will be performed. For big endian systems specified with the input signal BIGEND being high, the following byte steering will take place for read and write data:
Byte 0 to Byte 7,
Byte 1 to Byte 6,
Byte 2 to Byte 5,
Byte 3 to Byte 4,
Byte 4 to Byte 3,
Byte 5 to Byte 2,
Byte 6 to Byte 1, and
Byte 7 to Byte 0.
The AXI byte invariant endian scheme needs to be converted to AHB/APB word invariant endian scheme. A reasonable place to do this is after the BP137-AXI to AHB-lite Bridge, since this is where the data transitions between byte and word invariant endian schemes. A block called AhbEndian is placed next to the BP137-AXI to AHB-lite Bridge, as shown in
Byte 0 to Byte 3,
Byte 1 to Byte 2,
Byte 2 to Byte 1,
Byte 3 to Byte 0,
Byte 4 to Byte 7,
Byte 5 to Byte 6,
Byte 6 to Byte 5, and
Byte 7 to Byte 4.
The APB Endian Mux (multiplexer), shown in
Turning now to
In a step 315, the data transfers are converted between the sending and receiving endian schemes corresponding to an endian format employed by the respective endian schemes. Each of the sending and receiving endian schemes may be identified employing at least one of a static and a dynamic endianness signal. The endian format is selected from the group consisting of a little endian format and a big endian format. In the illustrated embodiment, byte steering is employed to convert the data transfers between the sending and receiving endian schemes that correspond to a big endian format. The big endian format may be indicated by employing a hardware signal. Where a little endian format is employed, byte steering is not required. This action allows each component of the processing system to send and receive data employing its native endian scheme. In the illustrated embodiment, a step 320 further includes providing multiplexing between endian formats, when both big and little endian formats are not supported for a given endian scheme. The method 300 ends in a step 325.
While the method disclosed herein has been described and shown with reference to particular steps performed in a particular order, it will be understood that these steps may be combined, subdivided, or reordered to form an equivalent method without departing from the teachings of the present invention. Accordingly, unless specifically indicated herein, the order or the grouping of the steps is not a limitation of the present invention.
In summary, embodiments of the present invention employing an endian mapping engine, a method of endian mapping and a processing system employing the engine or the method have been presented. Advantages include the ability for each component in the processing system to send and receive data using its native double-word, word, half-word or byte invariant endian scheme. Additionally, both big and little endian formats may be supported. When employing a big endian format, byte steering is required when crossing an endian scheme boundary in the processing system. Embodiments of the present invention allow performance enhancements and time-to-market advantages to be achieved by tailoring a differing endianness collection of components to form the processing system.
Although the present invention has been described in detail, those skilled in the art should understand that they can make various changes, substitutions and alterations herein without departing from the spirit and scope of the invention in its broadest form.