JP2009015689A - Interface device - Google Patents

Interface device Download PDF

Info

Publication number
JP2009015689A
JP2009015689A JP2007178315A JP2007178315A JP2009015689A JP 2009015689 A JP2009015689 A JP 2009015689A JP 2007178315 A JP2007178315 A JP 2007178315A JP 2007178315 A JP2007178315 A JP 2007178315A JP 2009015689 A JP2009015689 A JP 2009015689A
Authority
JP
Japan
Prior art keywords
output
data
signal
input
control signal
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.)
Withdrawn
Application number
JP2007178315A
Other languages
Japanese (ja)
Inventor
Masaru Ito
大 伊藤
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.)
Olympus Corp
Original Assignee
Olympus Corp
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 Olympus Corp filed Critical Olympus Corp
Priority to JP2007178315A priority Critical patent/JP2009015689A/en
Publication of JP2009015689A publication Critical patent/JP2009015689A/en
Withdrawn legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide an interface device for a new communication protocol without re-developing ASIC. <P>SOLUTION: A Flash ROM 12 stores a program for controlling communication with an external device according to a communication protocol. An output data buffer control circuit 6 and an output signal synchronization circuit 7 control the synchronization of data and control signals to be transmitted to the external device. A CPU 1 generates the control signals, which are transmitted to the external device, according to the program. <P>COPYRIGHT: (C)2009,JPO&INPIT

Description

本発明は、外部装置と通信を行うインターフェース装置に関する。   The present invention relates to an interface device that communicates with an external device.

各種電子機器の中にはASIC(特定用途向けIC)を備えたものがある。ASIC等のデバイスはインターフェース装置を有し、このインターフェース装置を介して、機器内に設けられる他のデバイスとの間でデータの授受を行う。このようなインターフェース装置として、互いに異なるデータ転送方式を有する複数のインターフェース部の中から、動作させるインターフェース部を選択するセレクタを具備することにより、機器のバージョンアップ等により、他の周辺デバイスが採用する通信プロトコルが更新された際に、ASICの再開発を行うことなく通信プロトコルの更新に対応するものがある(例えば特許文献1参照)。
特開2004−348580号公報
Some electronic devices have ASICs (application-specific ICs). A device such as an ASIC has an interface device, and exchanges data with other devices provided in the apparatus via the interface device. As such an interface device, by including a selector for selecting an interface unit to be operated from among a plurality of interface units having different data transfer methods, other peripheral devices are employed by upgrading the version of the device. When the communication protocol is updated, there is one that supports the update of the communication protocol without redeveloping the ASIC (see, for example, Patent Document 1).
JP 2004-348580 A

しかしながら、従来のインターフェース装置において、更新された通信プロトコルが、予め用意されたインターフェース装置では対応していないものである場合に、ASICの再開発が必要になり、余計な開発費や作業工数が発生するという観点については記載されていない。   However, in the conventional interface device, if the updated communication protocol is not compatible with the interface device prepared in advance, it will be necessary to redevelop the ASIC, resulting in extra development costs and man-hours. It does not describe the point of view.

本発明は、上述した課題に鑑みてなされたものであって、ASICの再開発を行うことなく新規な通信プロトコルに対応することができるインターフェース装置を提供することを目的とする。   The present invention has been made in view of the above-described problems, and an object of the present invention is to provide an interface device that can support a new communication protocol without re-developing an ASIC.

本発明者は、CPUを動作させるためのプログラムを変更することにより、ASICの再開発を行うことなく新規な通信プロトコルに対応可能とすることに着目した。特に、外部装置との間で送信又は受信されるデータと制御信号との同期を制御するための、各通信プロトコルに共通の構成を設けておき、通信プロトコル毎に異なるデータと制御信号との同期方法をプログラムの変更により実現することに着想した。   The inventor of the present invention has focused on changing the program for operating the CPU so that it can cope with a new communication protocol without redeveloping the ASIC. In particular, a common configuration is provided for each communication protocol for controlling the synchronization between data transmitted or received with an external device and a control signal, and synchronization between data and control signals that differ for each communication protocol is provided. The idea was to realize the method by changing the program.

本発明は、上記の点に鑑み、通信プロトコルに従って外部装置との間で行う通信を制御するためのプログラムを記憶する記憶部(図1のFlashROM12に対応)と、前記外部装置との間で送信又は受信されるデータと制御信号との同期を制御する同期制御部(図1の入力データバッファ制御回路4、出力データバッファ制御回路6、出力信号同期回路7、図9の入力データバッファ制御回路4、出力データバッファ制御回路6、出力信号同期回路15に対応)と、前記プログラムに従って、前記外部装置へ送信される前記制御信号を生成するCPUとを有するインターフェース装置である。   In view of the above points, the present invention transmits between a storage unit (corresponding to FlashROM 12 in FIG. 1) for storing a program for controlling communication performed with an external device according to a communication protocol, and the external device. Or a synchronization control unit for controlling the synchronization between received data and a control signal (the input data buffer control circuit 4, the output data buffer control circuit 6, the output signal synchronization circuit 7 in FIG. 1, and the input data buffer control circuit 4 in FIG. 9). , Corresponding to the output data buffer control circuit 6 and the output signal synchronization circuit 15), and a CPU that generates the control signal to be transmitted to the external device according to the program.

また、本発明の通信インターフェース装置は、前記データを一時記憶するデータバッファ(図1の入力データバッファ3、出力データバッファ5に対応)をさらに有し、前記同期制御部は、前記データバッファに記憶された前記データの転送を、前記CPU又は前記外部装置から入力される前記制御信号に基づき制御することを特徴とする。   The communication interface device of the present invention further includes a data buffer (corresponding to the input data buffer 3 and the output data buffer 5 in FIG. 1) for temporarily storing the data, and the synchronization control unit stores the data in the data buffer. The transferred data is controlled based on the control signal input from the CPU or the external device.

また、本発明の通信インターフェース装置において、前記同期制御部(図3の出力データバッファ制御回路6に対応)は、前記CPUによってレジスタ(図3のデータ出力許可レジスタ6aに対応)に格納された値と、前記外部装置から入力される前記制御信号の値との少なくとも一方に基づいて、前記データバッファに記憶された前記データの転送を制御することを特徴とする。   In the communication interface device of the present invention, the synchronization control unit (corresponding to the output data buffer control circuit 6 in FIG. 3) is a value stored in a register (corresponding to the data output permission register 6a in FIG. 3) by the CPU. And the transfer of the data stored in the data buffer is controlled based on at least one of the control signal value input from the external device.

また、本発明の通信インターフェース装置において、前記同期制御部(図3の出力信号同期回路7に対応)は、前記データバッファに記憶された前記データの転送を制御する信号(図3のリードリクエスト信号rdreqに対応)と、前記CPUによって生成された前記制御信号とに基づいて、前記外部装置へ送信される前記制御信号を制御することを特徴とする。   In the communication interface device of the present invention, the synchronization control unit (corresponding to the output signal synchronization circuit 7 in FIG. 3) controls the transfer of the data stored in the data buffer (read request signal in FIG. 3). The control signal transmitted to the external device is controlled based on the control signal generated by the CPU and the control signal generated by the CPU.

また、本発明の通信インターフェース装置において、前記同期制御部(図8の入力データバッファ制御回路4に対応)は、前記CPUによって生成された前記制御信号の、前記外部装置への出力を、前記データバッファに記憶された前記データの量に応じて制御することを特徴とする。   In the communication interface device of the present invention, the synchronization control unit (corresponding to the input data buffer control circuit 4 in FIG. 8) outputs the control signal generated by the CPU to the external device. Control is performed according to the amount of the data stored in the buffer.

また、本発明の通信インターフェース装置において、前記外部装置から入力される前記制御信号を一時記憶する入力制御信号バッファ(図1の入力制御信号バッファ2に対応)をさらに有することを特徴とする。   The communication interface device of the present invention further includes an input control signal buffer (corresponding to the input control signal buffer 2 in FIG. 1) for temporarily storing the control signal input from the external device.

また、本発明の通信インターフェース装置において、前記同期制御部(図13の入力データバッファ制御回路4に対応)は、前記外部装置から入力される前記制御信号、或いは前記外部装置から入力されるデータが変化したときのみ、前記データバッファへの前記データの書き込み或いは前記入力制御信号バッファへの前記制御信号の書込みを許可することを特徴とする。   In the communication interface device of the present invention, the synchronization control unit (corresponding to the input data buffer control circuit 4 in FIG. 13) receives the control signal input from the external device or the data input from the external device. Only when it changes, writing of the data to the data buffer or writing of the control signal to the input control signal buffer is permitted.

また、本発明の通信インターフェース装置において、前記外部装置へ送信される前記制御信号を一時記憶する出力制御信号バッファ(図9の出力制御信号バッファ14に対応)をさらに有することを特徴とする。   The communication interface device according to the present invention further includes an output control signal buffer (corresponding to the output control signal buffer 14 in FIG. 9) for temporarily storing the control signal transmitted to the external device.

