JPH01312656A - Control device for receiving buffer - Google Patents

Control device for receiving buffer

Info

Publication number
JPH01312656A
JPH01312656A JP14393188A JP14393188A JPH01312656A JP H01312656 A JPH01312656 A JP H01312656A JP 14393188 A JP14393188 A JP 14393188A JP 14393188 A JP14393188 A JP 14393188A JP H01312656 A JPH01312656 A JP H01312656A
Authority
JP
Japan
Prior art keywords
block
data
flag
received data
written
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.)
Granted
Application number
JP14393188A
Other languages
Japanese (ja)
Other versions
JP2689490B2 (en
Inventor
Masashi Tonomura
外村 昌司
Masatoshi Suwa
諏訪 昌利
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.)
Sony Corp
Original Assignee
Sony 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 Sony Corp filed Critical Sony Corp
Priority to JP63143931A priority Critical patent/JP2689490B2/en
Publication of JPH01312656A publication Critical patent/JPH01312656A/en
Application granted granted Critical
Publication of JP2689490B2 publication Critical patent/JP2689490B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Information Transfer Systems (AREA)
  • Communication Control (AREA)

Abstract

PURPOSE:To enable a high speed operation by selecting a block in which received data is written and reading out data from the selected block by referring to a first flag and a second flag. CONSTITUTION:The block in which the received data is to be written can be selected, and the presence of the received data can be known by seeing the first flag 11. Beside, both processing to write the received data in the block in turn and the processing to read out the data in turn come possible by referring to the second flag 12. The write of the received data and the read of the data can be executed by a block unit by using these flags 11, 12, and simultaneously, flow control can be executed. Thus, the high speed processing comes possible and the flow control is made simple compared with a customary system to process the data by every one byte.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 この発明は、データ通信等の外部システムからのデータ
を使用するシステムに通用され、外部からのデータを貯
えるための受信バッファの制御装置に関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a control device for a reception buffer for storing data from the outside, which is commonly used in systems that use data from an external system, such as data communications.

〔発明の概要〕[Summary of the invention]

この発明では、受信バッファが複数のブロックに分割さ
れ、受信バッファと関連して、ブロックの夫々が占有さ
れているかどうかを示す第1のフラグと、次に受信デー
タが書き込まれるべきブロックを示す第2のフラグと、
次にデータが読み出されるべきブロックを示す第3のフ
ラグと、ブロックがオーバーフローするかどうかを示す
第4のフラグとが形成され、 第1のフラグ及び第2のフラグを参照して受信データが
書き込まれるブロックの選択がなされ、選択されたブロ
ックに受信データが書き込まれ、第1のフラグ及び第3
のフラグを参照して貯えられているデータを読み出すブ
ロックの選択がなされ、選択されたブロックからデータ
の読み出しがされることにより、 ブロックの単位で受信データの書き込み及びデータの読
み出しがなされ、また、フローコントロールが単純とな
り、高速動作が可能となる。
In this invention, the receive buffer is divided into a plurality of blocks, and associated with the receive buffer are a first flag indicating whether each of the blocks is occupied and a second flag indicating the block to which the received data is to be written next. 2 flags and
Next, a third flag indicating the block from which the data is to be read and a fourth flag indicating whether the block will overflow are formed, and the received data is written with reference to the first flag and the second flag. The received data is written to the selected block, and the first flag and the third block are selected.
A block is selected from which stored data is to be read by referring to the flag, and data is read from the selected block, thereby writing received data and reading data in block units. Flow control becomes simple and high-speed operation is possible.

〔従来の技術] データ通信では、受信データを一時的に貯える受信バッ
ファが設けられる。従来の受信バッファの一つとして、
バッファメモリをリング状の構成とみなすリングバッフ
ァが知られている。リングバッファは、書き込みアドレ
スと対応するライトポインタ及び読み出しアドレスと対
応するリードポインタとを形成し、両ポインタを使用し
てフローコントロールを行う構成である。リングバッフ
ァの利点は、バッファの容量を仮想的に常にバッファ容
量分取れることである。
[Prior Art] In data communication, a receive buffer is provided to temporarily store received data. As one of the conventional receive buffers,
A ring buffer is known in which a buffer memory is considered to have a ring configuration. The ring buffer is configured to form a write pointer corresponding to a write address and a read pointer corresponding to a read address, and perform flow control using both pointers. The advantage of the ring buffer is that the buffer capacity can be virtually always equal to the buffer capacity.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

