Search Images Maps Play YouTube News Gmail Drive More »
Sign in
Screen reader users: click this link for accessible mode. Accessible mode has the same essential features but works better with your reader.

Patents

  1. Advanced Patent Search
Publication numberUS5519842 A
Publication typeGrant
Application numberUS 08/023,560
Publication dateMay 21, 1996
Filing dateFeb 26, 1993
Priority dateFeb 26, 1993
Fee statusPaid
Publication number023560, 08023560, US 5519842 A, US 5519842A, US-A-5519842, US5519842 A, US5519842A
InventorsDeif N. Atallah, Yan Xu
Original AssigneeIntel Corporation
Export CitationBiBTeX, EndNote, RefMan
External Links: USPTO, USPTO Assignment, Espacenet
Method and apparatus for performing unaligned little endian and big endian data accesses in a processing system
US 5519842 A
Abstract
A system which is able to perform unaligned big endian and little endian accesses to memory with little or no added overhead to the system. In the preferred embodiment, the processor operates in little endian data format. The memory, however, can store data in big endian and little endian format in different memory regions. If an unaligned access is to be performed, the access requires translation to corresponding aligned memory accesses. However, if the processor operates in little endian format and accesses are to memory which store according big endian format, special code is required to perform proper translation of accesses. When the address generation unit of the processor detects an unaligned memory access, an unaligned signal is set which causes a microassist to initiate a microflow to execute microcode which performs the necessary translations for unaligned accesses. The address generation unit also sends the address to be access to the memory region table which maintains information regarding each memory region, including whether the region is big endian or little endian. The state bit indicative of the data format is logically combined with the unaligned access signal to generate an output which sets the state of the flag. The flag is then accessed by the microcode to determine the translation routine to process the memory access.
Images(5)
Previous page
Next page
Claims(12)
What is claimed is:
1. A processing system comprising a main processor and at least one peripheral device coupled to the main processor by a bus, said main processor processing data in a first data order, said peripheral device comprising memory, said memory divided up into regions according to addresses, said system maintaining a memory region table, each entry in the table providing identifying characteristics regarding a region of memory including whether the data is addressed in a first data order or a second data order, said processing system further comprising:
means for detecting a memory access in unalignment with a data boundary of memory and issuing an unaligned access signal;
means for accessing a state bit in the memory region table indicative of the data order of the region of memory to be accessed;
means for setting a flag to a value if the unaligned access signal is issued and the state bit accessed indicates that the region is addressed in the second data order;
means for executing an unaligned service routine upon issuance of the unaligned access signal, said unaligned service routine checking the state of the flag to determine whether the access is to be performed as an unaligned access of a first data order or an unaligned access of a second data order;
wherein the detection of the an unaligned access of a second data order is available to the unaligned access service routine.
2. The processing system as set forth in claim 1, wherein the means for detecting a memory access comprises an address generation unit.
3. The processing system as set forth in claim 1, wherein the means for accessing a state bit comprises an address generation unit which issues a memory address of the access to the memory region table.
4. The processing system as set forth in claim 1, wherein the means for setting a flag comprises a logical AND means which receives as input the state bit and the unaligned access signal.
5. The processing system as set forth in claim 1, wherein said means for executing an unaligned service routine comprises a microassist which initiates microcode to be executed to perform unaligned accesses.
6. The processing system as set forth in claim 4, wherein the output of the logical AND means is latched to retain the value of the flag.
7. A processing system comprising a main processor and at least one peripheral device coupled to the main processor by a bus, said main processor processing data in little endian data format, said peripheral device comprising memory, said memory divided up into regions according to addresses, said system maintaining a memory region table, each entry in the table providing identifying characteristics regarding a region of memory including whether the data is addressed in little endian data format or big endian data format, said processing system further comprising:
an address generation unit for detecting a memory access which is unaligned with data boundaries of memory and issuing an unaligned access signal, said address generation unit further issuing the address of the memory access to the memory region table;
said memory region table outputting the entry for the address of memory received;
logic means for combining a data format state bit indicative of the entry output from the memory region table and the unaligned access signal such that if the data format state bit indicates that the data is accessed in big endian format and the unaligned access signal has been issued, a signal denoting this case is set;
logic coupled to receive the signal output from the logic means to store a value in a flag; and
means for executing code in the processor upon issuance of the unaligned access signal, said code checking the value of the flag to determine whether unaligned big endian access or unaligned little endian access is to be performed;
wherein the detection of the an unaligned big endian access is available to the code.
8. The processing system as set forth in claim 7, wherein the logic means comprises a logical AND gate.
9. The processing system as set forth in claim 7, wherein the code comprises microcode and the means for executing code comprises microflow.
10. In a processing system comprising a main processor and at least one peripheral device coupled to the main processor by a bus, said main processor processing data in a first data order, said peripheral device comprising memory, said memory divided up into regions according to addresses, said system maintaining a memory region table, each entry in the memory region table providing identifying characteristics regarding a region of memory including whether the data is addressed in a first data order or second data order, a method for performing unaligned accesses to memory addressed in a first data order and a second data order, comprising the steps of:
detecting a memory access in unaligned with a data boundary of memory;
issuing an unaligned access signal;
accessing a state bit in the memory region table indicative of the data order of the region of memory to be accessed;
setting a flag if the unaligned access signal is issued and the state bit accessed indicates that the region is addressed in the second data order;
executing an unaligned service routine upon issuance of the unaligned access signal, said unaligned service routine checking the state of the flag to determine whether the access is to be performed as an unaligned access of a first data order or an unaligned access of a second data order;
wherein the detection of the an unaligned access of a second data order is available to the unaligned access service routine.
11. The method as set forth in claim 10, wherein the step of setting the flag comprises the step of logically combining the unaligned access signal and the state bit, and storing the output of the logical combining of signals as the flag.
12. The method as set forth in claim 11 wherein the step of storing the output of the logical combining of signals comprises latching the output of the logical combining of signals.
Description
BACKGROUND OF THE INVENTION

