JP2011039964A - Endian conversion circuit, endian conversion method and microcontroller - Google Patents

Endian conversion circuit, endian conversion method and microcontroller Download PDF

Info

Publication number
JP2011039964A
JP2011039964A JP2009189097A JP2009189097A JP2011039964A JP 2011039964 A JP2011039964 A JP 2011039964A JP 2009189097 A JP2009189097 A JP 2009189097A JP 2009189097 A JP2009189097 A JP 2009189097A JP 2011039964 A JP2011039964 A JP 2011039964A
Authority
JP
Japan
Prior art keywords
endian conversion
data
endian
holding unit
data holding
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
JP2009189097A
Other languages
Japanese (ja)
Inventor
Atsuji Takenouchi
厚治 竹ノ内
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.)
Fujitsu Semiconductor Ltd
Original Assignee
Fujitsu Semiconductor 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 Fujitsu Semiconductor Ltd filed Critical Fujitsu Semiconductor Ltd
Priority to JP2009189097A priority Critical patent/JP2011039964A/en
Publication of JP2011039964A publication Critical patent/JP2011039964A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide an endian conversion circuit that can perform efficient endian conversion. <P>SOLUTION: The endian conversion circuit has: a data holding part 11 in which address command of a lowest level bit of an address signal is performed as a 'Don't care' bit; and an endian conversion part 12. The endian conversion part 12 performs endian conversion to writing data to the data holding part 11 or reading data d1 from the data holding part 11 based on the lowest level bit value of the address signal accessing the data holding part 11. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、エンディアン変換回路、エンディアン変換方法及びマイクロコントローラに関する。   The present invention relates to an endian conversion circuit, an endian conversion method, and a microcontroller.

複数バイトのデータをメモリ上に配置する方式として、リトルエンディアン、ビッグエンディアンなどが知られている。エンディアンとは、2バイト以上のデータ量を持つ数値データを記録したり転送するときには1バイトごとに分割するが、その際の記録/転送を行う順番のことをいう。最上位のバイトから順番に記録/送信する方式を ビッグエンディアン、最下位のバイトから順番に記録/送信する方式をリトルエンディアンという。   Little endian, big endian, and the like are known as a method of arranging data of a plurality of bytes on a memory. Endian means the order in which recording / transfer is performed at the time when numerical data having a data amount of 2 bytes or more is recorded or transferred, and divided into one byte. The method of recording / transmitting in order from the most significant byte is called big endian, and the method of recording / transmitting in order from the least significant byte is called little endian.

互いに異なるエンディアン方式が用いられているCPU(Central Processing Unit)などのプロセッサ、通信マクロまたはメモリマクロなどの間で、複数バイトのデータを転送して処理するには、エンディアン変換を行う必要がある。   In order to transfer and process a plurality of bytes of data between a processor such as a CPU (Central Processing Unit) using a different endian method, a communication macro or a memory macro, it is necessary to perform endian conversion.

エンディアン変換の手法として、プログラムで行うものがある。
たとえば、CPUが自身のエンディアン方式と異なるエンディアン方式である通信マクロからデータを受信した場合、CPUがエンディアン変換プログラムを実行してエンディアン変換を行う。通信マクロへのデータ転送時にも、CPUが、予め入出力マクロのエンディアン方式への変換を行ったのち、データを転送する。
One endian conversion method is performed by a program.
For example, when the CPU receives data from a communication macro having an endian system different from its own endian system, the CPU executes an endian conversion program to perform endian conversion. Even when data is transferred to the communication macro, the CPU transfers the data after converting the input / output macro to the endian system in advance.

特開平8−305628号公報JP-A-8-305628 特開2001−26150号公報JP 2001-26150 A 特開2004−355432号公報JP 2004-355432 A

しかしながら、従来の技術では、プロセッサがエンディアン変換プログラムを実行して、データ並びを変換させる必要があり、プロセッサの動作効率が悪くなる問題がある。
上記の点を鑑みて、本発明は、効率よくエンディアン変換が可能なエンディアン変換回路、エンディアン変換方法及びマイクロコントローラを提供することを目的とする。
However, in the conventional technique, it is necessary for the processor to execute the endian conversion program to convert the data sequence, and there is a problem that the operation efficiency of the processor is deteriorated.
In view of the above points, an object of the present invention is to provide an endian conversion circuit, an endian conversion method, and a microcontroller that can perform endian conversion efficiently.

上記目的を達成するために、以下のようなエンディアン変換回路が提供される。
このエンディアン変換回路は、アドレス信号の最下位ビットをドントケアビットとして番地指令が行われるデータ保持部と、前記データ保持部へアクセスする前記アドレス信号の前記最下位ビットの値に基づいて、前記データ保持部への書き込みデータ、または前記データ保持部からの読み出しデータに対してエンディアン変換を行うエンディアン変換部と、を有する。
In order to achieve the above object, the following endian conversion circuit is provided.
The endian conversion circuit includes a data holding unit for which an address command is issued using the least significant bit of the address signal as a don't care bit, and the data holding unit based on the value of the least significant bit of the address signal accessing the data holding unit. And an endian conversion unit that performs endian conversion on the data written to the unit or read data from the data holding unit.

また、上記目的を達成するために、以下のようなマイクロコントローラが提供される。
このマイクロコントローラは、アドレス信号の最下位ビットをドントケアビットとして処理するデータ保持部と、エンディアン変換を行うか否かの情報を、前記データ保持部へアクセスする前記アドレス信号の最下位ビットに書き込み、前記データ保持部にアクセスするプロセッサと、前記アドレス信号の前記最下位ビットに基づき、前記データ保持部への書き込みデータ、または前記データ保持部からの読み出しデータに対してエンディアン変換を行うエンディアン変換部と、を有する。
In order to achieve the above object, the following microcontroller is provided.
The microcontroller writes a data holding unit that processes the least significant bit of the address signal as a don't care bit and information on whether to perform endian conversion in the least significant bit of the address signal that accesses the data holding unit, A processor that accesses the data holding unit; and an endian conversion unit that performs endian conversion on write data to the data holding unit or read data from the data holding unit based on the least significant bit of the address signal; Have.

開示のエンディアン変換回路、エンディアン変換方法及びマイクロコントローラによれば、効率よくエンディアン変換が可能になる。   According to the disclosed endian conversion circuit, endian conversion method, and microcontroller, endian conversion can be performed efficiently.

エンディアン変換回路の一例の構成を示す図である。It is a figure which shows the structure of an example of an endian conversion circuit. データ保持部への書き込みアクセス時のエンディアン変換の様子を示す図である。It is a figure which shows the mode of the endian conversion at the time of the write access to a data holding part. 偶数アドレスが指定された場合の、データ保持部からのデータ読み出しの様子を示す図である。It is a figure which shows the mode of the data reading from a data holding part when an even-numbered address is designated. 偶数アドレスが指定された場合の、データ保持部へのデータ書き込みの様子を示す図である。It is a figure which shows the mode of the data writing to a data holding part when an even-numbered address is designated. マイクロコントローラの一例の構成を示す図である。It is a figure which shows the structure of an example of a microcontroller. 通信マクロ内に設けられたエンディアン変換回路の一例を示す図である。It is a figure which shows an example of the endian conversion circuit provided in the communication macro. データ読み出し時のマイクロコントローラの処理の流れを示すフローチャートである。It is a flowchart which shows the flow of a process of the microcontroller at the time of data reading. データ書き込み時のマイクロコントローラの処理の流れを示すフローチャートである。It is a flowchart which shows the flow of a process of the microcontroller at the time of data writing. データ書き込み時にエンディアン変換を行う様子を示す図である。It is a figure which shows a mode that endian conversion is performed at the time of data writing.