リングバッファは、最大限有効にメモリを利用している
ように見えるが、下記のような欠点が生じる。
Although ring buffers seem to utilize memory as efficiently as possible, they suffer from the following drawbacks.

第1に、1バイトづつ受信バイトからデータを取り出す
ために、非効率的である。
First, it is inefficient because data is extracted from the received bytes one byte at a time.

第2に、毎回(1バイトづつ)受信バイトの残りの使用
可能バイト数を求め、フローコントロールを行っている
。従って、非効率的であるのみならず、オーバーヘッド
が増加し、データを取り出す速度が高速とならない。
Second, the number of usable bytes remaining from the received bytes is calculated each time (one byte at a time) to perform flow control. Therefore, it is not only inefficient, but also increases overhead and does not allow high speed data retrieval.

従って、この発明の目的は、効率的で、高速動作が可能
な受信バイトの制御装置を提供することにある。
Therefore, an object of the present invention is to provide a received byte control device that is efficient and capable of high-speed operation.

〔課題を解決するための手段〕[Means to solve the problem]

この発明では、受信バッファが複数のブロックに分割さ
れ、 ブロックの夫々が占有されているかどうかを示す第1の
フラグと、次に受信データが書き込まれるべきブロック
を示す第2のフラグと、次にデータが読み出されるべき
ブロックを示す第3のフラグと、ブロックがオーバーフ
ローするかどうかを示す第4のフラグとが形成され、 第1のフラグ及び第2のフラグを参照して受信データが
書き込まれるブロックの選択がなされ、選択されたブロ
ックに受信データが書き込まれ、第1のフラグ及び第3
のフラグを参照して貯えられているデータを読み出すブ
ロックの選択がなされ、選択されたブロックからデータ
の読み出しがなされる。
In this invention, the receive buffer is divided into a plurality of blocks, and each of the blocks has a first flag indicating whether it is occupied or not, a second flag indicating the block to which the received data is to be written next, and a second flag indicating whether the received data is to be written next. A third flag indicating the block from which the data is to be read and a fourth flag indicating whether the block overflows are formed, and the block to which the received data is written with reference to the first flag and the second flag. is selected, the received data is written to the selected block, and the first flag and the third
A block from which stored data is to be read is selected with reference to the flag, and data is read from the selected block.

〔作用] 第1のフラグを見ることにより、受信データを書き込む
ブロックの選択又は受信データが有るかどうかを知るこ
とができる。また、第2のフラグを参照して、順番にブ
ロックに受信データを書き込む処理と順番にデータを読
み出す処理が可能となる。これらのフラグを用いて、ブ
ロック単位で受信データの書き込み及びデータの読み出
しができると共に、フローコントロールを行うことがで
きる。従って、1バイトづつ処理する従来の方式に比し
て、高速の処理ができ、また、フローコントロールが単
純となる。
[Operation] By looking at the first flag, it is possible to select a block to write received data or to know whether there is received data. Further, by referring to the second flag, it becomes possible to sequentially write received data into blocks and sequentially read data. Using these flags, it is possible to write received data and read data in block units, as well as perform flow control. Therefore, compared to the conventional method of processing one byte at a time, high-speed processing is possible and flow control is simpler.

〔実施例〕〔Example〕

以下、この発明の一実施例について図面を参照して説明
する。第1図は、この発明を通用できるシステムの概略
を示す。第1図において、1は、外部からのデータ2例
えばシリアルデータが供給される受信データ処理ブロッ
クを示す。この受信データ処理ブロックlには、受信バ
イトが設けられ、受信データ処理ブロック1を通じて外
部からのデータ2がアプリケーションブロック3に受は
渡される。具体的には、受信データ処理ブロック1は、
割り込み処理で動作し、アプリケーションブロックは、
メインプログラムで動作する。
An embodiment of the present invention will be described below with reference to the drawings. FIG. 1 schematically shows a system to which the present invention can be applied. In FIG. 1, reference numeral 1 indicates a received data processing block to which external data 2, such as serial data, is supplied. This reception data processing block 1 is provided with a reception byte, and data 2 from the outside is received and passed to the application block 3 through the reception data processing block 1. Specifically, the received data processing block 1:
It operates on interrupt processing, and the application block is
It works in the main program.

第2図は、受信バッファの構成及びフラグを示す。受信
バッファは、mバイトづつn個のブロックに分割される
。従って、受信バッファの容量は、(mXnバイト)で
ある。例えば(m=2にバイト、n=8、mXn=16
にバイト)とされる。
FIG. 2 shows the configuration and flags of the receive buffer. The receive buffer is divided into n blocks of m bytes each. Therefore, the capacity of the receive buffer is (mXn bytes). For example (m=2 bytes, n=8, mXn=16
part-time job).