上記において、括弧で括った部分の記述は、後述する本発明の実施形態と本発明の構成要素とを便宜的に対応付けるためのものであり、この記述によって本発明の内容が限定されるわけではない。   In the above description, the description in parentheses is for the purpose of associating the embodiment of the present invention described later with the components of the present invention for convenience, and the contents of the present invention are not limited by this description. Absent.

本発明によれば、CPUを動作させるためのプログラムを変更することにより、ASICの再開発を行うことなく新規な通信プロトコルに対応することができるという効果が得られる。   According to the present invention, by changing the program for operating the CPU, it is possible to cope with a new communication protocol without redeveloping the ASIC.

以下、図面を参照し、本発明の実施形態を説明する。   Hereinafter, embodiments of the present invention will be described with reference to the drawings.

(第1の実施形態)
まず、本発明の第1の実施形態を説明する。図1は、本実施形態によるインターフェース装置の構成を示している。図1において、インターフェース装置は、CPU1、入力制御信号バッファ2、入力データバッファ3、入力データバッファ制御回路4、出力データバッファ5、出力データバッファ制御回路6、出力信号同期回路7、内部回路I/F8、内部回路9、メモリコントローラ10、SDRAM11、FlashROM12、及びバス13を有している。
(First embodiment)
First, a first embodiment of the present invention will be described. FIG. 1 shows the configuration of the interface device according to the present embodiment. In FIG. 1, an interface device includes a CPU 1, an input control signal buffer 2, an input data buffer 3, an input data buffer control circuit 4, an output data buffer 5, an output data buffer control circuit 6, an output signal synchronization circuit 7, an internal circuit I / F8, internal circuit 9, memory controller 10, SDRAM 11, FlashROM 12, and bus 13 are provided.

図2はCPU1の構成を示している。CPU1は、ALU1a(演算器)、汎用レジスタ1b、ロードストアユニット1c、割込みコントローラ1d、レジスタ1e、立ち下がり微分回路1f、立ち上がり微分回路1g、及びセレクタ1hを有している。ALU1aは演算を実行する。汎用レジスタ1bは、ALU1aが演算に用いる値及び演算の実行結果を記憶する。ロードストアユニット1cは、バス13を介してデータの転送を実行する。割込みコントローラ1dは、入力される割込み信号に基づいてCPU1に対する割込みの発生を検出する。レジスタ1eは、ALU1aが演算に用いる値及び演算の実行結果を記憶する。   FIG. 2 shows the configuration of the CPU 1. The CPU 1 includes an ALU 1a (arithmetic unit), a general-purpose register 1b, a load / store unit 1c, an interrupt controller 1d, a register 1e, a falling differentiation circuit 1f, a rising differentiation circuit 1g, and a selector 1h. The ALU 1a performs an operation. The general-purpose register 1b stores a value used by the ALU 1a for an operation and an execution result of the operation. The load / store unit 1 c executes data transfer via the bus 13. The interrupt controller 1d detects the occurrence of an interrupt to the CPU 1 based on the input interrupt signal. The register 1e stores a value used by the ALU 1a for an operation and an execution result of the operation.

立ち下がり微分回路1fは、入力信号の立ち下がりに対応した信号を出力する。立ち上がり微分回路1gは、入力信号の立ち上がりに対応した信号を出力する。セレクタ1hは、レジスタ1e、立ち下がり微分回路1f、及び立ち上がり微分回路1gのいずれかの出力を選択して出力する。汎用レジスタ1bの各ビットが各制御信号に対応しており、基本的にはALU1aが汎用レジスタ1bに値を書き込むと、その値が制御信号(出力)として外部装置(外部デバイス)へ出力される。ただし、レジスタ1eの出力が立ち下がり微分回路1f及び立ち上がり微分回路1gに接続されており、立ち下がり微分回路1f及び立ち上がり微分回路1gの出力とレジスタ1eの出力のうち、セレクタ1hによって選択された出力が外部装置へ出力される。以上の構成により、任意のレベルの出力を任意のタイミングで出力する以外に、パルス状の波形を出力することも可能である。   The falling differentiation circuit 1f outputs a signal corresponding to the falling edge of the input signal. The rising differentiation circuit 1g outputs a signal corresponding to the rising edge of the input signal. The selector 1h selects and outputs one of the outputs of the register 1e, the falling differentiation circuit 1f, and the rising differentiation circuit 1g. Each bit of the general-purpose register 1b corresponds to each control signal. Basically, when the ALU 1a writes a value to the general-purpose register 1b, the value is output as a control signal (output) to an external device (external device). . However, the output of the register 1e is connected to the falling differentiation circuit 1f and the rising differentiation circuit 1g, and the output selected by the selector 1h among the outputs of the falling differentiation circuit 1f and the rising differentiation circuit 1g and the output of the register 1e. Is output to the external device. With the configuration described above, it is also possible to output a pulse-like waveform in addition to outputting an arbitrary level of output at an arbitrary timing.

図1において、入力制御信号バッファ2は、外部装置から入力される制御信号(入力)を一時記憶する。入力データバッファ3は、外部装置から入力されるデータを一時記憶する。入力データバッファ制御回路4は入力データバッファ3を制御する。出力データバッファ5は、外部装置へ出力されるデータを一時記憶する。出力データバッファ制御回路6は出力データバッファ5を制御する。出力信号同期回路7は、外部装置への制御信号(出力)を発生することが可能であり、外部装置へ出力されるデータ及び制御信号(出力)の同期を制御する。内部回路I/F8は入力データバッファ3及び出力データバッファ5と内部回路9との間でデータを転送する。内部回路9は所定のデータ処理を実行する。   In FIG. 1, an input control signal buffer 2 temporarily stores a control signal (input) input from an external device. The input data buffer 3 temporarily stores data input from an external device. The input data buffer control circuit 4 controls the input data buffer 3. The output data buffer 5 temporarily stores data output to the external device. The output data buffer control circuit 6 controls the output data buffer 5. The output signal synchronization circuit 7 can generate a control signal (output) to an external device, and controls the synchronization of data output to the external device and the control signal (output). The internal circuit I / F 8 transfers data between the input data buffer 3 and output data buffer 5 and the internal circuit 9. The internal circuit 9 executes predetermined data processing.

メモリコントローラ10はCPU1によるSDRAM11及びFlashROM12へのアクセスを制御する。SDRAM11は、CPU1が作業領域として使用するメモリである。FlashROM12は、通信プロトコルに従って外部装置と行う通信を制御するための書き換え可能なプログラムを記憶する。   The memory controller 10 controls access to the SDRAM 11 and the Flash ROM 12 by the CPU 1. The SDRAM 11 is a memory that the CPU 1 uses as a work area. The FlashROM 12 stores a rewritable program for controlling communication performed with an external device according to a communication protocol.

本実施形態によるインターフェース装置の動作の概略は以下のようになる。CPU1の命令を記録したプログラムはFlashROM12に格納されている。CPU1に駆動電力が供給されてリセットが解除されると、CPU1はメモリコントローラ10を介してFlashROM12からプログラムを読み出し、SDRAM11に展開する。プログラムの展開後、CPU1はSDRAM11から命令をフェッチして動作する。CPU1は、内部回路9の動作状態を判断すると共に、入力制御信号バッファ2に毎クロック(毎サイクル)書き込まれる外部装置からの制御信号(入力)を総合的に判断し、必要に応じて入力データバッファ制御回路4や出力データバッファ制御回路6を制御すると同時に、外部装置への制御信号(出力)を生成する。   The outline of the operation of the interface apparatus according to the present embodiment is as follows. A program that records instructions of the CPU 1 is stored in the Flash ROM 12. When the drive power is supplied to the CPU 1 and the reset is released, the CPU 1 reads the program from the Flash ROM 12 via the memory controller 10 and develops it in the SDRAM 11. After the development of the program, the CPU 1 operates by fetching an instruction from the SDRAM 11. The CPU 1 determines the operation state of the internal circuit 9 and comprehensively determines the control signal (input) from the external device written to the input control signal buffer 2 at every clock (every cycle), and input data as necessary. At the same time as controlling the buffer control circuit 4 and the output data buffer control circuit 6, a control signal (output) to an external device is generated.

図3は出力データバッファ制御回路6及び出力信号同期回路7の構成を示している。出力データバッファ制御回路6は、データ出力許可レジスタ6a、AND回路6b、セレクタ6c、及びAND回路6dを有している。データ出力許可レジスタ6aは、データの出力を許可するか否かを示す値を記憶する。AND回路6bは、データ出力許可レジスタ6aの出力と、外部装置から入力される制御信号(入力)とのAND演算結果を出力する。   FIG. 3 shows the configuration of the output data buffer control circuit 6 and the output signal synchronization circuit 7. The output data buffer control circuit 6 includes a data output permission register 6a, an AND circuit 6b, a selector 6c, and an AND circuit 6d. The data output permission register 6a stores a value indicating whether or not to permit data output. The AND circuit 6b outputs an AND operation result of the output of the data output permission register 6a and the control signal (input) input from the external device.