以下、本発明の実施の形態を、図面を参照しつつ説明する。
(第1の実施の形態)
図1は、エンディアン変換回路の一例の構成を示す図である。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
(First embodiment)
FIG. 1 is a diagram illustrating a configuration of an example of an endian conversion circuit.

以降述べるエンディアンについて、たとえば、1234ABCDHという4バイトのデータを上位バイトから「12H 34H ABH CDH」と並べる方式をビッグエンディアンとし、下位バイトから「CDH ABH 34H 12H」と並べる方式をリトルエンディアンとする。なお、下付きのHは、その数値が16進数であることを示している。 For the endian described below, for example, a system in which 4 bytes of data 1234ABCD H are arranged as “12 H 34 H AB H CD H ” from the upper byte is set to big endian, and “CD H AB H 34 H 12 H ” is set from the lower byte. The arrangement method is a little endian. The subscript H indicates that the numerical value is a hexadecimal number.

エンディアン変換回路10は、データ保持部11とエンディアン変換部12を有している。
データ保持部11は、たとえば、FIFO(First-In First-Out)回路などのバッファやメモリである。データ保持部11は、たとえば、図示しない通信マクロ及びプロセッサ間のデータ転送の際に、一時的にデータを保持する機能を有する。
The endian conversion circuit 10 includes a data holding unit 11 and an endian conversion unit 12.
The data holding unit 11 is, for example, a buffer or memory such as a first-in first-out (FIFO) circuit. The data holding unit 11 has a function of temporarily holding data, for example, when a communication macro (not shown) and data transfer between processors are performed.

なお、図1の例では、データ保持部11に、4バイトで1ワードのデータd1がリトルエンディアンで格納されている様子が示されている。データd1の1バイト目が1000番地に格納され、2バイト目が1001番地に格納され、3バイト目が1002番地に格納され、4バイト目が1003番地に格納されている。   In the example of FIG. 1, a state in which data d1 of 4 bytes and 1 word is stored in little endian in the data holding unit 11 is shown. The first byte of data d1 is stored at address 1000, the second byte is stored at address 1001, the third byte is stored at address 1002, and the fourth byte is stored at address 1003.

データ保持部11に対して与えられるアドレス信号は、たとえば、チップ内のプロセッサから出力される。プロセッサから出力されるアドレス信号の下位ビットを丸めこまず、フルアドレスアクセスできることが本実施の形態において前提である。ただし、データ保持部11ではワードアクセスあるいはハーフワードアクセスの時はアドレスの最下位ビットは無視される。つまりデータ保持部11はフルアドレスデコードせず、アドレスの最下位ビットはドントケアビット(don't care bit)として処理される。一方、エンディアン変換回路10にはアドレスの最下位ビットが、エンディアン変換を行うか行わないかを示す情報として入力される。   The address signal given to the data holding unit 11 is output from, for example, a processor in the chip. In the present embodiment, it is assumed that full address access is possible without rounding the lower bits of the address signal output from the processor. However, the data holding unit 11 ignores the least significant bit of the address during word access or halfword access. That is, the data holding unit 11 does not perform full address decoding, and the least significant bit of the address is processed as a don't care bit. On the other hand, the least significant bit of the address is input to the endian conversion circuit 10 as information indicating whether or not to perform endian conversion.

エンディアン変換部12は、たとえば、セレクタを用いて実現可能である。エンディアン変換部12は、データ保持部11へアクセスするアドレス信号が、データ保持部11の偶数アドレスまたは奇数アドレスのいずれか一方を指定しているか判定する。具体的には、エンディアン変換部12は、アドレス信号の最下位ビットを検出して、アドレス信号が、偶数アドレス(最下位ビットが0)を指定しているのか、奇数アドレス(最下位ビットが1)を指定しているのか判定する。そして、エンディアン変換部12は、アドレス信号が偶数アドレスまたは奇数アドレスのいずれか一方である場合に、データ保持部11への書き込みデータまたはデータ保持部11からの読み出しデータに対してエンディアン変換を行う。   The endian conversion unit 12 can be realized using a selector, for example. The endian conversion unit 12 determines whether an address signal for accessing the data holding unit 11 specifies either an even address or an odd address of the data holding unit 11. Specifically, the endian conversion unit 12 detects the least significant bit of the address signal and determines whether the address signal specifies an even address (the least significant bit is 0) or an odd address (the least significant bit is 1). ) Is specified. The endian conversion unit 12 performs endian conversion on the write data to the data holding unit 11 or the read data from the data holding unit 11 when the address signal is either an even address or an odd address.

なお、エンディアン変換回路10は、データ保持部11に、図示しないプロセッサや通信インターフェースなどから転送されてくる1ワード(またはハーフワード)のデータごと、アドレス信号により、エンディアン変換するか否か決定できる。   The endian conversion circuit 10 can determine whether or not to perform endian conversion on the basis of an address signal for each word (or halfword) of data transferred from the processor or communication interface (not shown) to the data holding unit 11.

以下、エンディアン変換回路10の動作を説明する。
なお、以下の例では、エンディアン変換部12は、アドレス信号でデータ保持部11の奇数アドレスが指定されている場合にエンディアン変換を行い、偶数アドレスが指定されている場合にはエンディアン変換を行わないとして説明する。
Hereinafter, the operation of the endian conversion circuit 10 will be described.
In the following example, the endian conversion unit 12 performs endian conversion when an odd address of the data holding unit 11 is specified by an address signal, and does not perform endian conversion when an even address is specified. Will be described.

たとえば、エンディアン変換回路10が、リトルエンディアンでデータを扱う通信マクロと、ビッグエンディアンでデータを扱うプロセッサ間に設けられた場合、エンディアン変換回路10は、以下のような動作を行う。   For example, when the endian conversion circuit 10 is provided between a communication macro that handles data in little endian and a processor that handles data in big endian, the endian conversion circuit 10 performs the following operation.

たとえば、通信マクロにより、リトルエンディアンでデータ保持部11に保持されているデータd1をプロセッサが読み出す際、プロセッサは、アドレス信号により、データ保持部11の1001番地または1003番地を指定して読み出しアクセスする。このとき、アドレス信号は奇数アドレスであるので、最下位ビットは1となり、エンディアン変換部12は、エンディアン変換を実行する。すなわち、エンディアン変換部12は、リトルエンディアンのデータ並びのデータd1を、ビッグエンディアンのデータ並びのデータd1aに変換する。   For example, when a processor reads data d1 held in the data holding unit 11 in little endian by a communication macro, the processor designates the address 1001 or 1003 of the data holding unit 11 by an address signal and performs read access. . At this time, since the address signal is an odd address, the least significant bit is 1, and the endian conversion unit 12 performs endian conversion. That is, the endian conversion unit 12 converts the data d1 in the little endian data sequence into the data d1a in the big endian data sequence.

これにより、リトルエンディアンとは逆のデータ並びとなるビッグエンディアンのプロセッサでも、データd1と同じ内容のデータd1aとして処理可能になる。
次に、データ保持部11への書き込みアクセス時にエンディアン変換を施す場合の、エンディアン変換回路10の動作を説明する。
As a result, even a big endian processor having a data arrangement opposite to that of the little endian can be processed as data d1a having the same contents as the data d1.
Next, the operation of the endian conversion circuit 10 when performing endian conversion at the time of write access to the data holding unit 11 will be described.

図2は、データ保持部への書き込みアクセス時のエンディアン変換の様子を示す図である。
たとえば、ビッグエンディアンのプロセッサから、データd1aを、リトルエンディアンで転送するためのバッファとして用いるデータ保持部11に書き込む場合、エンディアン変換部12は、以下のような動作を行う。
FIG. 2 is a diagram illustrating a state of endian conversion at the time of write access to the data holding unit.
For example, when data d1a is written from the big endian processor to the data holding unit 11 used as a buffer for transfer in little endian, the endian conversion unit 12 performs the following operation.