1. Field of the invention

The present invention relates to unaligned accesses to data. More particularly, the present invention relates to unaligned accesses to data addressed in little endian and big endian format.

2. Art Background

Byte ordering determines how data is read from or written to memory and buses and ultimately how data is stored in the memory. The two byte ordering types are referred to as little endian and big endian. Little endian systems store words in which the least significant byte is at the lowest address in memory. For example, a little endian ordered word is stored at address 600. The least significant byte is stored at address 600 and the most significant byte at address 603. Big endian systems store the least significant byte at the highest byte address in memory. Therefore, if a big endian ordered word consisting of four bytes is stored at address 600, the least significant byte is stored at address 603 and the most significant byte at address 600.

Another factor to consider when addressing memory to access is whether the address is aligned or unaligned. Aligned data requests provide an address that occurs on a data type's natural boundary. Quad words and triple words are lined on 16 byte boundaries, double words on 8 byte boundaries, words on 4 byte boundaries, short words (half-words) on 2 byte boundaries, and bytes on 1 byte boundaries. Unaligned requests do not occur on these natural boundaries.

Any aligned request to a memory region is executed without modification of the access request. When the processor encounters an unaligned request, microcode breaks the unaligned request into a series of aligned requests. For example, if a read request is issued to read a little endian word from address XXXXXXX1H (unaligned), the request is executed as a byte request followed by a short request followed by a byte request. FIG. 1 illustrates how aligned and unaligned bus transfers may be carried out for memory regions that use little endian ordering.

Typically, a processor will operate in either a little endian or big endian mode and the bus attached to the processor operates in the same mode. Although some processors can operate either in the big endian mode or little endian mode, most processors typically operate in one mode and perform a translation of data received from an output to memory or other external devices prior to input to the processor. For example, processors manufactured by Intel Corporation use little endian format internally. Therefore, the processor performs operations in little endian format and likewise the internal bus which connects the processor is also little endian. Translations are performed prior to the input to the processor, for example at the bus controller, so that the addressing information is in the proper format prior to receipt by the processor.