セレクタ6cはデータ出力許可レジスタ6a及びAND回路6bのいずれかの出力を選択して出力する。AND回路6dは、出力データバッファ5から出力される、出力データバッファ5が空であるか否かを示すエンプティ信号emptyとセレクタ6cの出力とのAND演算結果を出力する。AND回路6dの出力は、出力データバッファ5からのデータの読み出し(出力)を指示するリードリクエスト信号rdreqとなる。   The selector 6c selects and outputs either one of the data output permission register 6a and the AND circuit 6b. The AND circuit 6d outputs an AND operation result of the empty signal “empty” output from the output data buffer 5 and indicating whether or not the output data buffer 5 is empty and the output of the selector 6c. The output of the AND circuit 6d is a read request signal rdreq that instructs reading (output) of data from the output data buffer 5.

データ出力許可レジスタ6aの出力はセレクタ6c及びAND回路6dを介して出力データバッファ5のリードリクエスト信号rdreqの端子に接続されており、データ出力許可レジスタ6aの値を制御することにより、出力データの更新を制御することが可能である。ただし、出力データバッファ5にデータが格納されていない場合には、エンプティ信号emptyがアサートされない(1とならない)ため、リクエスト信号rdreqもアサートされない。   The output of the data output permission register 6a is connected to the terminal of the read request signal rdreq of the output data buffer 5 via the selector 6c and the AND circuit 6d. By controlling the value of the data output permission register 6a, the output data It is possible to control the update. However, when no data is stored in the output data buffer 5, the empty signal empty is not asserted (does not become 1), so the request signal rdreq is not asserted.

一方、リクエスト信号rdreqを外部装置からの制御信号(入力)によって制御することも可能である。セレクタ6cがAND回路6bの出力を選択している場合には、制御信号(入力)がアサートされていなければ、データ出力許可レジスタ6aの状態に関わらず、リードリクエスト信号rdreqはアサートされず、出力データの更新が行われない。この構成により、外部装置からのBUSY信号、WAIT信号、READY信号等に対応して出力データバッファ5を制御することが可能である。   On the other hand, the request signal rdreq can be controlled by a control signal (input) from an external device. When the selector 6c selects the output of the AND circuit 6b, if the control signal (input) is not asserted, the read request signal rdreq is not asserted and output regardless of the state of the data output permission register 6a. Data is not updated. With this configuration, the output data buffer 5 can be controlled in response to a BUSY signal, a WAIT signal, a READY signal, and the like from an external device.

出力信号同期回路7は、フリップフロップ7a,7b、AND回路7c、及びセレクタ7dを有している。フリップフロップ7aは、CPU1によって生成されて外部装置へ出力される制御信号(出力)を保持する。このフリップフロップ7aの動作を制御するイネーブル信号として、AND回路6dからのリードリクエスト信号rdreqが用いられる。この構成により、出力データの更新タイミングと制御信号(出力)の更新タイミングを合わせることが可能となる。   The output signal synchronization circuit 7 includes flip-flops 7a and 7b, an AND circuit 7c, and a selector 7d. The flip-flop 7a holds a control signal (output) generated by the CPU 1 and output to the external device. As an enable signal for controlling the operation of the flip-flop 7a, the read request signal rdreq from the AND circuit 6d is used. With this configuration, it is possible to match the update timing of the output data with the update timing of the control signal (output).

フリップフロップ7bは、出力データバッファ5から出力されるエンプティ信号emptyを保持する。AND回路7cはフリップフロップ7a,7bの出力のAND演算結果を出力する。この構成により、出力データバッファ5にデータが格納されていないとき(エンプティ信号empty=0)に制御信号(出力)として余計な信号が出力されないようにすることが可能となる。セレクタ7dはフリップフロップ7a及びAND回路7cのいずれかの出力を選択して制御信号(出力)として外部装置へ出力する。   The flip-flop 7 b holds the empty signal empty output from the output data buffer 5. The AND circuit 7c outputs an AND operation result of the outputs of the flip-flops 7a and 7b. With this configuration, it is possible to prevent an extra signal from being output as a control signal (output) when no data is stored in the output data buffer 5 (empty signal empty = 0). The selector 7d selects one of the outputs of the flip-flop 7a and the AND circuit 7c, and outputs it to the external device as a control signal (output).

次に、一般的なリクエスト/グラント/バリッドを用いた通信プロトコルの本実施形態での実現方法を説明する。図4は、本実施形態によるインターフェース装置が外部装置へデータを送信する動作を示している。初期状態のデータ出力許可レジスタ6aには0が格納されているものとする。まず、出力データバッファ5に十分なデータが格納されたことをCPU1が確認すると、CPU1は立ち上がり微分回路1gを用いて、外部装置にデータ出力の許可を要求するためのパルス状のリクエスト信号REQを発生する。外部装置はリクエスト信号REQを受け取ると、受信可能状態であれば、データ出力の許可を示すグラント信号GRTを返す。このグラント信号GRTの値は入力制御信号バッファ2に格納される。   Next, a method for realizing a communication protocol using a general request / grant / valid in this embodiment will be described. FIG. 4 shows an operation in which the interface apparatus according to the present embodiment transmits data to an external apparatus. It is assumed that 0 is stored in the data output permission register 6a in the initial state. First, when the CPU 1 confirms that sufficient data has been stored in the output data buffer 5, the CPU 1 uses the rising differentiation circuit 1g to output a pulse-like request signal REQ for requesting permission of data output from the external device. appear. When receiving the request signal REQ, the external device returns a grant signal GRT indicating permission of data output if it is in a receivable state. The value of this grant signal GRT is stored in the input control signal buffer 2.

CPU1は入力制御信号バッファ2からグラント信号GRTの値を読み出す。読み出したグラント信号GRTの値が1であった場合、CPU1は、データの有効性を示すバリッド信号VLDを1にした後、出力データバッファ制御回路6内のデータ出力許可レジスタ6aに1を格納する。また、CPU1は予め出力データバッファ制御回路6を制御し、セレクタ6cの入力をデータ出力許可レジスタ6aの出力側にセットしており、データ出力許可レジスタ6aの値が0から1に変化すると、セレクタ6cの出力も0から1に変化する。   The CPU 1 reads the value of the grant signal GRT from the input control signal buffer 2. If the value of the read grant signal GRT is 1, the CPU 1 sets the valid signal VLD indicating the validity of the data to 1, and then stores 1 in the data output permission register 6a in the output data buffer control circuit 6. . The CPU 1 controls the output data buffer control circuit 6 in advance and sets the input of the selector 6c to the output side of the data output permission register 6a. When the value of the data output permission register 6a changes from 0 to 1, the selector 1 The output of 6c also changes from 0 to 1.

セレクタ6cの出力はAND回路6dに入力される。また、AND回路6dには出力データバッファ5からのエンプティ信号emptyも入力される。出力データバッファ5が空ではないため、エンプティ信号emptyはアサートされている(エンプティ信号empty=1)。したがって、データ出力許可レジスタ6aに1が格納されると、AND回路6dの出力であるリクエスト信号rdreqは1となり、出力データバッファ5からデータが出力される。   The output of the selector 6c is input to the AND circuit 6d. An empty signal empty from the output data buffer 5 is also input to the AND circuit 6d. Since the output data buffer 5 is not empty, the empty signal empty is asserted (empty signal empty = 1). Therefore, when 1 is stored in the data output permission register 6a, the request signal rdreq, which is the output of the AND circuit 6d, becomes 1, and data is output from the output data buffer 5.

一方、CPU1が発生したバリッド信号VLDは出力信号同期回路7のフリップフロップ7aに入力される。リクエスト信号rdreqがフリップフロップ7aのイネーブル信号となっているため、リクエスト信号rdreqが1となったタイミングでフリップフロップ7aの出力が1となる。また、CPU1は予め出力信号同期回路7を制御し、セレクタ7dの入力をAND回路7cの出力側にセットしている。セレクタ7dには、フリップフロップ7aの出力(バリッド信号VLD)とフリップフロップ7bの出力(エンプティ信号empty=1)が入力される。したがって、フリップフロップ7aの出力が0から1に変化すると、セレクタ7dの出力(バリッド信号VLD)も0から1に変化する。以上の動作により、図4に示すように、出力データバッファ5から出力されるデータ及びバリッド信号VLDが同期して更新される。   On the other hand, the valid signal VLD generated by the CPU 1 is input to the flip-flop 7 a of the output signal synchronization circuit 7. Since the request signal rdreq is an enable signal for the flip-flop 7a, the output of the flip-flop 7a becomes 1 when the request signal rdreq becomes 1. The CPU 1 controls the output signal synchronization circuit 7 in advance and sets the input of the selector 7d to the output side of the AND circuit 7c. The output of the flip-flop 7a (valid signal VLD) and the output of the flip-flop 7b (empty signal empty = 1) are input to the selector 7d. Therefore, when the output of the flip-flop 7a changes from 0 to 1, the output of the selector 7d (valid signal VLD) also changes from 0 to 1. By the above operation, as shown in FIG. 4, the data output from the output data buffer 5 and the valid signal VLD are updated synchronously.