書き込みアクセス時のアドレス信号が、1001番地または1003番地のような奇数アドレスを指定している場合、エンディアン変換部12は、プロセッサ側からのビッグエンディアンのデータ並びのデータd1aをリトルエンディアンに変換する。そして、データ保持部11の1000番地にデータd1aの1バイト目を、1001番地に2バイト目を、1002番地に3バイト目と、1003番地に4バイト目をそれぞれ格納する。   When the address signal at the time of write access designates an odd address such as address 1001 or address 1003, the endian conversion unit 12 converts the data d1a of the big endian data sequence from the processor side into little endian. Then, the first byte of data d1a is stored at address 1000 of data holding unit 11, the second byte at address 1001, the third byte at address 1002, and the fourth byte at address 1003.

これにより、リトルエンディアンの通信マクロでも、データd1aと同じ内容のデータd1として処理可能になる。
なお、上記では、データ保持部11がリトルエンディアンでデータを扱い、プロセッサがビッグエンディアンでデータを扱う場合について説明したが、これが逆である場合にも同様にエンディアン変換を行うことができる。すなわち、データ保持部11がビッグエンディアンでデータを扱い、プロセッサがリトルエンディアンでデータを扱う場合にも、エンディアン変換部12は、アドレス信号が奇数アドレスを指定している場合には一方のデータをエンディアン変換して他方に転送する。
As a result, even a little endian communication macro can be processed as data d1 having the same contents as data d1a.
Although the case where the data holding unit 11 handles data in little endian and the processor handles data in big endian has been described above, endian conversion can also be performed in the same manner when this is the opposite. That is, even when the data holding unit 11 handles data in big endian and the processor handles data in little endian, the endian conversion unit 12 does not convert one data to endian when the address signal specifies an odd address. Convert and transfer to the other.

エンディアン変換部12は、データ保持部11への読み出しアクセスまたは書き込みアクセス時のアドレス信号が偶数アドレスを指定する場合に、エンディアン変換を行わない。   The endian conversion unit 12 does not perform endian conversion when the address signal at the time of read access or write access to the data holding unit 11 specifies an even address.

たとえば、通信マクロとプロセッサが両方ともリトルエンディアンでデータを扱う場合、図3及び図4で示すような動作が行われる。
図3は、偶数アドレスが指定された場合の、データ保持部からのデータ読み出しの様子を示す図である。
For example, when both the communication macro and the processor handle data in little endian, the operations shown in FIGS. 3 and 4 are performed.
FIG. 3 is a diagram showing how data is read from the data holding unit when an even address is designated.

読み出しアクセスの際、アドレス信号で偶数アドレス(最下位ビットが0)が指定されている場合、エンディアン変換部12は、エンディアン変換を行わず、データ保持部11のリトルエンディアンの並びのデータd1をそのまま転送する。   At the time of read access, if an even address (the least significant bit is 0) is specified by the address signal, the endian conversion unit 12 does not perform endian conversion, and the data d1 in the little endian sequence of the data holding unit 11 is used as it is. Forward.

通信マクロとプロセッサが両方ともビッグエンディアンでデータを扱う場合も同様に、エンディアン変換部12は、データ保持部11に保持されたビッグエンディアンの並びのデータを、エンディアン変換せずに、そのまま読み出せばよい。   Similarly, when both the communication macro and the processor handle data in big endian, the endian conversion unit 12 reads the big endian array data held in the data holding unit 11 as it is without performing endian conversion. Good.

図4は、偶数アドレスが指定された場合の、データ保持部へのデータ書き込みの様子を示す図である。
書き込みアクセスの際、アドレス信号で偶数アドレスが指定されると、エンディアン変換部12は、エンディアン変換を行わず、プロセッサ側からのリトルエンディアンの並びのデータd1aを、データ保持部11に書き込む。
FIG. 4 is a diagram illustrating a state of data writing to the data holding unit when an even address is designated.
When an even address is specified by an address signal at the time of write access, the endian conversion unit 12 does not perform endian conversion and writes data d1a in a little endian sequence from the processor side to the data holding unit 11.

通信マクロとプロセッサが両方ともビッグエンディアンでデータを扱う場合も同様に、エンディアン変換部12は、プロセッサ側からのリトルエンディアンの並びのデータを、エンディアン変換せずに、データ保持部11に書き込めばよい。   Similarly, when both the communication macro and the processor handle data in big endian, the endian conversion unit 12 may write the little endian sequence data from the processor side into the data holding unit 11 without performing endian conversion. .

以上のように、本実施の形態のエンディアン変換回路10では、データ保持部11へアクセスするアドレス信号が、偶数アドレスまたは奇数アドレスを指定しているかによって、エンディアン変換を行うか否かを決定している。これにより、簡単にエンディアン変換の要否が判定可能となり、エンディアン変換の要否を設定するためのレジスタやスイッチなどのハードウェア構成などを付加することなく、効率よくエンディアン変換が可能となる。また、プログラムによるデータのスワップも不要となり、プログラム効率が向上する。   As described above, in the endian conversion circuit 10 of the present embodiment, whether or not to perform endian conversion is determined depending on whether the address signal accessing the data holding unit 11 specifies an even address or an odd address. Yes. As a result, it is possible to easily determine whether or not endian conversion is necessary, and it is possible to efficiently perform endian conversion without adding a hardware configuration such as a register or a switch for setting whether or not endian conversion is necessary. In addition, data swapping by the program becomes unnecessary, and the program efficiency is improved.

なお、上記の説明では、エンディアン変換部12は、アドレス信号で奇数アドレスが指定されている場合にエンディアン変換を行い、偶数アドレスが指定されている場合にはエンディアン変換を行わないとしたが、これに限定されない。エンディアン変換部12は、アドレス信号で偶数アドレスが指定されている場合にエンディアン変換を行い、奇数アドレスが指定されている場合にはエンディアン変換を行わないようにしてもよい。   In the above description, the endian conversion unit 12 performs endian conversion when an odd address is specified in the address signal, and does not perform endian conversion when an even address is specified. It is not limited to. The endian conversion unit 12 may perform endian conversion when an even address is specified by an address signal, and may not perform endian conversion when an odd address is specified.

また、上記の説明では、エンディアン変換部12は、アドレス信号が偶数アドレスまたは奇数アドレスかを判定して、エンディアン変換を行うか否かを決定する場合について説明したが、さらに、アクセスサイズを考慮してもよい。詳細は後述するが、バイトごとのアクセスが行われる場合には、エンディアン変換を行わなくてよいので、エンディアン変換を無効とし、複数バイト(たとえば、ハーフワードまたはワード)のアクセスの場合にエンディアン変換を有効とするようにしてもよい。   In the above description, the endian conversion unit 12 determines whether the endian conversion is performed by determining whether the address signal is an even address or an odd address, but further considers the access size. May be. Although details will be described later, endian conversion is not necessary when byte-by-byte access is performed. Therefore, endian conversion is disabled, and endian conversion is performed when accessing multiple bytes (for example, halfword or word). You may make it validate.

次に、上記のようなエンディアン変換回路を、マイクロコントローラに適用した場合を例にして説明する。
(第2の実施の形態)
図5は、マイクロコントローラの一例の構成を示す図である。
Next, a case where the endian conversion circuit as described above is applied to a microcontroller will be described as an example.
(Second Embodiment)
FIG. 5 is a diagram illustrating a configuration of an example of a microcontroller.

以降述べるエンディアンについて、たとえば、1234ABCDHという4バイトのデータを上位バイトから「12H 34H ABH CDH」と並べる方式をビッグエンディアンとし、下位バイトから「CDH ABH 34H 12H」と並べる方式をリトルエンディアンとする。なお、下付きのHは、その数値が16進数であることを示している。 For the endian described below, for example, a system in which 4 bytes of data 1234ABCD H are arranged as “12 H 34 H AB H CD H ” from the upper byte is set to big endian, and “CD H AB H 34 H 12 H ” is set from the lower byte. The arrangement method is a little endian. The subscript H indicates that the numerical value is a hexadecimal number.