受信バッファと関連して、第1のフラグ−第4のフラグ
が発生される。
A first flag-fourth flag is generated in conjunction with the receive buffer.

第1のフラグは、nビット(8ビツト)のアクティブブ
ロックフラグ11であり、アクティブブロックフラグ1
1は、使用中のブロックを判別するために用いられる。
The first flag is an n-bit (8-bit) active block flag 11, which is an active block flag 1.
1 is used to determine which block is in use.

アクティブブロックフラグ11を見て、ブロックの夫々
が占有されているかどうかが分る。アクティブブロック
フラグ11の各ビットは、1”で使用中(即ち、データ
が書き込まれた後で読み出されていない)を表し、“0
”で不使用中(書き込まれたデータがアプリケーション
ブロック3に読み出され、その後にデータを書き込んで
いない)を表す。データの書き込みは、アクティブブロ
ックフラグ11が“0”のブロックに対してなされ、ま
た、アクティブブロックフラグ11から受信バッファに
データが有るかどうかが分る。
By looking at the active block flag 11, it can be determined whether each block is occupied. Each bit of the active block flag 11 is 1, which indicates that it is in use (that is, data has not been read after it has been written), and 0, which indicates that it is in use (that is, data has not been read after being written).
” indicates that the block is not in use (the written data has been read to the application block 3, but no data has been written after that). Data is written to the block whose active block flag 11 is “0”. Furthermore, it can be determined from the active block flag 11 whether there is data in the reception buffer.

第2のフラグは、3ビツトのカレントアクティブレシー
ブブロック12であり、割り込みプログラム内で現在受
信中のブロックを示す、このカレントアクティブレシー
ブブロック12から次にデータを書き込むべきブロック
が分る。
The second flag is a 3-bit current active receive block 12, which indicates the block currently being received within the interrupt program, from which the next block to write data can be determined.

第3のフラグは、3ビツトのカレントアクティブアプリ
ケーションブロック13であり、メインプログラム内で
現在アプリケーションブロック3に引き渡すのに使用中
のブロックを示す。このカレントアクティブアプリケ−
シロンブロック13から次に読み出すべきブロックが分
る。
The third flag is a 3-bit current active application block 13 indicating which block is currently being used to pass to application block 3 within the main program. This current active application
The block to be read next can be determined from the silon block 13.

第4のフラグは、8個のブロックの夫々と対応したデー
タバイト数フラグ14であり、データバイト数フラグ1
4は、各ブロックに格納されたデータのバイト数(最大
2にバイト)を示す、このデータバイト数フラグ14を
見れば、ブロックの単位で、オーバーフローのおそれを
検出することができる。
The fourth flag is a data byte number flag 14 corresponding to each of the eight blocks, and a data byte number flag 1.
4 indicates the number of bytes of data stored in each block (up to 2 bytes). By looking at this data byte number flag 14, it is possible to detect a risk of overflow in units of blocks.

更に、フローコントロールのための制御信号として、X
ON及びX0FFが使用される。XONが送出される時
には、受信可能なことを意味し、X OFFが送出され
る時には、メモリに余裕がないので、受信停止を意味す
る。
Furthermore, as a control signal for flow control,
ON and X0FF are used. When XON is sent, it means that reception is possible, and when X OFF is sent, it means that reception is stopped because there is no memory available.

以上のフラグを用いて、受信データの処理並びにアプリ
ケーションブロックの処理がブロックの単位でなされる
Using the above flags, received data processing and application block processing are performed in block units.

第3図を参照して、割り込みサブルーチンのプログラム
で動く受信データの処理動作について説明する。
Referring to FIG. 3, the received data processing operation executed by the interrupt subroutine program will be described.

最初にステップ■で、フローコントロールの制御信号X
ONが送出されているかどうかが調べられる。XONが
無い時には、受信不能であり、XONが有る時には、受
信可能である。受信可能なことが分かったら、ステップ
■に移行し、カレントレシーブブロック(受信データを
書き込むブロック)を選択する。この選択は、アクティ
ブブロックフラグ11(第1のフラグ)及びカレントア
クティブレシーブブロック12(第2のフラグ)を参照
してなされ、不使用中のブロックに対して受信データが
書き込まれる。また、アクティブブロックフラグ11が
変更されると共に、カレントアクティブレシーブブロッ
ク12が選択されたブロックと対応するものとされる0
次に、選択されたブロックに対して受信データが格納さ
れる(ステ・ノブ■)。
First, in step ■, the flow control control signal
It is checked whether ON is being sent. When there is no XON, reception is not possible, and when there is XON, reception is possible. If it is determined that the data can be received, the process moves to step (3) and the current receive block (the block in which the received data is written) is selected. This selection is made with reference to the active block flag 11 (first flag) and the current active receive block 12 (second flag), and received data is written to the unused block. Additionally, the active block flag 11 is changed, and the current active receive block 12 is set to correspond to the selected block.
Next, the received data is stored for the selected block (Ste knob ■).