図5は、本実施形態によるインターフェース装置が外部装置からデータを受信する動作を示している。外部装置は、自身が送信可能状態であると判断すると、リクエスト信号REQを出力する。このリクエスト信号REQの値は入力制御信号バッファ2に格納される。CPU1は入力制御信号バッファ2からリクエスト信号REQの値を読み出す。読み出したリクエスト信号REQの値が1であった場合、CPU1は、立ち上がり微分回路1gを用いて、パルス状の信号をグラント信号GRTとして外部装置へ出力する。   FIG. 5 shows an operation in which the interface apparatus according to the present embodiment receives data from an external apparatus. When the external device determines that it is in a transmittable state, the external device outputs a request signal REQ. The value of the request signal REQ is stored in the input control signal buffer 2. The CPU 1 reads the value of the request signal REQ from the input control signal buffer 2. When the value of the read request signal REQ is 1, the CPU 1 outputs a pulse signal as a grant signal GRT to an external device using the rising differentiation circuit 1g.

グラント信号GRTを受信した外部装置はデータを出力すると共に、バリッド信号VLDを0から1に変化させて出力する。バリッド信号VLDの値は入力制御信号バッファ2に格納される。CPU1は入力制御信号バッファ2からバリッド信号VLDの値を読み出す。読み出したバリッド信号VLDの値が1であった場合、バリッド信号VLDと同時に入力されて入力データバッファ3に格納されたデータが有効であると判断できるため、CPU1は内部回路I/F8を制御して入力データバッファ3から内部回路9にデータを転送する。バリッド信号VLDとデータの同期を実現する方法は、図4を参照して説明した方法と同様である。   The external device that has received the grant signal GRT outputs data and also changes the valid signal VLD from 0 to 1 and outputs it. The value of the valid signal VLD is stored in the input control signal buffer 2. The CPU 1 reads the value of the valid signal VLD from the input control signal buffer 2. When the value of the read valid signal VLD is 1, since it can be determined that the data input simultaneously with the valid signal VLD and stored in the input data buffer 3 is valid, the CPU 1 controls the internal circuit I / F 8. The data is transferred from the input data buffer 3 to the internal circuit 9. The method for realizing the synchronization between the valid signal VLD and the data is the same as the method described with reference to FIG.

次に、一般的なバリッド/ビジーを用いた通信プロトコルの本実施形態での実現方法を説明する。図6は、本実施形態によるインターフェース装置が外部装置へデータを送信する動作を示している。初期状態のデータ出力許可レジスタ6aには0が格納されているものとする。また、外部装置から出力される、ビジー状態であるか否かを示すビジー信号BSYは初期状態では1である(外部装置がビジー状態ではない)ものとする。まず、出力データバッファ5に十分なデータが格納されたことをCPU1が確認すると、CPU1はバリッド信号VLDを1にした後、データ出力許可レジスタ6aに1を格納する。   Next, a method for realizing a communication protocol using general valid / busy in this embodiment will be described. FIG. 6 shows an operation in which the interface apparatus according to the present embodiment transmits data to an external apparatus. It is assumed that 0 is stored in the data output permission register 6a in the initial state. Further, it is assumed that the busy signal BSY output from the external device and indicating whether it is in the busy state is 1 in the initial state (the external device is not in the busy state). First, when the CPU 1 confirms that sufficient data is stored in the output data buffer 5, the CPU 1 sets the valid signal VLD to 1, and then stores 1 in the data output permission register 6a.

CPU1は予め出力データバッファ制御回路6を制御し、セレクタ6cの入力をAND回路6bの出力側にセットしている。外部装置からのビジー信号BSYはAND回路6bに入力される。データ出力許可レジスタ6aの値が0から1に変化すると、セレクタ6cの出力も0から1に変化する。セレクタ6cの出力はAND回路6dに入力される。また、AND回路6dには出力データバッファ5のエンプティ信号emptyも入力される。出力データバッファ5が空ではないため、エンプティ信号emptyは1である。したがって、データ出力許可レジスタ6aに1が格納されると、AND回路6dの出力であるリクエスト信号rdreqは1となり、出力データバッファ5からデータが出力される。   The CPU 1 controls the output data buffer control circuit 6 in advance and sets the input of the selector 6c to the output side of the AND circuit 6b. The busy signal BSY from the external device is input to the AND circuit 6b. When the value of the data output permission register 6a changes from 0 to 1, the output of the selector 6c also changes from 0 to 1. The output of the selector 6c is input to the AND circuit 6d. The empty signal empty of the output data buffer 5 is also input to the AND circuit 6d. Since the output data buffer 5 is not empty, the empty signal empty is 1. Therefore, when 1 is stored in the data output permission register 6a, the request signal rdreq, which is the output of the AND circuit 6d, becomes 1, and data is output from the output data buffer 5.

一方、CPU1が発生したバリッド信号VLDは出力信号同期回路7のフリップフロップ7aに入力される。リクエスト信号rdreqがフリップフロップ7aのイネーブル信号となっているため、リクエスト信号rdreqが1となったタイミングでフリップフロップ7aの出力が1となる。また、CPU1は予め出力信号同期回路7を制御し、セレクタ7dの入力をAND回路7cの出力側にセットしている。セレクタ7dには、フリップフロップ7aの出力(バリッド信号VLD)とフリップフロップ7bの出力(エンプティ信号empty=1)が入力される。したがって、フリップフロップ7aの出力が0から1に変化すると、セレクタ7dの出力(バリッド信号VLD)も0から1に変化する。以上の動作により、図6に示すように、出力データバッファ5から出力されるデータ及びバリッド信号VLDが同期して更新される。   On the other hand, the valid signal VLD generated by the CPU 1 is input to the flip-flop 7 a of the output signal synchronization circuit 7. Since the request signal rdreq is an enable signal for the flip-flop 7a, the output of the flip-flop 7a becomes 1 when the request signal rdreq becomes 1. The CPU 1 controls the output signal synchronization circuit 7 in advance and sets the input of the selector 7d to the output side of the AND circuit 7c. The output of the flip-flop 7a (valid signal VLD) and the output of the flip-flop 7b (empty signal empty = 1) are input to the selector 7d. Therefore, when the output of the flip-flop 7a changes from 0 to 1, the output of the selector 7d (valid signal VLD) also changes from 0 to 1. By the above operation, as shown in FIG. 6, the data output from the output data buffer 5 and the valid signal VLD are updated synchronously.

外部装置がビジー信号BSYを0にすることで、ビジー状態であることをインターフェース装置に通知すると、このビジー信号BSYはAND回路6bに入力される。このため、AND回路6bから0が出力される。セレクタ6cの入力がAND回路6bの出力側にセットされているため、AND回路6bから0が出力されると、セレクタ6cの出力は0となる。この信号がAND回路6dに入力されるため、AND回路6dの出力であるリクエスト信号rdreqは0となり、出力データバッファ5のデータ更新は行われず、外部装置がビジー状態の間は同一データの出力が継続する。   When the external device sets the busy signal BSY to 0 to notify the interface device that it is busy, the busy signal BSY is input to the AND circuit 6b. Therefore, 0 is output from the AND circuit 6b. Since the input of the selector 6c is set on the output side of the AND circuit 6b, when 0 is output from the AND circuit 6b, the output of the selector 6c becomes 0. Since this signal is input to the AND circuit 6d, the request signal rdreq, which is the output of the AND circuit 6d, becomes 0, the data in the output data buffer 5 is not updated, and the same data is output while the external device is busy. continue.

また、出力データバッファ5にデータが格納されていない場合には、エンプティ信号emptyが0になるため、AND回路7cの出力は0となる。セレクタ7dの入力がAND回路7cの出力側にセットされているため、AND回路7cから0が出力されると、セレクタ7dの出力(バリッド信号VLD)も0となる。この動作によって、外部装置が無効なデータを誤って取得しないようにすることが可能である。   When no data is stored in the output data buffer 5, the empty signal empty is 0, and the output of the AND circuit 7c is 0. Since the input of the selector 7d is set on the output side of the AND circuit 7c, when 0 is output from the AND circuit 7c, the output (valid signal VLD) of the selector 7d is also 0. With this operation, it is possible to prevent the external device from erroneously acquiring invalid data.

図7は、本実施形態によるインターフェース装置が外部装置からデータを受信する動作を示している。また、図8は、この動作を実現する入力データバッファ制御回路4の構成を示している。入力データバッファ制御回路4は入力データ量比較値レジスタ4a、比較回路4b,4c、及びOR回路4dを有している。   FIG. 7 shows an operation in which the interface apparatus according to the present embodiment receives data from an external apparatus. FIG. 8 shows the configuration of the input data buffer control circuit 4 that realizes this operation. The input data buffer control circuit 4 includes an input data amount comparison value register 4a, comparison circuits 4b and 4c, and an OR circuit 4d.