マイクロコントローラ20は、プロセッサ21、RAM(Random Access Memory)22、フラッシュメモリ23、バスコンバータ24、バスブリッジ25、周辺回路26,27、通信マクロ28,29を有している。   The microcontroller 20 includes a processor 21, a RAM (Random Access Memory) 22, a flash memory 23, a bus converter 24, a bus bridge 25, peripheral circuits 26 and 27, and communication macros 28 and 29.

プロセッサ21は、たとえば、CPUやDSP(Digital Signal Processor)などであり、マイクロコントローラ20の各部を制御する。また、プロセッサ21は、通信マクロ28,29の、後述のデータ保持部にアクセスする際、たとえば、アドレスの下位ビットを丸めこまず、フルアドレスアクセスする。ただし、データ保持部11ではワードアクセスあるいはハーフワードアクセスの時はアドレスの最下位ビットは無視される。つまりデータ保持部11はフルアドレスデコードせず、アドレスの最下位ビットはドントケアビット(don't care bit)として処理される。一方、エンディアン変換回路10にはアドレスの最下位ビットが、エンディアン変換を行うか行わないかを示す情報として入力される。   The processor 21 is, for example, a CPU or a DSP (Digital Signal Processor), and controls each part of the microcontroller 20. Further, when accessing the later-described data holding unit of the communication macros 28 and 29, for example, the processor 21 performs full address access without rounding the lower bits of the address. However, the data holding unit 11 ignores the least significant bit of the address during word access or halfword access. That is, the data holding unit 11 does not perform full address decoding, and the least significant bit of the address is processed as a don't care bit. On the other hand, the least significant bit of the address is input to the endian conversion circuit 10 as information indicating whether or not to perform endian conversion.

RAM22は、プロセッサ21が実行途中のプログラムや、演算途中のデータを格納する。
フラッシュメモリ23は、プロセッサ21が実行するOS(Operation System)や、各種プログラム、各種データを格納する。
The RAM 22 stores programs being executed by the processor 21 and data being calculated.
The flash memory 23 stores an OS (Operation System) executed by the processor 21, various programs, and various data.

バスコンバータ24は、プロセッサ21、RAM22、フラッシュメモリ23及び内部バスbsとのインターフェースとして機能し、たとえば、32ビットと16ビットの変換機能なども有する。   The bus converter 24 functions as an interface with the processor 21, the RAM 22, the flash memory 23, and the internal bus bs, and has, for example, a 32-bit and 16-bit conversion function.

バスブリッジ25は、内部バスbs1と、周辺バスbs2とを接続する。
周辺回路26,27は、割りこみコントローラや、ウォッチドッグタイマなどであり、周辺バスbs2に接続されている。
The bus bridge 25 connects the internal bus bs1 and the peripheral bus bs2.
The peripheral circuits 26 and 27 are an interrupt controller, a watchdog timer, and the like, and are connected to the peripheral bus bs2.

通信マクロ28,29は、マイクロコントローラ20の外部との通信を行うためのインターフェース回路である。通信マクロ28,29は、たとえば、USB(Universal Serial Bus)や、UART(Universal Asynchronous Receiver Transmitter)、I2Cバス、CAN(Controller Area Network)バス、IE(Inter Equipment)バスなどのインターフェース回路である。図1で示したような、エンディアン変換回路10は、たとえば、通信マクロ28,29内に設けられる。 The communication macros 28 and 29 are interface circuits for performing communication with the outside of the microcontroller 20. The communication macros 28 and 29 are interface circuits such as USB (Universal Serial Bus), UART (Universal Asynchronous Receiver Transmitter), I 2 C bus, CAN (Controller Area Network) bus, and IE (Inter Equipment) bus. . The endian conversion circuit 10 as shown in FIG. 1 is provided in the communication macros 28 and 29, for example.

なお、図5では、2つの通信マクロ28,29を示しているが、1つでも3つ以上であってもよい。
図6は、通信マクロ内に設けられたエンディアン変換回路の一例を示す図である。
In FIG. 5, two communication macros 28 and 29 are shown, but one or three or more may be used.
FIG. 6 is a diagram illustrating an example of the endian conversion circuit provided in the communication macro.

通信マクロ28は、データ保持部281、エンディアン変換部282を有しており、これらが、図1で示したようなエンディアン変換回路として機能する。すなわち、データ保持部281は、図1のデータ保持部11に対応し、エンディアン変換部282は、図1のエンディアン変換部12に対応している。ただし、図6に示されている構成では、エンディアン変換部282は、エンディアン変換を行うエンディアン変換セレクタ282aのほかに、アクセスサイズ検出部282bを有している。   The communication macro 28 has a data holding unit 281 and an endian conversion unit 282, which function as an endian conversion circuit as shown in FIG. That is, the data holding unit 281 corresponds to the data holding unit 11 in FIG. 1, and the endian conversion unit 282 corresponds to the endian conversion unit 12 in FIG. However, in the configuration shown in FIG. 6, the endian conversion unit 282 includes an access size detection unit 282b in addition to the endian conversion selector 282a that performs endian conversion.

アクセスサイズ検出部282bは、データ保持部281へアクセスするアドレス信号と、データ保持部281へのアクセスサイズを基に、エンディアン変換セレクタ282aに、エンディアン変換を実行させるか否かを決定する。アクセスサイズ検出部282bは、バイトごとのアクセスが行われる場合には、エンディアン変換を行わなくてよいので、エンディアン変換を無効とし、複数バイトのアクセスの場合にエンディアン変換を有効とする。アクセスサイズ検出部282bは、エンディアン変換部282の外部にあってもよい。   The access size detection unit 282b determines whether or not to cause the endian conversion selector 282a to perform endian conversion based on the address signal for accessing the data holding unit 281 and the access size to the data holding unit 281. The access size detection unit 282b does not need to perform endian conversion when byte-by-byte access is performed. Therefore, the endian conversion is invalidated, and the endian conversion is validated when a plurality of bytes are accessed. The access size detection unit 282b may be outside the endian conversion unit 282.

なお、以下の説明では、エンディアン変換セレクタ282aは、アドレス信号がデータ保持部281の奇数アドレス(最下位ビットが1)を指定している場合に、エンディアン変換を行う例を説明する。その場合、アクセスサイズ検出部282bは、たとえば、図6に示すように、OR回路282b1と、AND回路282b2とを用いて実現される。   In the following description, an example will be described in which the endian conversion selector 282a performs endian conversion when the address signal specifies an odd address (the least significant bit is 1) of the data holding unit 281. In this case, the access size detection unit 282b is realized using, for example, an OR circuit 282b1 and an AND circuit 282b2, as shown in FIG.

OR回路282b1には、複数バイトのアクセスとして、ワードアクセスかハーフワードアクセスなのかを示す2つの入力信号が、プロセッサ21から入力される。ワードアクセスまたはハーフワードアクセスの場合には、OR回路282b1には、1,0の信号が入力され、OR回路282b1は、1を出力する。また、バイトアクセスの場合には、OR回路282b1の2つの入力はともに0になり、OR回路282b1は、0を出力する。   Two input signals indicating whether the access is a word access or a halfword access are input from the processor 21 to the OR circuit 282b1. In the case of word access or halfword access, the OR circuit 282b1 receives a signal of 1, 0, and the OR circuit 282b1 outputs 1. In the case of byte access, the two inputs of the OR circuit 282b1 are both 0, and the OR circuit 282b1 outputs 0.

AND回路282b2の一方の入力端子には、アドレス信号の最下位ビットが入力され、他方の入力端子には、OR回路282b1の出力信号が入力される。OR回路282b1の出力が1である場合、AND回路282b2の出力は、アドレス信号の最下位ビットによって決まる。すなわち、AND回路282b2は、最下位ビットが1の場合は1を出力し、最下位ビットが0の場合は0を出力する。一方、OR回路282b1の出力が0である場合、AND回路282b2の出力は、アドレスの信号の最下位ビットの値によらず0となり、エンディアン変換が無効となる。   The least significant bit of the address signal is input to one input terminal of the AND circuit 282b2, and the output signal of the OR circuit 282b1 is input to the other input terminal. When the output of the OR circuit 282b1 is 1, the output of the AND circuit 282b2 is determined by the least significant bit of the address signal. That is, the AND circuit 282b2 outputs 1 when the least significant bit is 1, and outputs 0 when the least significant bit is 0. On the other hand, when the output of the OR circuit 282b1 is 0, the output of the AND circuit 282b2 becomes 0 regardless of the value of the least significant bit of the address signal, and the endian conversion becomes invalid.

なお、エンディアン変換部282は、通信マクロ28の外に設けられていてもよい。
以下、通信マクロ28がPC30とUSBで通信するインターフェース回路である場合を例にして、マイクロコントローラ20の動作を説明する。
Note that the endian conversion unit 282 may be provided outside the communication macro 28.
Hereinafter, the operation of the microcontroller 20 will be described by taking as an example the case where the communication macro 28 is an interface circuit that communicates with the PC 30 via USB.

まず、データ読み出し時における、マイクロコントローラ20の動作を説明する。
図7は、データ読み出し時のマイクロコントローラの処理の流れを示すフローチャートである。
First, the operation of the microcontroller 20 at the time of data reading will be described.
FIG. 7 is a flowchart showing a flow of processing of the microcontroller at the time of data reading.

まず、通信マクロ28は、PC30からUSBデータを受信してデータ保持部281に保持する(ステップS1)。図6では、1バイト目が01H、2バイト目が23H、3バイト目が45H、4バイト目が67Hという4バイトのデータd10が、リトルエンディアンの並びで、データ保持部281の100〜103番地に保持されている様子を示している。なお、下付きのHは、その数値が16進数であることを示している。 First, the communication macro 28 receives USB data from the PC 30 and holds it in the data holding unit 281 (step S1). 6, the first byte is 01 H, 2 byte is 23 H, 3 byte is 45 H, 4 th byte 4 bytes of 67 H data d10 is a sequence of little endian, the data holding unit 281 It shows a state held at addresses 100 to 103. The subscript H indicates that the numerical value is a hexadecimal number.

次にプロセッサ21は、データ保持部281に対して読み出しアクセスを行う(ステップS2)。プロセッサ21は、データ保持部281に対して、たとえば、バイトごとのアクセスか、複数バイト(ワードまたはハーフワード)ごとのアクセスを行う。プロセッサ21は、ワードアクセスまたはハーフワードアクセスを行う場合には、図6で示したアクセスサイズ検出部282bのOR回路282b1の一方の入力端子に1を入力する。   Next, the processor 21 performs read access to the data holding unit 281 (step S2). For example, the processor 21 accesses the data holding unit 281 for each byte or for each of a plurality of bytes (word or halfword). When performing word access or halfword access, the processor 21 inputs 1 to one input terminal of the OR circuit 282b1 of the access size detection unit 282b shown in FIG.

また、プロセッサ21は、ワードアクセスまたはハーフワードアクセスを行う際、自身がビッグエンディアンを採用している場合、リトルエンディアンの並びでデータを保持する通信マクロ28のデータ保持部281に対して、奇数アドレスでアクセスする。たとえば、プロセッサ21は、100〜103番地の1ワードのデータd10を読み出す場合には、アドレス信号により101番地または103番地を指定して読み出しアクセスする。   Further, when performing the word access or the half word access, the processor 21 uses an odd address to the data holding unit 281 of the communication macro 28 that holds data in a little endian sequence when the processor 21 adopts the big endian. Access with. For example, when reading one word of data d10 at addresses 100 to 103, the processor 21 designates address 101 or address 103 by an address signal and performs read access.

一方、プロセッサ21は、ワードアクセスまたはハーフワードアクセスを行う際、自身がリトルエンディアンを採用している場合、リトルエンディアンの並びでデータを保持する通信マクロ28のデータ保持部281に対して、偶数アドレスでアクセスする。たとえば、プロセッサ21は、100〜103番地の1ワードのデータd10を読み出す場合には、アドレス信号により100番地または102番地を指定して読み出しアクセスする。   On the other hand, when performing the word access or the halfword access, the processor 21 uses an even address for the data holding unit 281 of the communication macro 28 that holds the data in the little endian sequence when the processor 21 adopts the little endian. Access with. For example, when reading one word of data d10 at addresses 100 to 103, the processor 21 designates address 100 or address 102 by an address signal and performs read access.

次に、エンディアン変換部282は、プロセッサ21からのアクセスサイズが複数バイト(ワードまたはハーフワード)アクセスか否かを判定する(ステップS3)。そして、エンディアン変換部282は、複数バイトアクセスが発生していると判定した場合には、次に、アドレス信号の最下位ビットが1か否かを判定する(ステップS4)。   Next, the endian conversion unit 282 determines whether or not the access size from the processor 21 is a multibyte (word or halfword) access (step S3). If the endian conversion unit 282 determines that multi-byte access has occurred, the endian conversion unit 282 determines whether the least significant bit of the address signal is 1 (step S4).

具体的には、アクセスサイズ検出部282bは、OR回路282b1の2つの入力端子の少なくともいずれか一方に1が入力されている場合には、複数バイトアクセスと判定する。一方、アクセスサイズ検出部282bは、OR回路282b1の2つの入力端子の両方に0が入力されている場合には、バイトごとのアクセスと判定する。後者の場合、アクセスサイズ検出部282bは、アドレス信号の最下位ビットにかかわらず、エンディアン変換を無効にする。これにより、バイトアクセスの場合には、プロセッサ21で指定されたアドレスの1バイトのデータが、エンディアン変換されずに読み出される(ステップS5)。   Specifically, the access size detection unit 282b determines that the access is a multiple byte when 1 is input to at least one of the two input terminals of the OR circuit 282b1. On the other hand, when 0 is input to both of the two input terminals of the OR circuit 282b1, the access size detection unit 282b determines that access is for each byte. In the latter case, the access size detection unit 282b invalidates endian conversion regardless of the least significant bit of the address signal. Thus, in the case of byte access, 1-byte data at the address specified by the processor 21 is read without endian conversion (step S5).

また、ステップS4の処理において最下位ビットが0と判定された場合にも、エンディアン変換部282は、ステップS5の処理を行う。エンディアン変換部282は、プロセッサ21により、たとえば、100番地または102番地を指定したワードアクセスがなされると、100〜103番地の1ワード分のデータd10を、エンディアン変換せずに読み出し、プロセッサ21に送信する。また、プロセッサ21により、100番地を指定したハーフワードアクセスがなされた場合、エンディアン変換部282は、100番地と101番地のハーフワード分のデータを、エンディアン変換せずに読み出し、プロセッサ21に送信する。   Even when the least significant bit is determined to be 0 in the process of step S4, the endian conversion unit 282 performs the process of step S5. For example, when the processor 21 performs word access designating address 100 or address 102, the endian conversion unit 282 reads data d10 for one word at addresses 100 to 103 without endian conversion, and sends the data to the processor 21. Send. When the processor 21 performs a halfword access designating the address 100, the endian conversion unit 282 reads the halfword data at the addresses 100 and 101 without performing endian conversion and transmits the data to the processor 21. .

一方、ステップS4の処理において最下位ビットが1と判定された場合、エンディアン変換部282は、エンディアン変換セレクタ282aにより、データ保持部281に保持されているデータに対してエンディアン変換を行い、読み出す(ステップS6)。エンディアン変換部282は、プロセッサ21により、たとえば、101番地または103番地を指定したワードアクセスがなされると、100〜103番地の1ワード分のデータd10を、図6のようなビッグエンディアンの並びのデータd10aに変換する。そして、エンディアン変換部282は、エンディアン変換したデータd10aを読み出し、プロセッサ21に送信する。   On the other hand, if the least significant bit is determined to be 1 in the process of step S4, the endian conversion unit 282 performs endian conversion on the data held in the data holding unit 281 by the endian conversion selector 282a and reads the data ( Step S6). For example, when the processor 21 performs word access designating address 101 or address 103, the endian conversion unit 282 converts the data d10 for one word at addresses 100 to 103 into a big endian sequence as shown in FIG. Convert to data d10a. Then, the endian conversion unit 282 reads the endian converted data d10a and transmits it to the processor 21.

次に、プロセッサ21からのデータ書き込み時における、マイクロコントローラ20の動作を説明する。
図8は、データ書き込み時のマイクロコントローラの処理の流れを示すフローチャートである。
Next, the operation of the microcontroller 20 when data is written from the processor 21 will be described.
FIG. 8 is a flowchart showing a flow of processing of the microcontroller at the time of data writing.

また、図9は、データ書き込み時にエンディアン変換を行う様子を示す図である。
まずプロセッサ21は、データ保持部281に対してデータの書き込みアクセスを行う(ステップS10)。このとき、プロセッサ21は、データ保持部281に対して、たとえば、バイトごとの書き込みアクセスか、複数バイト(たとえば、ワードまたはハーフワード)ごとの書き込みアクセスを行う。ワードアクセスまたはハーフワードアクセスを行う場合には、プロセッサ21は、アクセスサイズ検出部282bのOR回路282b1の一方の入力端子に1を入力する。
FIG. 9 is a diagram showing how endian conversion is performed when data is written.
First, the processor 21 performs data write access to the data holding unit 281 (step S10). At this time, the processor 21 performs, for example, write access for each byte or write access for each of a plurality of bytes (for example, a word or a halfword) with respect to the data holding unit 281. When performing word access or halfword access, the processor 21 inputs 1 to one input terminal of the OR circuit 282b1 of the access size detection unit 282b.

また、プロセッサ21は、ワードアクセスまたはハーフワードアクセスを行う際、自身がビッグエンディアンを採用している場合、リトルエンディアンの並びでデータを保持する通信マクロ28のデータ保持部281に対して、奇数アドレスでアクセスする。たとえば、プロセッサ21は、100〜103番地に1ワードのデータを書き込む場合には、アドレス信号により101番地または103番地を指定して書き込みアクセスする。   Further, when performing the word access or the half word access, the processor 21 uses an odd address for the data holding unit 281 of the communication macro 28 that holds data in a little endian sequence when the processor 21 adopts the big endian. Access with. For example, when writing data of one word at addresses 100 to 103, the processor 21 designates address 101 or address 103 by an address signal and performs write access.

一方、プロセッサ21は、ワードアクセスまたはハーフワードアクセスを行う際、自身がリトルエンディアンを採用している場合、リトルエンディアンの並びでデータを保持する通信マクロ28のデータ保持部281に対して、偶数アドレスでアクセスする。たとえば、プロセッサ21は、100〜103番地に1ワードのデータを書き込む場合には、アドレス信号により100番地または102番地を指定して書き込みアクセスする。   On the other hand, when performing the word access or the halfword access, the processor 21 uses an even address for the data holding unit 281 of the communication macro 28 that holds the data in the little endian sequence when the processor 21 adopts the little endian. Access with. For example, when writing one word data at addresses 100 to 103, the processor 21 designates address 100 or address 102 by an address signal and performs write access.

次に、エンディアン変換部282は、プロセッサ21からのアクセスサイズが複数バイト(ワードまたはハーフワード)アクセスか否かを判定する(ステップS11)。そして、エンディアン変換部282は、複数バイトアクセスが発生していると判定した場合には、次に、アドレス信号の最下位ビットが1か否かを判定する(ステップS12)。   Next, the endian conversion unit 282 determines whether or not the access size from the processor 21 is a multi-byte (word or halfword) access (step S11). If the endian conversion unit 282 determines that multi-byte access has occurred, it determines whether the least significant bit of the address signal is 1 (step S12).

具体的には、アクセスサイズ検出部282bは、OR回路282b1の2つの入力端子の少なくともいずれか一方に1が入力されている場合には、複数バイトアクセスと判定する。一方、アクセスサイズ検出部282bは、OR回路282b1の2つの入力端子の両方に0が入力されている場合には、バイトごとのアクセスと判定する。後者の場合、アクセスサイズ検出部282bは、アドレス信号の最下位ビットにかかわらず、エンディアン変換を無効にする。これにより、バイトアクセスの場合には、プロセッサ21で指定されたデータ保持部281のアドレスに、プロセッサ21側からの1バイトのデータが、エンディアン変換されずに書き込まれる(ステップS13)。   Specifically, the access size detection unit 282b determines that the access is a multiple byte when 1 is input to at least one of the two input terminals of the OR circuit 282b1. On the other hand, when 0 is input to both of the two input terminals of the OR circuit 282b1, the access size detection unit 282b determines that access is for each byte. In the latter case, the access size detection unit 282b invalidates endian conversion regardless of the least significant bit of the address signal. Thereby, in the case of byte access, 1-byte data from the processor 21 side is written to the address of the data holding unit 281 specified by the processor 21 without endian conversion (step S13).

また、ステップS12の処理において最下位ビットが0と判定された場合にも、エンディアン変換部282は、ステップS13の処理を行う。プロセッサ21により、たとえば、データ保持部281の100番地または102番地を指定したワードアクセスがなされると、エンディアン変換部282は、100〜103番地に、1ワード分のデータd10aを、エンディアン変換せずに書き込む。また、プロセッサ21により、100番地を指定したハーフワードアクセスがなされた場合、エンディアン変換部282は、100番地と101番地に、ハーフワード分のデータを、エンディアン変換せずに書き込む。   Even when the least significant bit is determined to be 0 in the process of step S12, the endian conversion unit 282 performs the process of step S13. For example, when the processor 21 performs word access designating the address 100 or address 102 of the data holding unit 281, the endian conversion unit 282 does not endianly convert the data d10 a for one word to the addresses 100 to 103. Write to. When the processor 21 performs a halfword access designating 100 addresses, the endian conversion unit 282 writes halfword data at addresses 100 and 101 without endian conversion.

一方、ステップS12の処理において最下位ビットが1と判定された場合、エンディアン変換部282は、プロセッサ21側から送信されてきたデータに対してエンディアン変換を行い、データ保持部281に書き込む(ステップS14)。エンディアン変換部282は、プロセッサ21により、たとえば、データ保持部281の101番地または103番地を指定したワードアクセスがなされると、1ワード分のデータd10aを、図9のようなリトルエンディアンの並びのデータd10に変換する。そして、エンディアン変換部282は、エンディアン変換したデータd10を、データ保持部281の100〜103番地に書き込む。そして、通信マクロ28は、書き込んだデータd10を、USBデータとしてPC30に送信する(ステップS15)。   On the other hand, when the least significant bit is determined to be 1 in the process of step S12, the endian conversion unit 282 performs endian conversion on the data transmitted from the processor 21 side and writes the data to the data holding unit 281 (step S14). ). For example, when the processor 21 performs a word access designating the address 101 or 103 of the data holding unit 281, the endian conversion unit 282 converts the data d10a for one word into a little endian sequence as shown in FIG. Convert to data d10. Then, the endian conversion unit 282 writes the endian converted data d10 at addresses 100 to 103 of the data holding unit 281. Then, the communication macro 28 transmits the written data d10 as USB data to the PC 30 (step S15).