次に、受信データが格納されたブロックが一杯になった
かどうかがデータバイト数フラグ14(第4のフラグ)
から調べられる(ステ・ノブ■)。
Next, the data byte count flag 14 (fourth flag) indicates whether the block in which the received data is stored is full.
You can find out from (Ste Nobu ■).

若し、−杯の場合には、ステップ■に移行し、残りのブ
ロックが1以下かどうかがアクティブブロックフラグ1
1の状態から調べられる。残りのブロックが1以下の場
合には、オーバーフローするおそれが有るので、X O
FFを送出する(ステップ■)。
If it is -, move to step ■, and check whether the remaining blocks are 1 or less by checking the active block flag 1.
You can check from state 1. If the number of remaining blocks is 1 or less, there is a risk of overflow, so
Send FF (step ■).

第4図を参照して、メインサブルーチンのプログラムで
動くアプリケーションブロックへのデータ転送について
説明する。
Referring to FIG. 4, data transfer to the application block running in the main subroutine program will be explained.

最初のステップ■で、受信データが有るかどうかがアク
ティブブロックフラグ11を参照して調べられる。受信
データが有るブロックがカレントアクティブアプリケー
ションブロックとして選択される(ステップo)、この
選択されたプロックの受信データがアプリケーションブ
ロック3に転送される(ステップ@)。
In the first step (2), it is checked with reference to the active block flag 11 whether there is any received data. The block with received data is selected as the current active application block (step o), and the received data of this selected block is transferred to the application block 3 (step @).

次に、ステップ[相]で残りのブロックが1以下かどう
かが調べられる。1以下でない時には、X0FFが送出
中かどうかが調べられる(ステップ0)。
Next, in step [phase], it is checked whether the remaining blocks are 1 or less. If it is not less than 1, it is checked whether X0FF is being sent (step 0).

X OFFが送出中の時には、制御信号X0N(受信す
ることが可能なことを意味する)を送出する(ステップ
■)。
When X OFF is being transmitted, a control signal X0N (meaning that it can be received) is transmitted (step 2).

なお、第3図及び第4図に示すフローチャートは、−例
であって、アプリケーションに応じて変形が可能である
Note that the flowcharts shown in FIGS. 3 and 4 are examples, and can be modified depending on the application.

〔発明の効果〕〔Effect of the invention〕

この発明では、受信バッファがブロック化されているの
で、外部インターフェースから受信バッファにデータを
格納する動作と、受信バッファからアプリケーションブ
ロックにデータを引き渡す動作とを容易に分離すること
ができ、受信バッファに対するデータの入出力がブロッ
ク単位で行うことができ、高速化を図ることができる。
In this invention, since the receive buffer is divided into blocks, it is possible to easily separate the operation of storing data from the external interface to the receive buffer and the operation of passing data from the receive buffer to the application block. Data input/output can be performed in blocks, increasing speed.

また、受信バッファの各ブロックに対応したアクティブ
ブロックフラグを用意するだけで、受信バッファの使用
状況が分るために、フローコントロールのアルゴリズム
が単純とできる。
Furthermore, the usage status of the receive buffer can be determined simply by preparing an active block flag corresponding to each block of the receive buffer, so the flow control algorithm can be simplified.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図はこの発明を通用できるシステムの概略を示すブ
ロック図、第2図は受信バッファの構成及びフラグの説
明に用いる路線図、第3図及び第4図はこの発明の一実
施例の説明に用いるフローチャートである。 図面における主要な符号の説明 11ニアクチイブブロツクフラグ、 12:カレントアクティフ゛レシーフ゛フ゛ロンク、1
3:カレントアクティブアプリケーションブロック、 14:データバイト数フラグ。 代理人 弁理士 杉 浦 正 知 デ”−7遷衿の辛捧1i5       <[lo−1
2< ハ゛ ・、々 agt 々) 第2図        ( /2 ゛く 〈 \ )O−千イート                  
 70−+ヤードHA−