入力データ量比較値レジスタ4aは、データ量の比較に用いる閾値を記憶する。比較回路4bは、入力データバッファ3から出力される、入力データバッファ3に格納されているデータ量を示す信号usedwに基づくデータ量と、入力データ量比較値レジスタ4aに格納されている閾値(≠0)とを比較し、比較結果に応じた信号を出力する。信号usedwに基づくデータ量が閾値と一致した場合には、比較回路4bは1を出力する。また、信号usedwに基づくデータ量が閾値と一致しなかった場合には、比較回路4bは0を出力する。   The input data amount comparison value register 4a stores a threshold value used for data amount comparison. The comparison circuit 4b outputs the data amount based on the signal usedw output from the input data buffer 3 and indicating the data amount stored in the input data buffer 3, and the threshold (≠≠) stored in the input data amount comparison value register 4a. 0) and a signal corresponding to the comparison result is output. When the amount of data based on the signal usedw matches the threshold, the comparison circuit 4b outputs 1. When the data amount based on the signal usedw does not match the threshold value, the comparison circuit 4b outputs 0.

比較回路4cは、入力データバッファ3から出力される信号usedwに基づくデータ量と0とを比較し、比較結果に応じた信号を出力する。信号usedwに基づくデータ量が0と一致した場合には、比較回路4cは1を出力する。また、信号usedwに基づくデータ量が0と一致しなかった場合には、比較回路4cは0を出力する。OR回路4dは比較回路4b,4cの出力のOR演算結果を出力する。OR回路4dから出力された信号は、割込み信号としてCPU1の割込みコントローラ1dに入力される。   The comparison circuit 4c compares the data amount based on the signal usedw output from the input data buffer 3 with 0 and outputs a signal corresponding to the comparison result. When the amount of data based on the signal usedw matches 0, the comparison circuit 4c outputs 1. When the data amount based on the signal usedw does not match 0, the comparison circuit 4c outputs 0. The OR circuit 4d outputs an OR operation result of the outputs of the comparison circuits 4b and 4c. The signal output from the OR circuit 4d is input to the interrupt controller 1d of the CPU 1 as an interrupt signal.

外部装置からデータを受信する場合、インターフェース装置の動作は以下のようになる。外部装置からインターフェース装置にデータ及びバリッド信号VLDが入力されると、データは入力データバッファ3に格納され、バリッド信号VLDの値は入力制御信号バッファ2に格納される。CPU1は入力制御信号バッファ2からバリッド信号VLDの値を読み出す。読み出したバリッド信号VLDの値が1であった場合、バリッド信号VLDと同時に入力されて入力データバッファ3に格納されたデータが有効であると判断できるため、CPU1は内部回路I/F8を制御して入力データバッファ3から内部回路9にデータを転送する。   When data is received from an external device, the operation of the interface device is as follows. When data and a valid signal VLD are input from an external device to the interface device, the data is stored in the input data buffer 3, and the value of the valid signal VLD is stored in the input control signal buffer 2. The CPU 1 reads the value of the valid signal VLD from the input control signal buffer 2. When the value of the read valid signal VLD is 1, since it can be determined that the data input simultaneously with the valid signal VLD and stored in the input data buffer 3 is valid, the CPU 1 controls the internal circuit I / F 8. The data is transferred from the input data buffer 3 to the internal circuit 9.

入力データバッファ3に格納されたデータ量が、入力データ量比較値レジスタ4aに格納されている閾値と一致した場合、比較回路4bは1を出力する。このため、OR回路4dは割込み信号として1を出力する。CPU1は、割込みコントローラ1dにより割込み信号が1となったことを検出すると、ビジー信号BSYを0にして、ビジー状態であることを外部装置に通知する。   When the amount of data stored in the input data buffer 3 matches the threshold stored in the input data amount comparison value register 4a, the comparison circuit 4b outputs 1. For this reason, the OR circuit 4d outputs 1 as an interrupt signal. When the CPU 1 detects that the interrupt signal becomes 1 by the interrupt controller 1d, the CPU 1 sets the busy signal BSY to 0 and notifies the external device that it is busy.

インターフェース装置と外部装置との間のデータ転送に用いるクロックがインターフェース装置のシステムクロックに比べて速い場合、入力制御信号バッファ2及び入力データバッファ3がオーバフローする恐れがある。そこで、入力データバッファ3に格納されたデータ量が、入力データ量比較値レジスタ4aに格納されている閾値に到達した場合には、CPU1に対する割込みを発生し、CPU1がビジー信号BSYを0にすることによって、入力制御信号バッファ2及び入力データバッファ3のオーバフローを防止することが可能となる。   If the clock used for data transfer between the interface device and the external device is faster than the system clock of the interface device, the input control signal buffer 2 and the input data buffer 3 may overflow. Therefore, when the amount of data stored in the input data buffer 3 reaches the threshold value stored in the input data amount comparison value register 4a, an interrupt to the CPU 1 is generated, and the CPU 1 sets the busy signal BSY to 0. As a result, overflow of the input control signal buffer 2 and the input data buffer 3 can be prevented.

CPU1がビジー信号BSYを0にすることによって、インターフェース装置が一旦ビジー状態になった後、入力データバッファ3に格納されたデータ量が0になると、比較回路4cは1を出力する。このため、OR回路4dは割込み信号として1を出力する。CPU1は、割込みコントローラ1dにより割込み信号が1となったことを検出すると、ビジー信号BSYを1にして、ビジー状態ではなくなったことを外部装置に通知する。   When the data amount stored in the input data buffer 3 becomes 0 after the interface device once becomes busy by the CPU 1 setting the busy signal BSY to 0, the comparison circuit 4c outputs 1. For this reason, the OR circuit 4d outputs 1 as an interrupt signal. When the CPU 1 detects that the interrupt signal becomes 1 by the interrupt controller 1d, the CPU 1 sets the busy signal BSY to 1 to notify the external device that it is no longer busy.

なお、CPU1に対する割込みが発生してからCPU1がビジー信号を0にするまでの間に入力データバッファ3に格納されるデータ量をNとし、入力データバッファ3のサイズをMとすると、入力データ量比較値レジスタ4aに設定される値は(M-N)より小さい値となる。また、上記では、入力データバッファ3に格納されたデータ量に応じてCPU1に対して割込みを発生しているが、入力制御信号バッファ2に格納された制御信号量に応じてCPU1に対して上記と同様に割込みを発生してもよい。   If the amount of data stored in the input data buffer 3 between the occurrence of an interrupt to the CPU 1 and the CPU 1 setting the busy signal to 0 is N, and the size of the input data buffer 3 is M, the input data amount The value set in the comparison value register 4a is smaller than (MN). In the above description, an interrupt is generated for the CPU 1 in accordance with the amount of data stored in the input data buffer 3, but the CPU 1 is instructed in accordance with the amount of control signal stored in the input control signal buffer 2. An interrupt may be generated in the same manner as.

以上、一般的な通信プロトコルの実現方法を説明したが、どのような通信プロトコルであっても、上記の通信プロトコルのいずれかに分類される。したがって、新規な通信プロトコルに対応するには、CPUを動作させるためのプログラムを変更すればよい。これにより、ASICの再開発を行うことなく新規な通信プロトコルに対応することができる。また、データバッファに記憶されたデータの転送を、CPU又は外部装置から入力される制御信号に基づいて制御することによって、通信プロトコルに従うデータの送信又は受信と制御信号との同期を実現することができる。   The method for realizing a general communication protocol has been described above, but any communication protocol is classified as one of the above communication protocols. Therefore, in order to support a new communication protocol, a program for operating the CPU may be changed. Thereby, it is possible to cope with a new communication protocol without redeveloping the ASIC. In addition, by controlling the transfer of data stored in the data buffer based on a control signal input from the CPU or an external device, it is possible to realize synchronization of data transmission or reception and control signal according to the communication protocol. it can.

また、図3に示した出力データバッファ制御回路6によって、外部装置からの制御信号の状態変化と、出力データバッファ5に記憶されたデータの転送動作との同期を実現することができる。さらに、図3に示した出力信号同期回路7によって、出力データバッファ5に記憶されたデータの転送動作と、外部装置への制御信号の状態変化との同期を実現することができる。   Further, the output data buffer control circuit 6 shown in FIG. 3 can realize synchronization between the change in the state of the control signal from the external device and the transfer operation of the data stored in the output data buffer 5. Further, the output signal synchronization circuit 7 shown in FIG. 3 can realize the synchronization between the transfer operation of the data stored in the output data buffer 5 and the state change of the control signal to the external device.

また、図8に示した入力データバッファ制御回路4によって、通信プロトコルを破綻させることなく、データの転送動作と制御信号の状態変化との同期を実現することができる。   Further, the input data buffer control circuit 4 shown in FIG. 8 can realize synchronization between the data transfer operation and the control signal state change without breaking the communication protocol.