Although translation of addresses from big endian to little endian is not immediately cumbersome, a translation of formats in conjunction with unaligned data transfers can be quite complex. Processors which support both little endian and big endian modes are able to maintain relative simplicity in translation of the data from unaligned to aligned requests. However, for processors that operate in one mode and perform translations from the second mode, the system incurs a significant cost and/or performance penalty if both modes are accepted. Many systems simply do not support unaligned accesses in the alternate data format. If a system is able to support both data format modes, the second mode is supported by causing an exception or fault and initiating specialized software to address the alignment translation for each mode. However, this significantly adds to processing overhead. Alternately, it is conceivable that specially designed hardware may be developed to handle both aligned and unaligned accesses in both modes. Such an approach however, is quite expensive due to the amount of hardware that would be required.

SUMMARY OF THE INVENTION

The present system provides for data accesses in unaligned and aligned big endian and little endian formats. The processor itself operates in a first format, for example, little endian format. Therefore, aligned and unaligned accesses generated by the processor and input through the bus and bus controller are fairly straight forward. However, accesses in a second format, for example, big endian accesses, particularly unaligned big endian accesses, are quite difficult. In the present invention a hardware flag and microcode are used to branch to different microflows to handle either case of unaligned little endian accesses or unaligned big endian accesses in a timely manner. This method provides this capability with little increase in processor overhead or construction cost.

BRIEF DESCRIPTION OF THE DRAWINGS

The objects, features and advantages of the present invention will become apparent to one skilled in the art in view of the following detailed description in which:

FIG. 1 illustrates an exemplary unaligned accesses and their corresponding sequence of aligned data accesses.

FIG. 2 illustrates an exemplary system of the present invention.

FIG. 3 illustrates one embodiment of the processor of the present invention.

FIG. 4 illustrates the generation of the hardware flag in one embodiment of the present invention.

FIG. 5 is a flowchart which illustrates the process implemented in the system of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

In the following description for purposes of explanation, numerous details are set forth in order to provide a thorough understanding of the present invention. However, it will be apparent to one skilled in the art that these specific details are not required in order to practice the present invention. In other instances well known electrical structures and circuits are shown in block diagram form in order not to obscure the present invention unnecessarily.

An exemplary system which performs unaligned address translations of addresses in big endian and little endian format is shown in FIG. 2. The system includes a processor 10, which operates in a first format, for example, little endian format, and at least one peripheral device such as memory 30, I/O 40 and other buses and systems 50 connected via bus 20. In particular, the memory has the capability to store data in either big endian or little endian format. When a request to perform a memory access is generated, the processor will determine whether the access is to data in big endian or little endian format, whether the access is aligned or unaligned, and will perform the necessary translations if unaligned.

More particularly, referring to FIG. 3, the address generation unit (AGU) 110 detects an unaligned access. When an unaligned access is detected, the AGU 110 first stalls subsequent instructions from executing. For example, in a i960 CA processor, this is accomplished by scoreboarding the machine (see i960 CA Microprocessor Users Manual, Intel Corporation 1992), pp. A- 11-A12). The microflow executes a microcode routine to determine if the access is big endian or little endian and to perform the necessary translation. In the present embodiment, a signal is issued to the assist fault unit (AFU) 115 which creates an unaligned assist which causes the processor to branch to UBE/ULE (unaligned big endian/unaligned little endian) microcode routines. An assist is an internal mechanism which provides for microcode assistance for certain conditions which cannot be handled by the hardware.

In the preferred embodiment, the processor operates in little endian format. Therefore, in order to perform big endian unaligned accesses, these accesses will have to be determined. In order to simply and easily determine big endian unaligned accesses without incurring unnecessary hardware or processor performance overhead, a hardware flag mechanism which immediately detects unaligned big endian accesses is utilized. An exemplary mechanism is illustrated in FIG. 4.