以上のように、本実施の形態のマイクロコントローラ20では、データ保持部281へアクセスするアドレス信号が、偶数アドレスまたは奇数アドレスを指定しているかによって、エンディアン変換を行うか否かを決定している。これにより、簡単にエンディアン変換の要否が判定可能となり、効率よくエンディアン変換が可能となる。   As described above, in the microcontroller 20 according to the present embodiment, whether or not to perform endian conversion is determined depending on whether the address signal accessed to the data holding unit 281 specifies an even address or an odd address. . As a result, it is possible to easily determine whether or not endian conversion is necessary, and endian conversion can be performed efficiently.

たとえば、エンディアンが異なる複数の通信マクロ28,29があった場合、プロセッサ21では、偶数または奇数アドレスを指定するだけで、通信マクロ28,29ごとに、エンディアン変換をするか否か決定できる。   For example, when there are a plurality of communication macros 28 and 29 having different endians, the processor 21 can determine whether or not to perform endian conversion for each of the communication macros 28 and 29 only by specifying even or odd addresses.

なお、上記では、エンディアン変換部282は、アドレス信号で奇数アドレスが指定されている場合にエンディアン変換を行い、偶数アドレスが指定されている場合にはエンディアン変換を行わないとして説明したが、これに限定されない。エンディアン変換部282は、アドレス信号で偶数アドレスが指定されている場合にエンディアン変換を行い、奇数アドレスが指定されている場合にはエンディアン変換を行わないようにしてもよい。その場合、エンディアン変換セレクタ282aは、アドレス信号の最下位ビットが0の場合に、エンディアン変換を行うようにする。また、アクセスサイズ検出部282bは、バイトアクセスの場合に、エンディアン変換セレクタ282aに入力する出力信号を1に固定するような回路構成とすればよい。   In the above description, the endian conversion unit 282 performs endian conversion when an odd address is specified in the address signal, and does not perform endian conversion when an even address is specified. It is not limited. The endian conversion unit 282 may perform endian conversion when an even address is specified by an address signal, and may not perform endian conversion when an odd address is specified. In this case, the endian conversion selector 282a performs endian conversion when the least significant bit of the address signal is 0. The access size detection unit 282b may have a circuit configuration that fixes the output signal input to the endian conversion selector 282a to 1 in the case of byte access.