(第2の実施形態)
次に、本発明の第2の実施形態を説明する。図9は、本実施形態によるインターフェース装置の構成を示している。図9に示すインターフェース装置では、図1に示したインターフェース装置と比較して、CPU1から外部装置へ出力される制御信号(出力)を一時記憶する出力制御信号バッファ14が新たに設けられている。また、図1の出力信号同期回路7の代わりに出力信号同期回路15が設けられている。
(Second Embodiment)
Next, a second embodiment of the present invention will be described. FIG. 9 shows the configuration of the interface device according to the present embodiment. The interface apparatus shown in FIG. 9 is newly provided with an output control signal buffer 14 that temporarily stores a control signal (output) output from the CPU 1 to the external apparatus, as compared with the interface apparatus shown in FIG. Further, an output signal synchronization circuit 15 is provided instead of the output signal synchronization circuit 7 of FIG.

以下、本実施形態によるSPI(シリアル・ペリフェラル・インターフェース)の実現方法を説明する。図10は、本実施形態によるインターフェース装置が外部装置からデータを受信する動作を示している。また、図11は、この動作を実現する出力データバッファ制御回路6及び出力信号同期回路15の構成を示している。   Hereinafter, a method for realizing an SPI (Serial Peripheral Interface) according to the present embodiment will be described. FIG. 10 shows an operation in which the interface apparatus according to the present embodiment receives data from an external apparatus. FIG. 11 shows the configuration of the output data buffer control circuit 6 and the output signal synchronization circuit 15 that realize this operation.

出力データバッファ制御回路6は、図3と同様にデータ出力許可レジスタ6a、AND回路6b、セレクタ6c、及びAND回路6dを有している。また、出力信号同期回路15は、フリップフロップ15a、AND回路15b、及びセレクタ15cを有している。図11には示していないが、制御信号毎に同じ構成の出力信号同期回路15が設けられているものとする。   The output data buffer control circuit 6 includes a data output permission register 6a, an AND circuit 6b, a selector 6c, and an AND circuit 6d as in FIG. The output signal synchronization circuit 15 includes a flip-flop 15a, an AND circuit 15b, and a selector 15c. Although not shown in FIG. 11, it is assumed that an output signal synchronization circuit 15 having the same configuration is provided for each control signal.

フリップフロップ15aは出力データバッファ5のエンプティ信号emptyを保持する。AND回路15bは出力制御信号バッファ14の制御信号出力及びフリップフロップ15aの出力のAND演算結果を出力する。セレクタ15cは、AND回路15bの出力、出力制御信号バッファ14の制御信号出力、及び出力制御信号バッファ14の制御信号入力のいずれかを選択して出力する。   The flip-flop 15 a holds the empty signal empty of the output data buffer 5. The AND circuit 15b outputs an AND operation result of the control signal output of the output control signal buffer 14 and the output of the flip-flop 15a. The selector 15c selects and outputs one of the output of the AND circuit 15b, the control signal output of the output control signal buffer 14, and the control signal input of the output control signal buffer 14.

外部装置へデータを送信する場合、インターフェース装置の動作は以下のようになる。まず、CPU1はチップセレクト信号CSを1にする。チップセレクト信号CSに関する出力信号同期回路15では、セレクタ15cは出力制御信号バッファ14の制御信号入力を選択して出力する。   When data is transmitted to an external device, the operation of the interface device is as follows. First, the CPU 1 sets the chip select signal CS to 1. In the output signal synchronization circuit 15 related to the chip select signal CS, the selector 15c selects and outputs the control signal input of the output control signal buffer 14.

出力データバッファ5には、図12(a)に示すように、アドレスとオペコードからなるデータがCPU1によって予め格納されている。チップセレクト信号CSを1にした後、CPU1はデータ出力許可レジスタ6aに1を格納する。また、CPU1は予め出力データバッファ制御回路6を制御し、セレクタ6cの入力をデータ出力許可レジスタ6aの出力側にセットしており、データ出力許可レジスタ6aの値が0から1に変化すると、セレクタ6cの出力も0から1に変化する。   In the output data buffer 5, as shown in FIG. 12A, data including an address and an operation code is stored in advance by the CPU 1. After setting the chip select signal CS to 1, the CPU 1 stores 1 in the data output permission register 6a. The CPU 1 controls the output data buffer control circuit 6 in advance and sets the input of the selector 6c to the output side of the data output permission register 6a. When the value of the data output permission register 6a changes from 0 to 1, the selector 1 The output of 6c also changes from 0 to 1.

セレクタ6cの出力はAND回路6dに入力される。また、AND回路6dには出力データバッファ5からのエンプティ信号emptyも入力される。出力データバッファ5が空ではないため、エンプティ信号emptyはアサートされている(エンプティ信号empty=1)。したがって、データ出力許可レジスタ6aに1が格納されると、AND回路6dの出力であるリクエスト信号rdreqは1となり、図12(a)に示すデータが、図10に示すデータSIとして出力データバッファ5から順次出力される。   The output of the selector 6c is input to the AND circuit 6d. An empty signal empty from the output data buffer 5 is also input to the AND circuit 6d. Since the output data buffer 5 is not empty, the empty signal empty is asserted (empty signal empty = 1). Therefore, when 1 is stored in the data output permission register 6a, the request signal rdreq output from the AND circuit 6d becomes 1, and the data shown in FIG. 12A becomes the output data buffer 5 as the data SI shown in FIG. Are output sequentially.

また、出力制御信号バッファ14には、図12(b)に示すように、1と0が交互に並んだ値がCPU1によって予め格納されている。チップセレクト信号CSを1にした後、CPU1がデータ出力許可レジスタ6aに1を格納すると、AND回路6dの出力であるリクエスト信号rdreqが1となるのは上記の通りである。このリクエスト信号rdreqは出力制御信号バッファ14にも入力されるため、出力制御信号バッファ14に格納された1と0がクロックCLKに同期して出力され、出力信号同期回路15内のフリップフロップ15aに入力される。フリップフロップ15aは1と0を交互にAND回路15bへ出力する。   Further, as shown in FIG. 12B, the output control signal buffer 14 stores a value in which 1 and 0 are alternately arranged by the CPU 1 in advance. When the CPU 1 stores 1 in the data output permission register 6a after setting the chip select signal CS to 1, the request signal rdreq, which is the output of the AND circuit 6d, becomes 1, as described above. Since this request signal rdreq is also input to the output control signal buffer 14, 1 and 0 stored in the output control signal buffer 14 are output in synchronization with the clock CLK, and are output to the flip-flop 15 a in the output signal synchronization circuit 15. Entered. The flip-flop 15a alternately outputs 1 and 0 to the AND circuit 15b.

CPU1は予め出力信号同期回路15を制御し、セレクタ15cの出力をAND回路15bの出力側にセットしている。エンプティ信号emptyが1であるため、AND回路15bからは1と0が交互に出力される。セレクタ15cはAND回路15bの出力をシリアルクロックSCKとして外部装置へ出力する。   The CPU 1 controls the output signal synchronization circuit 15 in advance and sets the output of the selector 15c to the output side of the AND circuit 15b. Since the empty signal empty is 1, 1 and 0 are alternately output from the AND circuit 15b. The selector 15c outputs the output of the AND circuit 15b to the external device as the serial clock SCK.

通常、CPU1が制御信号を出力するには、ALU1aによる演算と汎用レジスタ1bへの値の格納とが必要なため、クロック毎に値が変化する制御信号をリアルタイムに生成して出力することが困難である。しかし、本実施形態では、予め生成した制御信号を一旦出力制御信号バッファ14にバッファリングし、クロックに同期して制御信号を出力することによって、クロック毎に値が変化する制御信号を出力することができる。したがって、制御信号の値がクロック毎に変化する通信プロトコルに対応することができる。   Usually, since the CPU 1 needs to calculate the ALU 1a and store the value in the general-purpose register 1b in order to output the control signal, it is difficult to generate and output a control signal whose value changes every clock in real time. It is. However, in the present embodiment, the control signal generated in advance is temporarily buffered in the output control signal buffer 14, and the control signal is output in synchronization with the clock, so that the control signal whose value changes for each clock is output. Can do. Therefore, it is possible to cope with a communication protocol in which the value of the control signal changes every clock.

(第3の実施形態)
次に、本発明の第3の実施形態の変形例を説明する。図13は、本実施形態によるインターフェース装置の部分構成を示している。図13に示した構成以外の構成は第1の実施形態又は第2の実施形態と同様である。本実施形態の入力データバッファ制御回路4は、入力データ量比較値レジスタ4a、比較回路4b,4c、OR回路4d、及び微分回路4eを有している。入力データ量比較値レジスタ4a、比較回路4b,4c、及びOR回路4dは図8と同様である。微分回路4eは、外部装置から入力される制御信号の立ち上がり及び立ち下がりに対応した信号を出力する。また、本実施形態ではカウンタ16及びカウンタバッファ17が設けられている。カウンタ16は、クロックに同期して値(カウント値)をカウントアップする。カウンタバッファは、カウンタ16から出力されたカウント値を記憶する。
(Third embodiment)
Next, a modification of the third embodiment of the present invention will be described. FIG. 13 shows a partial configuration of the interface apparatus according to the present embodiment. Configurations other than the configuration shown in FIG. 13 are the same as those in the first embodiment or the second embodiment. The input data buffer control circuit 4 of this embodiment has an input data amount comparison value register 4a, comparison circuits 4b and 4c, an OR circuit 4d, and a differentiation circuit 4e. The input data amount comparison value register 4a, the comparison circuits 4b and 4c, and the OR circuit 4d are the same as those in FIG. The differentiation circuit 4e outputs a signal corresponding to the rise and fall of the control signal input from the external device. In the present embodiment, a counter 16 and a counter buffer 17 are provided. The counter 16 counts up the value (count value) in synchronization with the clock. The counter buffer stores the count value output from the counter 16.