Fig. 1 is a block diagram showing the outline of a system to which this invention can be applied, Fig. 2 is a route diagram used to explain the configuration of the reception buffer and flags, and Figs. 3 and 4 are explanations of one embodiment of the invention. This is a flowchart used for. Explanation of main symbols in the drawings 11: Near active block flag, 12: Current active receiver block, 1
3: Current active application block, 14: Data byte count flag. Agent Patent Attorney Tadashi Sugiura
2< h゛ ・, t agt t t ) Fig. 2 ( /2 ゛ ku〈 \ ) O-thousand eat
70-+ Yard HA-

Claims (1)

【特許請求の範囲】 受信バッファが複数のブロックに分割され、上記ブロッ
クの夫々が占有されているかどうかを示す第1のフラグ
と、次に受信データが書き込まれるべきブロックを示す
第2のフラグと、次にデータが読み出されるべきブロッ
クを示す第3のフラグと、上記ブロックがオーバーフロ
ーするかどうかを示す第4のフラグとが形成され、 上記第1のフラグ及び上記第2のフラグを参照して上記
受信データが書き込まれるブロックの選択がなされ、上
記選択されたブロックに受信データが書き込まれ、 上記第1のフラグ及び第3のフラグを参照して貯えられ
ているデータを読み出すブロックの選択がなされ、上記
選択されたブロックからデータの読み出しがなされるこ
とを特徴とする受信バッファの制御装置。
[Claims] A reception buffer is divided into a plurality of blocks, and a first flag indicating whether each of the blocks is occupied, and a second flag indicating a block to which received data is to be written next. , a third flag indicating the block from which data is to be read next and a fourth flag indicating whether said block overflows are formed, with reference to said first flag and said second flag. A block into which the received data is to be written is selected, the received data is written into the selected block, and a block from which the stored data is to be read is selected by referring to the first flag and the third flag. . A receiving buffer control device, wherein data is read from the selected block.
JP63143931A 1988-06-11 1988-06-11 Receive buffer controller Expired - Fee Related JP2689490B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63143931A JP2689490B2 (en) 1988-06-11 1988-06-11 Receive buffer controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63143931A JP2689490B2 (en) 1988-06-11 1988-06-11 Receive buffer controller

Publications (2)

Publication Number Publication Date
JPH01312656A true JPH01312656A (en) 1989-12-18
JP2689490B2 JP2689490B2 (en) 1997-12-10

Family

ID=15350410

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63143931A Expired - Fee Related JP2689490B2 (en) 1988-06-11 1988-06-11 Receive buffer controller

Country Status (1)

Country Link
JP (1) JP2689490B2 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS58107952A (en) * 1981-12-22 1983-06-27 Fujitsu Ltd Buffer memory controlling system
JPS6242384A (en) * 1985-08-19 1987-02-24 Nec Corp Fifo read control circuit

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS58107952A (en) * 1981-12-22 1983-06-27 Fujitsu Ltd Buffer memory controlling system
JPS6242384A (en) * 1985-08-19 1987-02-24 Nec Corp Fifo read control circuit

Also Published As

Publication number Publication date
JP2689490B2 (en) 1997-12-10

Similar Documents

Publication Publication Date Title
US4507760A (en) First-in, first-out (FIFO) memory configuration for queue storage
US5587953A (en) First-in-first-out buffer memory
US6430666B1 (en) Linked list memory and method therefor
KR20210134965A (en) Data transmission apparatus, method and readable storage medium
JPH01312656A (en) Control device for receiving buffer
AU624745B2 (en) Packet/fast packet switch for voice and data
US6633928B2 (en) Fast process context switching buffer
US5450543A (en) Flag-based high-speed I/O data transfer
JPS60201453A (en) Memory access controlling system
KR900005554B1 (en) Memory space expansion method by data manipulation
JPS6375927A (en) Buffer control system
KR100365344B1 (en) Device for processing data of network access system and method thereof
JPH0482077A (en) Fifo memory
JPH0528083A (en) Input/output data transfer circuit
JPH02254557A (en) Communication control processing device
JPS6327731B2 (en)
JPH0424852A (en) Multi-port access system
JPH0440551A (en) Data transfer system
JPS6175427A (en) Character buffer control system
JPS6282846A (en) Tracing system for line data
JPH04163664A (en) Distributed memory type parallel computer system
JPH03211651A (en) Data processor
JPH01181258A (en) Buffer management method
JPS60181862A (en) Setting system of dma transfer buffer
JPS592283A (en) Buffer memory controller

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees