Abstract:
A microprocessor which exchanges data of a plurality of bits arranged in a predetermined order by every predetermined number of bits comprises, an area assignment register for assigning a certain area in an address space, a holding register for holding order information of data in the assigned area, and a circuit for rearranging the data bits order in response to the order information when data are exchanged with the assigned area, and processes the data to increase the execution speed by rearranging the data order automatically by hardwares in response to the order information of data in the area, when respective microprocessors in a multiprocessor system share a certain area of a main memory.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to a multiprocessor system and a microprocessor constituting the same, particularly, it relates to improvement of byte polarity processing of data. 
     2. Description of the Prior Art 
     When data are exchanged between a microprocessor and a memory, the data are generally inputted and/or outputted in every division of a certain number of bits. In the following, the case wherein the 32-bit microprocessor deals with 32-bit data will be described as an example. The 32-bit microprocessor divides the 32-bit data into four parts by one byte (8 bits) a part. FIG. 1 is an explanatory view showing the data exchange between the microprocessor and the memory. At this time, one byte in the higher position is called MSB (Most Significant Byte) and that in the lower position is called LSB (Least Significant Byte). As shown in FIG. 1, when data are exchanged with the memory, there are two systems, one is called a big endian system (hereinafter referred to as BE system) and the other is called a little endian system (hereinafter referred to as LE system). For example, when the data are inputted and/or outputted, in the BE system, they are written successively from the assigned address in the memory to four sequential addresses in the order from the byte on the MSB side to the higher address. Conversely, in the LE system, they are written successively in the order from the byte on the LSB side to the higher address. The system by which the data are inputted and/or outputted is set for each microprocessor, which is referred to as a byte polarity of the microprocessor. 
     Now, in a multiprocessor system wherein a plurality of microprocessors are connected by a same system bus, respective microprocessors share a certain area (shared memory area) of a main memory connected to the system bus to communicate therebetween. FIG. 2 is a block diagram showing the relationship between the microprocessor and a main memory of a conventional multiprocessor system, wherein when data are sent from the microprocessor (A) to the microprocessor (B) connected via a system bus, the former writes the data in a shared memory area of the main memory (MM) and the latter reads the written data therefrom. 
     At this time, when data are exchanged between the microprocessors having different byte polarities, the compatibility of the data must be maintained. For examples, when the microprocessor of the BE system reads the data of plural byte lengths in the shared memory area written by the microprocessor of the LE system, the former must reverse the byte order of the data being read. The rearrangement is generally executed by softwares. The microprocessor capable of executing data rearrangement by one command by preparing the data rearrangement command has also been developed. 
     In the multiprocessor system using two microprocessors whose byte polarities are different each other, it must be determined and processed whether the rearrangement of byte order of the data is necessary when accessing the memory. If this is processed by the softwares, the number of commands is increased, which accordingly makes an overhead of the microprocessor larger and delays the whole execution speed. In addition, a problem occurs that the programmer who develops an operation system of the multiprocessor system has to prepare for the data byte order rearrangement routine. 
     SUMMARY OF THE INVENTION 
     The present invention has been devised to solve the aforesaid problems, and it is an object thereof to provide a microprocessor in which reverse and non-reverse of the byte polarity are processed automatically by hardwares for fast execution speed in a multiprocessor system. 
     It is another object of the present invention to provide a microprocessor in which reverse and non-reverse of the byte polarity are processed not by softwares but by hardwares automatically to facilitate development of a multiprocessor system. 
     The above and further objects and features of the invention will more fully be apparent from the following detailed description with accommpanying drawings. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is an explanatory view of an exchanging system between a microprocessor and a memory, 
     FIG. 2 is a block diagram showing the relationship between microprocessors and a main memory of a conventional multiprocessor system, 
     FIG. 3 is a block diagram showing the configuration of essential portions of a microprocessor of the present invention, 
     FIG. 4 is a circuit diagram of an area assignment register and a comparator circuit when a shared memory area is 64K, 
     FIG. 5 is a circuit diagram showing the configuration of a byte reversing circuit, 
     FIG. 6 is a block diagram of a multiprocessor system using a microprocessor of the present invention and a conventional microprocessor, 
     FIG. 7 is a an explanatory view of writing data in an area assigned register, 
     FIG. 8 is a comparator circuit diagram of a microprocessor according to another embodiment of the present invention which makes a shared memory area variable, 
     FIGS. 9(a) and 9(b) are views showing the relationship between an area assignment register and an area setting register of another embodiment, 
     FIG. 9(c) is a view showing change, in the shared memory area, and 
     FIG. 10 is a circuit diagram of a byte reversing circuit of a microprocessor according to a third embodiment of the present invention for rearranging the byte order corresponding to the data length. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     An embodiment of the present invention will be described in the following employing a 32-bit microprocessor as an example. FIG. 3 shows a block diagram of essential portions with respect to the microprocessor of the present invention. An area assignment register (R1) for assigning a shared memory area comprises a plurality of bits. 
     A signal line (SL) from the register (R1) and a partial signal line (PSL) of an internal address bus (IAB) are connected to a comparator circuit (CC). FIG. 4 shows a circuit diagram of the register (R1) and comparator circuit (CC) when the shared memory area is 64K (=2 16 , assigned by the 16-bit address). In this case, the register (R1) comprises 16 bits. Signal line (SL1)˜(SL16) (represented as (SL) together in FIG. 3) from respective bits are connected to XOR gates (X1)˜(X16) together with respective signal lines (AB1)˜(AB16) (represented as (PSL) together in FIG. 3) of the higher 16 bits of the internal address bus (TAB) of the microprocessor. Outputs from the 16 XOR gates (X1)˜(X16) are connected to an AND gate (G1). In FIG. 3, a register (R2) holding byte polar information comprises one bit and is connected to an AND gate (G2), which is connected to a byte order reversing circuit (BORC) so as to output thereto. The byte order reversing circuit (BORC) is incorporated between the bus interface portion (BIP) and the internal data bus of the microprocessor. FIG. 5 shows an internal circuit diagram of the byte reversing circuit. By the output of the AND gate (G2), either switch (SWA) or (SWB) is turned on, and the signal lines (SL1)˜(SL4) (one byte each) from the bus interface portion (BIP) and the internal data buses (IDB1)˜(IDB4) (one byte each) are interconnected directly or reversely. 
     As shown in FIG. 6, the operation of a multiprocessor system using a microprocessor according to the present invention and a prior art microprocesssor will be described. In FIG. 6, the present microprocessor is indicated as MP (1) and the prior art microprocessor as MP (2). Now, assume that their byte polarities are different each other and data of the MP (2) are transferred to the MP (1) via a shared memory area (C), whose addresses are &#34;00A20000H&#34;˜&#34;00A2FFFFH&#34;. First, higher 16 bits &#34;000A2H&#34; of the address are written in the register (R1) of the MP (1) in the data form shown in FIG. 7, and &#34;1&#34; representing the different byte polarity is written in the register (R2) by softwares in advance. Assume that from the MP (2), the data to be transferred are written in a memory in the shared memory area (C). Now, when the MP (1) reads the written data, the address in the shared memory area (C) is accessed first, so that data written in the register (R1) in FIG. 4 correspond to the higher 16 bits of the internal address bus. Thereby, a &#34;H&#34; level is outputted from the entire XOR gates (X1)˜(X16) and the output of the AND gate (G1) becomes the &#34;H&#34; level. Furthermore, in FIG. 3, since &#34; 1&#34; is written in the185 with the output from the AND gate (G1) in the comparator circuit (CC), becomes a &#34;H&#34; level to turn on switches (SWB) in a byte order reversing circuit (BORC). When the switches (SWB) are turned on, data inputted from the bus interface portion (BIP) are reversed in a byte unit so as to be taken into the internal data bus of the MP (1). In such a way, the data are reversed by the hardwares when the address in the shared memory area is accessed by the MP (1). Then, since the contents of the register (R1) and the higher 16 bits of the internal data bus are different when the address in the exclusive memory area of the MP (1), not in the shared memory area, is accessed, the output of the AND gate (G1) becomes a &#34;L&#34; level and, as a result, the output of the AND gate (G2) also becomes the &#34;L&#34; level to turn on switches (SWA). And the data from the bus interface portion (BIP) are taken into the internal data bus of the MP (1) without being reversed. 
     In such a manner, if the shared memory area (C) of the main memory (MM) is assigned in advance, it is possible to determine automatically by the hardwares whether to reverse or not to reverse the data, depending upon whether the address to be accessed is in the shared memory area or not. 
     When the data polarities of the MP (1) and MP (2) are same, &#34;0&#34; is written in the register (R2) in advance by softwares. Then the output of the AND gate (G2) always show the &#34;L&#34; level and the switches (SWA) are turned on, so that the data is taken into the internal data bus of the MP (1) without being reversed. 
     Conversely, also in the case of transferring data from the MP (1) to the MP (2), exactly similarly, the MP (1) is able to determine automatically the necessity of reversing the data and to execute the reverse. 
     If the byte order reversing circuit (BORC) is incorporated in the bus interface portion (BIP) in designing the circuit, the number of circuit component elements may be reduced as a whole. 
     Now, another embodiment of the present invention will be described. In this embodiment, arbitrary size of shared memory area (R) can be set by providing a register (R3) for setting the size of shared memory area and constituting the comparator circuit as shown in FIG. 8. Signal lines (MS1)˜(MS32) from respective bits of the register (R3) are connected to OR gates (Y1)˜(Y32). For, example, if &#34;0 . . . 0&#34; are written in higher n bits and &#34;1 . . . 1&#34; in lower (32-n) bits of the register (R3) as data, the outputs of the signal lines (MS n+1 )˜(MS32) become a &#34;H&#34; level and, as a result, the outputs of the OR gates (Y n+1 )˜(Y32) becomes the &#34;H&#34; level irrespective of contents of the register (R1) and the internal address bus. Therefore, in this case, the output values of the comparator circuit (CC) depend only upon respective higher n bits of the register (R1) and the internal address bus, and only when these two correspond to each other, the comparator circuit (CC) outputs the &#34;H&#34;  level to the AND gate (G2). In this embodiment, as shown in FIG. 9 (a), the size of the shared memory area becomes 2 32-n . In this case, if &#34;P&#34; (n bits) is written in the higher n bits of the register (R1), the shared memory area becomes the addresses &#34;P . 0 . . . 0&#34;˜&#34;P . 1 . . . 1&#34;. Then, as shown in FIG. 9 (b), if &#34;0 . . . 0&#34; are written in the higher n+1 bits and &#34;1 . . . 1&#34; in the other bits of the register (R3), the shared memory area becomes the addresses &#34;P . X . 0 . . . 0&#34;˜&#34;P . X . 1 . . . 1&#34; (X=0 or 1), which is half in size compared with the former case. FIG. 9 (c) shows changes in the shared memory area when X=1. In such a way, by changing the contents of the register (R3), the size of shared memory area can be changed from the entire address space (when &#34;1 . . . 1&#34; are written in the register (R3)) to one (when &#34;0 . . . 0&#34; are written in the register (R3)) of the microprocessor. 
     Next, still another embodiment will be described. In the embodiment, a byte order reversing circuit having a function to rearrange the byte order corresponding to the data length to be inputted and outputted is involved, and its circuit diagram is shown in FIG. 10. Signal lines (SWL8), (SWL16) and (SWL32) are connected respectively to switches (SW8), (SW16), and (SW32). For example, when the data length is 16 bits, by setting only the signal line (SWL16) at a &#34;H&#34; level, only the switch (SW16) is turned on, and only signal lines (SL3) and (SL4) are selected among the signal lines from the bus interface portion and only internal data buses (IBL3) and (IBL4) among the data buses. Corresponding to the output level of the AND gate (G2), these signal lines are connected directly or reversely. 
     As aforementioned, according to the present invention, since the microprocessor automatically determines the necessity of byte order rearrangement by the hardwares and executes the same, the execution speed in a multiprocessor system is increased and development of the system is facilitated. 
     As this invention may be embodied in several forms without departing from the spirit of essential characteristics thereof, the present embodiment is therefore illustrative and not restrictive, since the scope of the invention is defined by the appended claims rather than by the description preceding them, and all changes that fall within the meter and bounds of the claims, or equivalence of such meter and bounds thereof are therefore intended to be embraced by the claims.