Referring to FIG. 4, the bus controller 125 contains a memory region table 175 which typically comprises a series of registers containing various state bits relative to each region. For example, if the memory is divided into 16 regions there are 16 different entries in the table which identify the state and characteristics of a particular region. One of the state bits in each entry of the table, 180, 185, 190, 195, 200, 205, is a bit designated to identify if the section of memory is addressed in big endian or little endian format. Memory region tables are found in processors, such as the i960 CA/CF manufactured by Intel Corporation. When an access is to be performed, the AGU 110 causes the entry for the particular region of memory to be output from the memory region table 175. The state bit which identifies whether the memory region is big endian or little endian is input to a logic gate 220 which logically ANDs the unaligned signal 112 generated by the AGU 110. If the AGU detects an unaligned access to a region which the region table 175 identifies as a big endian access, a predetermined bit in the processor, herein referred to as the UNBETR flag 127 (Unaligned Access Big Endian True) is set.

Therefore, as the microcode routines for unaligned accesses is accessed and executed, the value of the UNBETR flag is determined and is available for reference by the microcode to establish if code to perform a little endian or big endian unaligned access is to be used. The UNBETR flag may be reset by a mechanism 117 initiated by the instruction of a subsequent memory access. However, preferably the UNBETR flag 127 comprises a latch which latches the output of logic gate 220.