本実施形態では、制御信号の値が変化したときのみ、その値が入力制御信号バッファ2に格納される。したがって、入力制御信号バッファ2に格納された値が保持された期間をCPU1が知ることができない。このため、カウンタ16及びカウンタバッファ17を設け、入力制御信号バッファ2に格納された値が保持された期間をカウント及び記憶するようになっている。また、カウンタバッファ17のオーバフローを防止するため、カウンタバッファ17に格納されている値の量を示す信号usedwが入力データバッファ制御回路4の比較回路4b,4cに入力される。   In this embodiment, the value is stored in the input control signal buffer 2 only when the value of the control signal changes. Therefore, the CPU 1 cannot know the period during which the value stored in the input control signal buffer 2 is held. For this reason, the counter 16 and the counter buffer 17 are provided, and the period during which the value stored in the input control signal buffer 2 is held is counted and stored. In order to prevent overflow of the counter buffer 17, a signal usedw indicating the amount of value stored in the counter buffer 17 is input to the comparison circuits 4 b and 4 c of the input data buffer control circuit 4.

図14は、本実施形態によるインターフェース装置が外部装置からデータを受信する動作を示している。入力制御信号バッファ2には外部装置からのバリッド信号VLDの値が格納されるものとする。また、初期状態では、バリッド信号VLDの値を示すK−1個の値が入力制御信号バッファ2に格納されていると共に、それらに対応したカウント値K−1がカウンタバッファ17に格納されているものとする。また、入力データ量比較値レジスタ4aには入力データ量比較値としてKが格納されているものとする。   FIG. 14 shows an operation in which the interface apparatus according to the present embodiment receives data from an external apparatus. Assume that the input control signal buffer 2 stores the value of the valid signal VLD from the external device. In the initial state, K−1 values indicating the value of the valid signal VLD are stored in the input control signal buffer 2, and the count value K−1 corresponding to them is stored in the counter buffer 17. Shall. Further, it is assumed that K is stored as the input data amount comparison value in the input data amount comparison value register 4a.

外部装置から入力されるバリッド信号VLDが0から1に変化したとき、微分回路4eの出力が0から1に変化する。微分回路4eから出力された信号は、書込みを指示するライトリクエスト信号wrreqとして入力制御信号バッファ2及びカウンタバッファ17に入力される。これによって、そのときのバリッド信号VLDの値(=1)が入力制御信号バッファ2に格納されると共に、カウンタ16から出力されたカウント値(=N)がカウンタバッファ17に格納される。このカウント値Nは、バリッド信号VLDの値が0であった期間の長さを表す。微分回路4eから出力された信号はカウンタ16にも入力され、その信号の値が0から1に変化したときにカウンタ16のカウント値が1に初期化される。   When the valid signal VLD input from the external device changes from 0 to 1, the output of the differentiating circuit 4e changes from 0 to 1. The signal output from the differentiation circuit 4e is input to the input control signal buffer 2 and the counter buffer 17 as a write request signal wrreq instructing writing. Thus, the value (= 1) of the valid signal VLD at that time is stored in the input control signal buffer 2, and the count value (= N) output from the counter 16 is stored in the counter buffer 17. The count value N represents the length of the period when the value of the valid signal VLD is 0. The signal output from the differentiation circuit 4e is also input to the counter 16, and the count value of the counter 16 is initialized to 1 when the value of the signal changes from 0 to 1.

カウンタバッファ17に格納されたカウント値が1つ増加したことによって、カウンタバッファ17から出力される信号usedwの値はKとなる。この値が、入力データ量比較値レジスタ4aに格納されている入力データ量比較値と一致するため、比較回路4bから出力される信号は1となり、OR回路4dから出力される割込み信号も1となる。これによって、CPU1に対する割込みが発生する。   As the count value stored in the counter buffer 17 increases by one, the value of the signal usedw output from the counter buffer 17 becomes K. Since this value matches the input data amount comparison value stored in the input data amount comparison value register 4a, the signal output from the comparison circuit 4b is 1, and the interrupt signal output from the OR circuit 4d is also 1. Become. As a result, an interrupt to the CPU 1 occurs.

割込みが発生すると、CPU1は入力制御信号バッファ2及びカウンタバッファ17に対するリードリクエスト信号rdreqを1にし、入力制御信号バッファ2及びカウンタバッファ17から値を読み出す。続いて、CPU1は、入力制御信号バッファ2から読み出したK個の値と、カウンタバッファ17から読み出したカウント値Kとを対比させ、バリッド信号VLDが0または1であった期間が幾つ分のクロック期間であったのかを判断する。例えば、入力制御信号バッファ2に最後に格納された値(=1)と、カウンタバッファ17に最後に格納された値(=N)とから、バリッド信号VLDが0であった期間がNクロック期間であったとCPU1は判断する。   When an interrupt occurs, the CPU 1 sets a read request signal rdreq for the input control signal buffer 2 and the counter buffer 17 to 1, and reads a value from the input control signal buffer 2 and the counter buffer 17. Subsequently, the CPU 1 compares the K values read from the input control signal buffer 2 with the count value K read from the counter buffer 17, and the number of clocks during which the valid signal VLD is 0 or 1 is several. Determine if it was a period. For example, the period in which the valid signal VLD is 0 is N clock periods based on the last value (= 1) stored in the input control signal buffer 2 and the last value (= N) stored in the counter buffer 17. CPU1 judges that it was.

バリッド信号VLDが0または1であった期間が分かると、その期間に対応する分のデータが有効/無効のどちらであるのかが分かる。CPU1は上記の判断結果に応じて、入力データバッファ3に格納されているデータに対して演算を実行する。バリッド信号VLDの値が1から0に変化したときにも、そのときのバリッド信号VLDの値(=0)が入力制御信号バッファ2に格納されると共に、カウンタ16のカウント値がカウンタバッファ17に格納される。   When the period during which the valid signal VLD is 0 or 1 is known, it can be determined whether the data corresponding to the period is valid or invalid. The CPU 1 performs an operation on the data stored in the input data buffer 3 according to the above determination result. Even when the value of the valid signal VLD changes from 1 to 0, the value (= 0) of the valid signal VLD at that time is stored in the input control signal buffer 2 and the count value of the counter 16 is stored in the counter buffer 17. Stored.

したがって、本実施形態によれば、制御信号の状態に変化があったときにのみ入力制御信号バッファ2への書込みを行う通信プロトコルを実現することができる。また、上記と同様に、微分回路4eから出力される信号をライトリクエスト信号wrreqとして入力データバッファ3に入力させることによって、データの状態に変化があったときにのみ入力データバッファ3への書込みを行う通信プロトコルを実現することもできる。   Therefore, according to the present embodiment, it is possible to realize a communication protocol that performs writing to the input control signal buffer 2 only when the state of the control signal is changed. Similarly to the above, the signal output from the differentiating circuit 4e is input to the input data buffer 3 as the write request signal wrreq, so that writing to the input data buffer 3 is performed only when the data state has changed. The communication protocol to be performed can also be realized.

以上、図面を参照して本発明の実施形態について詳述してきたが、具体的な構成は上記の実施形態に限られるものではなく、本発明の要旨を逸脱しない範囲の設計変更等も含まれる。   As described above, the embodiments of the present invention have been described in detail with reference to the drawings. However, the specific configuration is not limited to the above-described embodiments, and includes design changes and the like without departing from the gist of the present invention. .