また、アドレス信号により、ワードごと、またはハーフワードごとにエンディアン変換を行うか否かの設定を行うようにしてもよい。
以上、実施の形態に基づき、本発明のエンディアン変換回路、エンディアン変換方法及びマイクロコントローラの一観点について説明してきたが、これらは一例にすぎず、上記の記載に限定されるものではない。
Further, it may be set whether or not to perform endian conversion for each word or for each half word by an address signal.
As described above, the endian conversion circuit, the endian conversion method, and the microcontroller according to the present invention have been described based on the embodiments. However, these are merely examples, and the present invention is not limited to the above description.

以上説明した複数の実施の形態に関し、さらに以下の付記を開示する。
(付記1) アドレス信号の最下位ビットをドントケアビットとして番地指令が行われるデータ保持部と、
前記データ保持部へアクセスする前記アドレス信号の前記最下位ビットの値に基づいて、前記データ保持部への書き込みデータ、または前記データ保持部からの読み出しデータに対してエンディアン変換を行うエンディアン変換部と、
を有することを特徴とするエンディアン変換回路。
The following additional notes are further disclosed with respect to the plurality of embodiments described above.
(Supplementary note 1) A data holding unit in which an address command is performed with the least significant bit of the address signal as a don't care bit;
An endian conversion unit that performs endian conversion on write data to the data holding unit or read data from the data holding unit based on the value of the least significant bit of the address signal that accesses the data holding unit; ,
An endian conversion circuit comprising:

(付記2) 前記データ保持部への書き込み時または前記データ保持部からの読み出し時のアクセスサイズを検出するアクセスサイズ検出部を有し、前記アクセスサイズ検出部は、前記アクセスサイズが複数バイトの場合に、前記エンディアン変換を有効にすることを特徴とする付記1記載のエンディアン変換回路。   (Additional remark 2) It has an access size detection part which detects the access size at the time of the writing to the said data holding part or the reading from the said data holding part, and the said access size detection part is when the said access size is multiple bytes The endian conversion circuit according to appendix 1, wherein the endian conversion is enabled.

(付記3) 前記アクセスサイズ検出部は、前記アクセスサイズが、ワードまたはハーフワードの場合に前記エンディアン変換を有効にすることを特徴とする付記2記載のエンディアン変換回路。   (Additional remark 3) The said endian conversion circuit of Additional remark 2 characterized by the said access size detection part validating the said endian conversion, when the said access size is a word or a halfword.

(付記4) アドレス信号の最下位ビットをドントケアビットとして処理するデータ保持部へアクセスするアドレス信号が、前記データ保持部の偶数アドレスまたは奇数アドレスのいずれを指定しているのか判定し、
前記判定結果に基づきエンディアン変換部が、前記データ保持部への書き込みデータ、または前記データ保持部からの読み出しデータに対してエンディアン変換を行うことを特徴とするエンディアン変換方法。
(Supplementary Note 4) Determine whether an address signal for accessing the data holding unit that processes the least significant bit of the address signal as a don't care bit specifies an even address or an odd address of the data holding unit,
An endian conversion method in which an endian conversion unit performs endian conversion on write data to the data holding unit or read data from the data holding unit based on the determination result.

(付記5) 前記データ保持部への書き込み時または前記データ保持部からの読み出し時のアクセスサイズを検出し、前記アクセスサイズが複数バイトの場合に、前記エンディアン変換を有効にすることを特徴とする付記4記載のエンディアン変換方法。   (Supplementary Note 5) The access size at the time of writing to the data holding unit or at the time of reading from the data holding unit is detected, and the endian conversion is enabled when the access size is a plurality of bytes. The endian conversion method according to appendix 4.

(付記6) 前記アクセスサイズが、ワードまたはハーフワードの場合に前記エンディアン変換を有効にすることを特徴とする付記5記載のエンディアン変換方法。
(付記7) アドレス信号の最下位ビットをドントケアビットとして処理するデータ保持部と、
エンディアン変換を行うか否かの情報を、前記データ保持部へアクセスする前記アドレス信号の最下位ビットに書き込み、前記データ保持部にアクセスするプロセッサと、
前記アドレス信号の前記最下位ビットに基づき、前記データ保持部への書き込みデータ、または前記データ保持部からの読み出しデータに対してエンディアン変換を行うエンディアン変換部と、を有することを特徴とするマイクロコントローラ。
(Supplementary note 6) The endian conversion method according to supplementary note 5, wherein the endian conversion is enabled when the access size is a word or a halfword.
(Appendix 7) A data holding unit that processes the least significant bit of the address signal as a don't care bit;
Information on whether or not to perform endian conversion is written in the least significant bit of the address signal that accesses the data holding unit, and a processor that accesses the data holding unit;
A microcontroller comprising: an endian conversion unit for performing endian conversion on write data to the data holding unit or read data from the data holding unit based on the least significant bit of the address signal .

(付記8) 前記データ保持部への書き込み時または前記データ保持部からの読み出し時の、前記プロセッサからのアクセスサイズを検出するアクセスサイズ検出部を有し、前記アクセスサイズ検出部は、前記アクセスサイズが複数バイトの場合に、前記エンディアン変換を有効にすることを特徴とする付記7記載のマイクロコントローラ。   (Additional remark 8) It has the access size detection part which detects the access size from the said processor at the time of the writing to the said data holding part or the reading from the said data holding part, The said access size detection part is the said access size The microcontroller according to appendix 7, wherein the endian conversion is validated when is a plurality of bytes.