When an unalign access is detected and a microassist is generated to branch to the microcode, the microcode first causes the alias register to be loaded by reading the unaligned register in the AGU 110 and further, saves the effective address generated by the AGU 110. The unaligned register contains the instruction (its opcode and operands) causing the unaligned access. The alias register holds the macro-flow instruction (user's code) while microcode is running. It provides the microcode a window into the operands of the macro-flow instruction. The effective address may also be accessed by the fault processing code if the processor is required to fault on an unaligned access. The dedicated hardware flag UNBETR is tested to determine if the processor branches to UBE or ULE code. If the flag is set, the UBE code is executed. As described above, this flag is coupled to the output of the unaligned accesses detect logic and the big endian/little endian bits of the memory region configuration registers in the region table located in the bus controller 125. As the external memory can be configured as a mixture of little endian and big endian memory subsystems by setting or clearing the corresponding state bit in the memory region configuration register of the region table, the present invention enables unaligned big endian and unaligned little endian accesses to be correctly and quickly handled by the processor.

In the present embodiment, it is preferred that the UBE/ULE routines are written in microcode which is accessed by the microflow of the system (see i960 CA Microprocessor Users Manual for information regarding the microflow). The microflow, based upon the type of unaligned access, performs routines that are slightly different in nature but both of which adjust the byte ordering of the data from big endian to little endian or visa versa, increments the effective address and source destination address, reissues multiple aligned accesses to the bus control unit 125 to load/store from/to the required address to/from the appropriate registers and checks to see if the processor is requested to fault on unaligned access or not. If so, the code branches to the fault microcode for continued processing.

The process flow in general is shown in FIG. 5. At step 200, the AGU detects an unaligned access. At step 210, the micro-assist located in the AFU, branches to unaligned access microflows. At step 215, the unaligned state bit is turned on, the alias register is initialized and the effective address is saved for the microcode. It is then determined whether the UNBETR flag is set 220. If it is set, then the processor branches to the unaligned big endian microcode step 225. At step 230, if the UNFLTM flag is set, control branches back to the user's code. Otherwise, there is a branch to the common-- unaligned-- exit, step 235, and an exception is issued 240. The routine "common-- unaligned-- exit" sets some parameters required by unaligned fault microcode, then branches to fault microcode and the fault handler exception. If the UNBETR flag is not set, at step 250 the unaligned little endian microcode is executed to perform unaligned little endian accesses. Similarly at step 250, if the UNFLTM flag is set, control returns to the user's code. Otherwise at steps 260 and 265, a branch to common-- unaligned-- exit occurs and an exception is issued.

The invention has been described in conjunction with the preferred embodiment. It is evident that numerous alternatives, modifications, variations and uses will be apparent to those skilled in the art in light of the forgoing description.

Patent Citations
Cited PatentFiling datePublication dateApplicantTitle
US4959779 *Nov 28, 1988Sep 25, 1990Mips Computer Systems, Inc.Dual byte order computer architecture a functional unit for handling data sets with differnt byte orders
US5107415 *Mar 31, 1989Apr 21, 1992Mitsubishi Denki Kabushiki KaishaMicroprocessor which automatically rearranges the data order of the transferred data based on predetermined order
US5132898 *Dec 20, 1990Jul 21, 1992Mitsubishi Denki Kabushiki KaishaSystem for processing data having different formats
US5243699 *Dec 6, 1991Sep 7, 1993Maspar Computer CorporationInput/output system for parallel processing arrays
US5265259 *Jul 3, 1990Nov 23, 1993Fujitsu LimitedBlocks and bits sequence reversing device using barrel shift
US5398328 *Sep 27, 1993Mar 14, 1995Silicon Graphics, Inc.System for obtaining correct byte addresses by XOR-ING 2 LSB bits of byte address with binary 3 to facilitate compatibility between computer architecture having different memory orders
Non-Patent Citations
Reference
1Douglas Boiling, "Bringing it All Together: A Look Inside the 486 Chip", Nov. 13, 1990, PC Magazine, V9, N19, pp. 463-464, 476, and 481-483.
2 *Douglas Boiling, Bringing it All Together: A Look Inside the 486 Chip , Nov. 13, 1990, PC Magazine, V9, N19, pp. 463 464, 476, and 481 483.
3 *i960 CA Microprocessor Users Manual, Intel Corporation, 1992, pp. 10 4 10 10.
4i960 CA Microprocessor Users Manual, Intel Corporation, 1992, pp. 10-4-10-10.
Referenced by
Citing PatentFiling datePublication dateApplicantTitle
US5666508 *Jun 7, 1995Sep 9, 1997Texas Instruments IncorporatedFour state two bit recoded alignment fault state circuit for microprocessor address misalignment fault generation
US5687337 *Feb 24, 1995Nov 11, 1997International Business Machines CorporationMixed-endian computer system
US5778406 *Jun 30, 1995Jul 7, 1998Thomson Consumer Electronics, Inc.Apparatus for delivering CPU independent data for little and big endian machines
US5781763 *May 22, 1997Jul 14, 1998International Business Machines CorporationApparatus for transferring data
US5828853 *May 8, 1996Oct 27, 1998Apple Computer, Inc.Method and apparatus for interfacing two systems operating in potentially differing Endian modes
US5848436 *Mar 6, 1996Dec 8, 1998International Business Machines CorporationMethod and apparatus for efficiently providing data from a data storage medium to a processing entity
US5898896 *Apr 10, 1997Apr 27, 1999International Business Machines CorporationMethod and apparatus for data ordering of I/O transfers in Bi-modal Endian PowerPC systems
US5907865 *Sep 8, 1997May 25, 1999Motorola, Inc.Method and data processing system for dynamically accessing both big-endian and little-endian storage schemes
US5928349 *Feb 24, 1995Jul 27, 1999International Business Machines CorporationMixed-endian computing environment for a conventional bi-endian computer system
US5968164 *Jul 15, 1998Oct 19, 1999International Business Machines CorporationMixed-endian computing environment for a conventional bi-endian computer system
US6185629 *Mar 8, 1994Feb 6, 2001Texas Instruments IncorporatedData transfer controller employing differing memory interface protocols dependent upon external input at predetermined time
US6341345 *Jun 7, 1995Jan 22, 2002International Business Machines CorporationMixed-endian computer system that provides cross-endian data sharing
US6349360 *Nov 9, 1999Feb 19, 2002International Business Machines CorporationSystem bus read address operations with data ordering preference hint bits
US6360297Nov 9, 1999Mar 19, 2002International Business Machines CorporationSystem bus read address operations with data ordering preference hint bits for vertical caches
US6405233Jun 30, 1999Jun 11, 2002Intel CorporationUnaligned semaphore adder
US6535957Nov 9, 1999Mar 18, 2003International Business Machines CorporationSystem bus read data transfers with bus utilization based data ordering
US6704854 *Oct 25, 1999Mar 9, 2004Advanced Micro Devices, Inc.Determination of execution resource allocation based on concurrently executable misaligned memory operations
US6760829 *Aug 17, 2001Jul 6, 2004Texas Instruments IncorporatedMMU descriptor having big/little endian bit to control the transfer data between devices
US6772320Nov 17, 2000Aug 3, 2004Intel CorporationMethod and computer program for data conversion in a heterogeneous communications network
US6874063 *Nov 9, 1999Mar 29, 2005International Business Machines CorporationSystem bus read data transfers with data ordering control bits
US7000045 *Aug 28, 2002Feb 14, 2006Lsi Logic CorporationByte-enabled transfer for a data bus having fixed-byte data transfer
US7278062 *Jan 9, 2003Oct 2, 2007Freescale Semiconductor, Inc.Method and apparatus for responding to access errors in a data processing system
US7296108 *May 26, 2005Nov 13, 2007International Business Machines CorporationApparatus and method for efficient transmission of unaligned data
US7330959 *Apr 23, 2004Feb 12, 2008Transmeta CorporationUse of MTRR and page attribute table to support multiple byte order formats in a computer system
US7334066 *Jun 27, 2003Feb 19, 2008Samsung Electronics Co., Ltd.Computer system providing endian information and method of data transmission thereof
US7404019 *May 26, 2004Jul 22, 2008Freescale Semiconductor, Inc.Method and apparatus for endianness control in a data processing system
US7587557 *Mar 18, 2004Sep 8, 2009Panasonic CorporationData sharing apparatus and processor for sharing data between processors of different endianness
US7630585Jun 25, 2004Dec 8, 2009Intel CorporationImage processing using unaligned memory load instructions
US7634762Apr 19, 2005Dec 15, 2009Paravirtual Corp.Selective post-compile conversion
US7653806Oct 29, 2007Jan 26, 2010Microunity Systems Engineering, Inc.Method and apparatus for performing improved group floating-point operations
US7660972Jan 16, 2004Feb 9, 2010Microunity Systems Engineering, IncMethod and software for partitioned floating-point multiply-add operation
US7660973Jul 27, 2007Feb 9, 2010Microunity Systems Engineering, Inc.System and apparatus for group data operations
US7721077 *Oct 16, 2007May 18, 2010Intel CorporationPerforming endian conversion
US7818548Jul 27, 2007Oct 19, 2010Microunity Systems Engineering, Inc.Method and software for group data operations
US7849291Oct 29, 2007Dec 7, 2010Microunity Systems Engineering, Inc.Method and apparatus for performing improved group instructions
US8156308Feb 12, 2008Apr 10, 2012Anvin H PeterSupporting multiple byte order formats in a computer system
US8219785 *Sep 25, 2006Jul 10, 2012Altera CorporationAdapter allowing unaligned access to memory
US8289335 *Feb 3, 2006Oct 16, 2012Microunity Systems Engineering, Inc.Method for performing computations using wide operands
US8458437Mar 2, 2012Jun 4, 2013H. Peter AnvinSupporting multiple byte order formats in a computer system
DE19836001A1 *Aug 8, 1998Feb 10, 2000Hartmann & Braun Gmbh & Co KgMethod communicating data between computers with two storage formats using processor capable of reading and writing both, saves additional hardware and capacity for conversion of each data word
DE19836001C2 *Aug 8, 1998Mar 27, 2003Abb Patent GmbhVerfahren zur Kommunikation zwischen Rechnersystemen mit unterschiedlichen Datenablageformaten
EP1182558A1Aug 2, 2001Feb 27, 2002Texas Instruments IncorporatedMME descriptor having big/little endian bit to control the transfer data between devices
Classifications
U.S. Classification711/202, 711/153, 712/E09.038, 711/147, 711/201
International ClassificationG06F12/04, G06F9/34
Cooperative ClassificationG06F9/34, G06F12/04
European ClassificationG06F9/34, G06F12/04
Legal Events
DateCodeEventDescription
Nov 26, 2007REMIMaintenance fee reminder mailed
Nov 19, 2007FPAYFee payment
Year of fee payment: 12
Nov 21, 2003FPAYFee payment
Year of fee payment: 8
Nov 19, 1999FPAYFee payment
Year of fee payment: 4
Feb 26, 1993ASAssignment
Owner name: INTEL CORPORATIUON, CALIFORNIA
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST.;ASSIGNORS:ATALLAH, DEIF N.;XU, YAN;REEL/FRAME:006450/0441
Effective date: 19930222