本発明の第1の実施形態によるインターフェース装置の構成を示すブロック図である。It is a block diagram which shows the structure of the interface apparatus by the 1st Embodiment of this invention. 本発明の第1の実施形態によるインターフェース装置が備えるCPUの構成を示すブロック図である。It is a block diagram which shows the structure of CPU with which the interface apparatus by the 1st Embodiment of this invention is provided. 本発明の第1の実施形態によるインターフェース装置が備える出力データバッファ制御回路及び出力信号同期回路の構成を示すブロック図である。FIG. 3 is a block diagram illustrating a configuration of an output data buffer control circuit and an output signal synchronization circuit included in the interface device according to the first embodiment of the present invention. 本発明の第1の実施形態によるインターフェース装置が外部装置へデータを送信する動作を示すタイミングチャートである。5 is a timing chart showing an operation of transmitting data to an external device by the interface device according to the first embodiment of the present invention. 本発明の第1の実施形態によるインターフェース装置が外部装置からデータを受信する動作を示すタイミングチャートである。4 is a timing chart showing an operation of receiving data from an external device by the interface device according to the first embodiment of the present invention. 本発明の第1の実施形態によるインターフェース装置が外部装置へデータを送信する動作を示すタイミングチャートである。5 is a timing chart showing an operation of transmitting data to an external device by the interface device according to the first embodiment of the present invention. 本発明の第1の実施形態によるインターフェース装置が外部装置からデータを受信する動作を示すタイミングチャートである。4 is a timing chart showing an operation of receiving data from an external device by the interface device according to the first embodiment of the present invention. 本発明の第1の実施形態によるインターフェース装置が備える入力データバッファ制御回路の構成を示すブロック図である。It is a block diagram which shows the structure of the input data buffer control circuit with which the interface apparatus by the 1st Embodiment of this invention is provided. 本発明の第2の実施形態によるインターフェース装置の構成を示すブロック図である。It is a block diagram which shows the structure of the interface apparatus by the 2nd Embodiment of this invention. 本発明の第2の実施形態によるインターフェース装置が外部装置へデータを送信する動作を示すタイミングチャートである。12 is a timing chart illustrating an operation of an interface device according to the second embodiment of the present invention transmitting data to an external device. 本発明の第2の実施形態によるインターフェース装置が備える出力データバッファ制御回路及び出力信号同期回路の構成を示すブロック図である。It is a block diagram which shows the structure of the output data buffer control circuit with which the interface apparatus by the 2nd Embodiment of this invention is provided, and an output signal synchronizing circuit. 本発明の第2の実施形態によるインターフェース装置が備える出力データバッファ及び出力制御信号バッファに格納されるデータ及び制御信号の状態を示す参考図である。FIG. 9 is a reference diagram illustrating states of data and control signals stored in an output data buffer and an output control signal buffer included in an interface device according to a second embodiment of the present invention. 本発明の第3の実施形態によるインターフェース装置の部分構成を示すブロック図である。It is a block diagram which shows the partial structure of the interface apparatus by the 3rd Embodiment of this invention. 本発明の第3の実施形態によるインターフェース装置が外部装置からデータを受信する動作を示すタイミングチャートである。12 is a timing chart illustrating an operation of an interface device according to the third embodiment of the present invention receiving data from an external device.

符号の説明Explanation of symbols

1・・・CPU、2・・・入力制御信号バッファ、3・・・入力データバッファ、4・・・入力データバッファ制御回路、5・・・出力データバッファ、6・・・出力データバッファ制御回路、7,15・・・出力信号同期回路、8・・・内部回路I/F、9・・・内部回路、10・・・メモリコントローラ、11・・・SDRAM、12・・・FlashROM、13・・・バス、14・・・出力制御信号バッファ、16・・・カウンタ、17・・・カウンタバッファ   DESCRIPTION OF SYMBOLS 1 ... CPU, 2 ... Input control signal buffer, 3 ... Input data buffer, 4 ... Input data buffer control circuit, 5 ... Output data buffer, 6 ... Output data buffer control circuit 7, 15 ... Output signal synchronization circuit, 8 ... Internal circuit I / F, 9 ... Internal circuit, 10 ... Memory controller, 11 ... SDRAM, 12 ... FlashROM, 13. ..Bus 14 ... Output control signal buffer 16 ... Counter 17 ... Counter buffer

Claims (8)

通信プロトコルに従って外部装置と行う通信を制御するためのプログラムを記憶する記憶部と、
前記外部装置との間で送信又は受信されるデータと制御信号との同期を制御する同期制御部と、
前記プログラムに従って、前記外部装置へ送信される前記制御信号を生成するCPUと、
を有するインターフェース装置。
A storage unit for storing a program for controlling communication with an external device according to a communication protocol;
A synchronization control unit that controls synchronization of data and control signals transmitted or received with the external device;
A CPU for generating the control signal to be transmitted to the external device according to the program;
An interface device.
前記データを一時記憶するデータバッファをさらに有し、
前記同期制御部は、前記データバッファに記憶された前記データの転送を、前記CPU又は前記外部装置から入力される前記制御信号に基づき制御する
ことを特徴とする請求項1に記載のインターフェース装置。
A data buffer for temporarily storing the data;
The interface device according to claim 1, wherein the synchronization control unit controls transfer of the data stored in the data buffer based on the control signal input from the CPU or the external device.
前記同期制御部は、前記CPUによってレジスタに格納された値と、前記外部装置から入力される前記制御信号の値との少なくとも一方に基づいて、前記データバッファに記憶された前記データの転送を制御することを特徴とする請求項2に記載のインターフェース装置。   The synchronization control unit controls transfer of the data stored in the data buffer based on at least one of a value stored in a register by the CPU and a value of the control signal input from the external device The interface device according to claim 2, wherein: 前記同期制御部は、前記データバッファに記憶された前記データの転送を制御する信号と、前記CPUによって生成された前記制御信号とに基づいて、前記外部装置へ送信される前記制御信号を制御することを特徴とする請求項2又は請求項3に記載のインターフェース装置。   The synchronization control unit controls the control signal transmitted to the external device based on a signal for controlling transfer of the data stored in the data buffer and the control signal generated by the CPU. The interface device according to claim 2 or claim 3, wherein 前記同期制御部は、前記CPUによって生成された前記制御信号の、前記外部装置への出力を、前記データバッファに記憶された前記データの量に応じて制御することを特徴とする請求項2〜請求項4のいずれかに記載のインターフェース装置。   The synchronization control unit controls the output of the control signal generated by the CPU to the external device in accordance with the amount of the data stored in the data buffer. The interface device according to claim 4. 前記外部装置から入力される前記制御信号を一時記憶する入力制御信号バッファをさらに有することを特徴とする請求項2〜請求項5のいずれかに記載のインターフェース装置。   6. The interface device according to claim 2, further comprising an input control signal buffer for temporarily storing the control signal input from the external device. 前記同期制御部は、前記外部装置から入力される前記制御信号、或いは前記外部装置から入力されるデータが変化したときのみ、前記データバッファへの前記データの書き込み或いは前記入力制御信号バッファへの前記制御信号の書込みを許可することを特徴とする請求項6に記載のインターフェース装置。   The synchronization control unit writes the data into the data buffer or the data into the input control signal buffer only when the control signal input from the external device or the data input from the external device changes. 7. The interface device according to claim 6, wherein writing of the control signal is permitted. 前記外部装置へ送信される前記制御信号を一時記憶する出力制御信号バッファをさらに有することを特徴とする請求項2〜請求項7のいずれかに記載のインターフェース装置。   The interface apparatus according to claim 2, further comprising an output control signal buffer that temporarily stores the control signal transmitted to the external apparatus.
JP2007178315A 2007-07-06 2007-07-06 Interface device Withdrawn JP2009015689A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007178315A JP2009015689A (en) 2007-07-06 2007-07-06 Interface device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007178315A JP2009015689A (en) 2007-07-06 2007-07-06 Interface device

Publications (1)

Publication Number Publication Date
JP2009015689A true JP2009015689A (en) 2009-01-22

Family

ID=40356502

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007178315A Withdrawn JP2009015689A (en) 2007-07-06 2007-07-06 Interface device

Country Status (1)

Country Link
JP (1) JP2009015689A (en)

Similar Documents

Publication Publication Date Title
JPH05274259A (en) Serial input interface circuit
JP2006195714A (en) Resource management device
JP5057360B2 (en) Semiconductor device, data processing device, and access method to storage device
JP5058890B2 (en) Bus control device
JP2009015689A (en) Interface device
KR20050046932A (en) System for checking state of slave devices using i2c bus
US7652503B2 (en) Semiconductor device
JP2011070259A (en) Data transfer device and data transfer method
JP2006126938A (en) Data transfer system and its data transfer method
JP2009163531A (en) Interruption management mechanism and microcomputer
JP2008026996A (en) Electronic equipment
JP5652866B2 (en) Bus arbitration circuit and bus arbitration method
EP1443412A2 (en) Information processing apparatus and memory access arranging method
JP5907558B2 (en) MULTI-INTERVAL TIMER AND ITS CONTROL DEVICE, CONTROL METHOD, AND CONTROL PROGRAM
JP5334173B2 (en) Data transfer system and retry control method
JP5126010B2 (en) Memory access control circuit and image processing apparatus
JP2009271623A (en) Semiconductor storage device and computer system
JP2011022781A (en) Data transfer apparatus, data transfer method and data transfer program
JP2022072003A (en) Register control device
JP6529092B2 (en) Multi-interval timer device, control method thereof and control program
JP6119997B2 (en) Data processing apparatus and data processing apparatus control method
JP2005242929A (en) Accessing method for shared memory and data processor
JP5387155B2 (en) DMA transfer control device and DMA transfer control method
JP5621747B2 (en) Multitask system
JP2005030957A (en) Timer unit

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20100907