(付記9) 前記アクセスサイズ検出部は、前記アクセスサイズが、ワードまたはハーフワードの場合に前記エンディアン変換を有効にすることを特徴とする付記8記載のマイクロコントローラ。   (Additional remark 9) The said access size detection part validates the said endian conversion, when the said access size is a word or a halfword, The microcontroller of Additional remark 8 characterized by the above-mentioned.

(付記10) 前記エンディアン変換部は、通信処理を行う通信マクロ内に配置されることを特徴とする付記7乃至9に記載のマイクロコントローラ。   (Supplementary Note 10) The microcontroller according to any one of Supplementary Notes 7 to 9, wherein the endian conversion unit is arranged in a communication macro that performs communication processing.

10 エンディアン変換回路
11 データ保持部
12 エンディアン変換部
d1,d1a データ
10 Endian conversion circuit 11 Data holding unit 12 Endian conversion unit d1, d1a Data

Claims (6)

アドレス信号の最下位ビットをドントケアビットとして番地指令が行われるデータ保持部と、
前記データ保持部へアクセスする前記アドレス信号の前記最下位ビットの値に基づいて、前記データ保持部への書き込みデータ、または前記データ保持部からの読み出しデータに対してエンディアン変換を行うエンディアン変換部と、
を有することを特徴とするエンディアン変換回路。
A data holding unit in which an address command is performed using the least significant bit of the address signal as a don't care bit;
An endian conversion unit that performs endian conversion on write data to the data holding unit or read data from the data holding unit based on the value of the least significant bit of the address signal that accesses the data holding unit; ,
An endian conversion circuit comprising:
前記データ保持部への書き込み時または前記データ保持部からの読み出し時のアクセスサイズを検出するアクセスサイズ検出部を有し、前記アクセスサイズ検出部は、前記アクセスサイズが複数バイトの場合に、前記エンディアン変換を有効にすることを特徴とする請求項1記載のエンディアン変換回路。   An access size detection unit that detects an access size at the time of writing to the data holding unit or at the time of reading from the data holding unit; and the access size detection unit is configured to detect the endian when the access size is a plurality of bytes. 2. The endian conversion circuit according to claim 1, wherein the conversion is enabled. アドレス信号の最下位ビットをドントケアビットとして処理するデータ保持部へアクセスするアドレス信号が、前記データ保持部の偶数アドレスまたは奇数アドレスのいずれを指定しているのか判定し、
前記判定結果に基づきエンディアン変換部が、前記データ保持部への書き込みデータ、または前記データ保持部からの読み出しデータに対してエンディアン変換を行うことを特徴とするエンディアン変換方法。
Determine whether the address signal that accesses the data holding unit that processes the least significant bit of the address signal as a don't care bit specifies an even address or an odd address of the data holding unit,
An endian conversion method in which an endian conversion unit performs endian conversion on write data to the data holding unit or read data from the data holding unit based on the determination result.
前記データ保持部への書き込み時または前記データ保持部からの読み出し時のアクセスサイズを検出し、前記アクセスサイズが複数バイトの場合に、前記エンディアン変換を有効にすることを特徴とする請求項3記載のエンディアン変換方法。   4. The access size at the time of writing to the data holding unit or at the time of reading from the data holding unit is detected, and the endian conversion is validated when the access size is a plurality of bytes. Endian conversion method. アドレス信号の最下位ビットをドントケアビットとして処理するデータ保持部と、
エンディアン変換を行うか否かの情報を、前記データ保持部へアクセスする前記アドレス信号の最下位ビットに書き込み、前記データ保持部にアクセスするプロセッサと、
前記アドレス信号の前記最下位ビットに基づき、前記データ保持部への書き込みデータ、または前記データ保持部からの読み出しデータに対してエンディアン変換を行うエンディアン変換部と、
を有することを特徴とするマイクロコントローラ。
A data holding unit that processes the least significant bit of the address signal as a don't care bit;
Information on whether or not to perform endian conversion is written in the least significant bit of the address signal that accesses the data holding unit, and a processor that accesses the data holding unit;
Based on the least significant bit of the address signal, an endian conversion unit that performs endian conversion on write data to the data holding unit or read data from the data holding unit;
A microcontroller comprising:
前記データ保持部への書き込み時または前記データ保持部からの読み出し時の、前記プロセッサからのアクセスサイズを検出するアクセスサイズ検出部を有し、前記アクセスサイズ検出部は、前記アクセスサイズが複数バイトの場合に、前記エンディアン変換を有効にすることを特徴とする請求項5記載のマイクロコントローラ。   An access size detecting unit that detects an access size from the processor at the time of writing to the data holding unit or at the time of reading from the data holding unit; and the access size detecting unit has an access size of a plurality of bytes. 6. The microcontroller according to claim 5, wherein the endian conversion is enabled.
JP2009189097A 2009-08-18 2009-08-18 Endian conversion circuit, endian conversion method and microcontroller Pending JP2011039964A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009189097A JP2011039964A (en) 2009-08-18 2009-08-18 Endian conversion circuit, endian conversion method and microcontroller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009189097A JP2011039964A (en) 2009-08-18 2009-08-18 Endian conversion circuit, endian conversion method and microcontroller

Publications (1)

Publication Number Publication Date
JP2011039964A true JP2011039964A (en) 2011-02-24

Family

ID=43767637

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009189097A Pending JP2011039964A (en) 2009-08-18 2009-08-18 Endian conversion circuit, endian conversion method and microcontroller

Country Status (1)

Country Link
JP (1) JP2011039964A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012127590A1 (en) * 2011-03-18 2012-09-27 富士通株式会社 Endian conversion method and system
CN112835842A (en) * 2021-03-05 2021-05-25 深圳市汇顶科技股份有限公司 Terminal sequence processing method, circuit, chip and electronic terminal

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012127590A1 (en) * 2011-03-18 2012-09-27 富士通株式会社 Endian conversion method and system
JP5733385B2 (en) * 2011-03-18 2015-06-10 富士通株式会社 Endian conversion method and system
US9448931B2 (en) 2011-03-18 2016-09-20 Fujitsu Limited Endian conversion method and system
CN112835842A (en) * 2021-03-05 2021-05-25 深圳市汇顶科技股份有限公司 Terminal sequence processing method, circuit, chip and electronic terminal
CN112835842B (en) * 2021-03-05 2024-04-30 深圳市汇顶科技股份有限公司 Terminal sequence processing method, circuit, chip and electronic terminal

Similar Documents

Publication Publication Date Title
JP5217929B2 (en) Interrupt detection device and information processing system
JP2008090375A (en) Interrupt control system and storage control system using the same
KR101913968B1 (en) Micro computer
JP5128093B2 (en) Device that invalidates multiple address cache entries
JP2013092852A (en) Bus connection circuit, semiconductor device, and operation method for bus connection circuit
JP5664187B2 (en) Interconnect apparatus and control method thereof
JP2011039964A (en) Endian conversion circuit, endian conversion method and microcontroller
JP2000322259A (en) Data processor
WO2009098737A1 (en) External device access apparatus, its controlling method and system lsi
CN104750634B (en) Read method and system, InterWorking Equipment controller
JP2006243811A (en) Dma transfer system and dma transfer method
JP2004355432A (en) Endian conversion circuit
US20020188771A1 (en) Direct memory access controller for carrying out data transfer by determining whether or not burst access can be utilized in an external bus and access control method thereof
JP3611049B2 (en) Internal register circuit
TWI427481B (en) A bridge system, a device and a method of the isa bus
JP5364641B2 (en) Information processing device
JP2005148904A (en) Ring buffer controller and ring buffer control method
JP6570046B2 (en) DMA controller, realization method and computer storage medium
JP3269435B2 (en) Bus interface unit
JP4860811B2 (en) Microcomputer
JPH09305530A (en) Dma controller
JP2004118235A (en) Data processor
JPH02287625A (en) Single chip microcomputer
JP2004280664A (en) Bit arithmetic unit
KR20050037695A (en) Flash memory controller