JPH0786790B2 - Counter value reading method - Google Patents
Counter value reading methodInfo
- Publication number
- JPH0786790B2 JPH0786790B2 JP1213469A JP21346989A JPH0786790B2 JP H0786790 B2 JPH0786790 B2 JP H0786790B2 JP 1213469 A JP1213469 A JP 1213469A JP 21346989 A JP21346989 A JP 21346989A JP H0786790 B2 JPH0786790 B2 JP H0786790B2
- Authority
- JP
- Japan
- Prior art keywords
- counter
- byte
- reading
- data bus
- counter value
- 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.)
- Expired - Fee Related
Links
Landscapes
- Information Transfer Systems (AREA)
Description
【発明の詳細な説明】 [概要] データバスのバス幅より大きいカウンタ幅を有するカウ
ンタのカウンタ値の読出方式に関し、 プログラムのステップ量を減少し、処理速度を高めるこ
とができるカウンタ値の読出方式を提供することを目的
とし、 データバスのバス幅より大きいカウンタ幅を有するカウ
ンタから、カウンタ値を上位ビットと下位ビットに分割
して読み出して選択手段を介してデータバスに転送する
カウンタ値の読出方式において、前記下位ビットを読み
出すタイミングで上位ビットを保持する保持手段を設け
て、次のタイミングで前記保持手段に保持した上位ビッ
トを前記選択手段に転送するように構成した。The present invention relates to a method of reading a counter value of a counter having a counter width larger than the bus width of a data bus, and a method of reading a counter value capable of reducing the amount of program steps and increasing the processing speed. The counter value is read from a counter having a counter width larger than the bus width of the data bus by dividing the counter value into upper bits and lower bits and transferring them to the data bus through the selecting means. In the system, holding means for holding the upper bit at the timing of reading the lower bit is provided, and the upper bit held in the holding means is transferred to the selecting means at the next timing.
[産業上の利用分野] 本発明は、データバスのバス幅より大きいカウンタ幅を
有するカウンタのカウンタ値の読出方式に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method of reading a counter value of a counter having a counter width larger than the bus width of a data bus.
データ処理装置においては種々のカウンタが使用されて
いるが、これらのカウンタの中には、例えばTOD(Time
of Day)時計のようにCPUの命令によりその値を正確に
読み出すことが必要なものがある。このようなカウンタ
において、そのカウンタ幅がCPUのデータバスのバス幅
より大きいものについては、データを分割して読み出
し、データバスに転送しなければならない。この場合、
カウンタ値の一部を転送中にカウンタは常に変化してい
るので、残りの部分を読み出すまでにカウンタ値が変化
する可能性がある。このために、ソフトウェアによりキ
ャリー補正を行なっているが、この場合にはプログラム
のステップ量が増加し、処理速度が低下してしまう。し
たがって、ステップ量を増加させることなく高速で分割
読出すカウンタ値を正しくデータバスに転送する読出方
式の開発が必要である。Although various counters are used in the data processing device, some of these counters include, for example, TOD (Time
There is something that needs to read the value accurately by the instruction of the CPU like the clock. In such a counter, if the counter width is larger than the bus width of the CPU data bus, the data must be divided and read and transferred to the data bus. in this case,
Since the counter constantly changes while transferring a part of the counter value, the counter value may change before the remaining part is read. For this reason, carry correction is performed by software, but in this case, the step amount of the program increases and the processing speed decreases. Therefore, it is necessary to develop a reading method for correctly transferring the counter value for divided reading at high speed to the data bus without increasing the step amount.
[従来の技術] 従来のカウンタ値の読出方式としては、例えば第4図に
示すようなものがある。[Prior Art] As a conventional reading method of a counter value, for example, there is one as shown in FIG.
第4図において、1はカウンタ(例えばTOD時計)であ
り、このカウンタ1は、例えば下位4バイトおよび上位
1バイトの合計40ビットで構成されている。2はデータ
バスであり、このデータバス2のバス幅は32ビットであ
る。40ビットのカウンタ値を1回で32ビットのデータバ
ス2に転送することができない。したがって、下位4バ
イトと上位1バイトを分割してマルチプレクサ3に読み
出し、マルチプレクサ3によって選択されたデータをデ
ータバス2に転送するようにしている。In FIG. 4, 1 is a counter (for example, TOD clock), and this counter 1 is composed of, for example, lower 4 bytes and upper 1 byte, for a total of 40 bits. 2 is a data bus, and the bus width of this data bus 2 is 32 bits. The 40-bit counter value cannot be transferred to the 32-bit data bus 2 at one time. Therefore, the lower 4 bytes and the upper 1 byte are divided and read to the multiplexer 3, and the data selected by the multiplexer 3 is transferred to the data bus 2.
カウンタ1から、まず、下位バイト(08〜39)を読み出
し、次に上位1バイト(00〜07)を読み出す。この場
合、上位1バイトの値は、下位4バイトを読み出してか
ら上位1バイトを読み出す間にキャリーが発生して上位
1バイトに伝わり、上位1バイトとして読み出された値
にキャリーを加算した値となってしまう可能性があるた
め、上位、下位をそれぞれ2回読み出して、値を補正す
る必要がある。From the counter 1, first, the lower byte (08 to 39) is read, and then the upper 1 byte (00 to 07) is read. In this case, the value of the upper 1 byte is a value obtained by adding a carry to the value read as the upper 1 byte, because a carry occurs while reading the lower 4 bytes and then reading the upper 1 byte. Therefore, it is necessary to read the upper and lower levels twice and correct the values.
具体的にはプログラムにより次のようなキャリー補正を
行なう。Specifically, the following carry correction is performed by a program.
・1回目は読み出してくる下位4バイトをaとし、上位
1バイトをAとする。・ At the first time, the lower 4 bytes read out are a and the upper 1 byte is A.
・2回目に読み出してくる下位4バイトをbとし、上位
1バイトをBとする。-The lower 4 bytes read out the second time are set to b, and the upper 1 byte is set to B.
下位4バイトaのMSB(最上位ビット)が“1"の時であ
って、下位4バイトのbのMSB(最上位ビット)が“0"
の時について説明すると、下位4バイトaと下位4バイ
トbのところでMSBが変化したということは、下位4バ
イトaを読み出してから下位4バイトbを読み出すまで
の間にキャリーの伝搬があったと考えられる。When the MSB (most significant bit) of the lower 4 bytes a is "1" and the MSB (most significant bit) of b of the lower 4 bytes is "0"
In the case of, the MSB changes at the lower 4 bytes a and the lower 4 bytes b means that there was a carry propagation between the reading of the lower 4 bytes a and the reading of the lower 4 bytes b. To be
ここで、上位1バイトA=上位1バイトBとなっていれ
ば、Aを読み出す前にキャリーが伝搬したことになるた
め、キャリーの補正が必要である。このとき実際の上位
1バイトAの値はA−1である。Here, if the upper 1 byte A = the upper 1 byte B, it means that the carry has propagated before the A is read, and therefore the carry must be corrected. At this time, the actual value of the upper 1 byte A is A-1.
一方、上位1バイトB=上位1バイトA+1となってい
れば、Aを読み出してからキャリーが伝搬したことにな
るため、キャリーの補正は不要である。上位1バイトA
と下位4バイトbの間で、キャリーの伝搬があったと考
えられ、このときの実際の上位1バイトAの値はAとな
る。On the other hand, if the upper 1 byte B = the upper 1 byte A + 1, it means that the carry has been propagated after A is read, and therefore the carry correction is unnecessary. Upper 1 byte A
It is considered that carry has propagated between the lower 4 bytes b and the lower 4 bytes b, and the actual value of the upper 1 byte A at this time is A.
このようなキャリーの補正はハードで行なうと、大幅に
ハードウェア量が増加するため、ソフトウェア(プログ
ラム)で行なわれている。When such carry correction is performed by hardware, the amount of hardware is significantly increased, so that it is performed by software (program).
[発明が解決しようとする課題] しかしながら、このような従来のカウンタ値の読出方式
にあっては、キャリーの補正をプログラムで行なうよう
になっていたため、プログラムのステップ量が増加し、
また、処理速度も低下するという問題点があった。[Problems to be Solved by the Invention] However, in such a conventional counter value reading method, since carry correction is performed by a program, the step amount of the program increases,
Further, there is a problem that the processing speed is also reduced.
本発明は、このような従来の問題点に鑑みてなされたも
のであって、プログラムのステップ量を削減し、処理速
度を高めることができるカウンタ値の読出方式を提供す
ることを目的としている。The present invention has been made in view of such conventional problems, and an object of the present invention is to provide a reading method of a counter value that can reduce the step amount of a program and increase the processing speed.
[課題を解決するための手段] 第1図は本発明の原理説明図である。[Means for Solving the Problems] FIG. 1 is a diagram illustrating the principle of the present invention.
第1図において、14はデータバス、11はデータバス14の
バス幅より大きいカウンタ幅を有するカウンタ、16はカ
ウンタ11から上位ビット12と下位ビット13に分割して読
み出したカウンタ値をデータバス16に選択して転送する
選択手段、15は前記下位ビット13を読み出すタイミング
で上位ビット12を保持する保持手段である。In FIG. 1, reference numeral 14 is a data bus, 11 is a counter having a counter width larger than the bus width of the data bus 14, and 16 is a counter value obtained by dividing the counter 11 into upper bits 12 and lower bits 13 and reading them. The selecting means 15 selects and transfers the upper bit 12 and the holding means 15 holds the upper bit 12 at the timing of reading the lower bit 13.
[作用] データバスのバス幅より大きいカウンタ幅を有するカウ
ンタでは1回ではカウンタ値をデータバスに転送するこ
とができないので、下位バイトを転送して上位バイトを
転送するが、この場合、下位バイトを選択手段に読み出
すタイミングで上位バイトを保持手段にラッチする。[Operation] Since a counter having a counter width larger than the bus width of the data bus cannot transfer the counter value to the data bus at one time, the lower byte is transferred and the upper byte is transferred. In this case, the lower byte is transferred. The upper byte is latched in the holding means at the timing of reading out to the selecting means.
すなわち、下位バイトを転送している間にもカウンタは
常に変化し、上位バイトを転送しようとしたとき、上位
バイトのデータが変っている可能性があるので、下位バ
イトを転送すると同時に上位バイトをラッチし、次の下
位バイトを転送するとき、保持手段から上位バイトを選
択手段に転送する。したがって、データの変らない値が
選択手段に転送され、選択手段からデータバスに転送さ
れる。That is, the counter constantly changes while transferring the lower byte, and when trying to transfer the upper byte, the data in the upper byte may have changed. When latching and transferring the next lower byte, the upper byte is transferred from the holding means to the selecting means. Therefore, the unchanged value of the data is transferred to the selecting means and transferred from the selecting means to the data bus.
このように、プログラムによりキャリー補正を行なう必
要がなくなるので、プログラムのステップ量を大幅に削
減することができ、また、処理速度を大幅に高めること
ができる。As described above, since it is not necessary to perform carry correction by the program, the step amount of the program can be greatly reduced, and the processing speed can be significantly increased.
[実施例] 以下、本発明の実施例を図面に基づいて説明する。[Embodiment] An embodiment of the present invention will be described below with reference to the drawings.
第2図および第3図は本発明の一実施例を示す図であ
る。2 and 3 are diagrams showing an embodiment of the present invention.
第2図において、11は例えばTOD(Time of Day)時計を
構成するカウンタであり、このカウンタ11は、40ビット
で構成されている。40ビットのうちの(00〜07)が上位
1バイト12を(08〜15)、(16〜23)、(24〜31)、
(32〜39)が下位4バイト13を構成している。なお、カ
ウンタ11はクロックが入るごとに1が加算される。14は
カウンタ11のカウンタ値が転送されるデータバスであ
り、このデータバス14のバス幅は32ビットで構成されて
いる。In FIG. 2, reference numeral 11 is a counter that constitutes, for example, a TOD (Time of Day) clock, and this counter 11 is constituted by 40 bits. Of the 40 bits (00-07), the high-order 1 byte 12 (08-15), (16-23), (24-31),
(32 to 39) form the lower 4 bytes 13. The counter 11 is incremented by 1 each time a clock is input. Reference numeral 14 is a data bus to which the counter value of the counter 11 is transferred, and the bus width of the data bus 14 is 32 bits.
32ビットは(00〜07)、(08〜15)、(16〜23)および
(24〜31)の4バイトよりなる。The 32 bits consist of 4 bytes (00 to 07), (08 to 15), (16 to 23) and (24 to 31).
このように、カウンタ11のカウンタ幅がデータバス14の
バス幅より大きいため、カウンタ値を下位4バイト13お
よび上位1バイト12に分割して転送するようになってい
る。As described above, since the counter width of the counter 11 is larger than the bus width of the data bus 14, the counter value is divided into the lower 4 bytes 13 and the upper 1 byte 12 and transferred.
15は保持手段としてのラッチ回路であり、このラッチ回
路15は上位1バイト12をラッチする。すなわち、下位4
バイト13を読み出しするときに同時に上位1バイト12を
ラッチする。15Aは下位4バイト13を読み出すタイミン
グ信号とクロックが入力するアンド回路であり、下位4
バイト13を読み出すタイミングでクロックを有効とし、
そのクロックでラッチ回路15は上位1バイト12を取り込
む。Reference numeral 15 is a latch circuit as a holding means, and this latch circuit 15 latches the upper 1 byte 12. That is, the bottom 4
When reading byte 13, the upper 1 byte 12 is latched at the same time. 15A is an AND circuit to which a timing signal for reading the lower 4 bytes 13 and a clock are input.
Enable the clock at the timing of reading byte 13,
At that clock, the latch circuit 15 takes in the upper 1 byte 12.
16は選択手段としてのマルチプレクサであり、マルチプ
レクサ16には下位3バイト13が取り込まれる次のサイク
ルでラッチ回路15から上位1バイト12が取り込まれる。
マルチプレクサ16は必要なデータを選択してデータバス
14に転送する。Reference numeral 16 is a multiplexer as a selection means. In the next cycle in which the lower 3 bytes 13 are fetched in the multiplexer 16, the upper 1 byte 12 is fetched from the latch circuit 15.
Multiplexer 16 selects the required data and data bus
Transfer to 14.
次に、動作を説明する。Next, the operation will be described.
第3図は動作を説明するためのタイムチャートを示す。FIG. 3 shows a time chart for explaining the operation.
第3図において、Aはデータを、A+1・・・A+4は
Aというデータにクロックの入力で1がそれぞれ加算さ
れた各データを、ALはAというデータの下位4バイト
を、AHはAというデータの上位1バイトを、それぞれ示
す。In FIG. 3, A is data, A + 1 ... A + 4 is data obtained by adding 1 to the data A at the clock input, AL is the lower 4 bytes of the data A, and AH is the data A. The upper 1 byte of each is shown.
また、TODはカウンタ11を、TODLはカウンタ11の下位4
バイトを、TODHはカウンタ11の上位1バイトを、NDBはA
LおよびAHが格納された状態を、それぞれ示す。Also, TOD is the counter 11 and TODL is the lower 4 of the counter 11.
Byte, TODH is the upper 1 byte of counter 11, NDB is A
The state where L and AH are stored is shown respectively.
カウンタ11のデータAはクロックが入るごとに1づつ加
算され、A+1,A+2,A+3,A+4・・・と変化する。下
位4バイト13をデータバス14に転送した後も常にカウン
タ11は変化しているので、残る上位1バイト12をデータ
バス14に転送するまでカウンタ値が変化する可能性があ
る。The data A of the counter 11 is incremented by 1 each time a clock is input, and changes to A + 1, A + 2, A + 3, A + 4 .... Since the counter 11 is constantly changing even after the lower 4 bytes 13 are transferred to the data bus 14, the counter value may change until the remaining upper 1 byte 12 is transferred to the data bus 14.
したがって、下位バイト13をマルチプレクサ16に読み出
すタイミングで、上位1バイト12をラッチ回路15にラッ
チする。そして、次のタイミングでラッチ回路15でラッ
チした上位1バイト12をマルチプレクサ16に転送する。
このように残りの上位1バイト12をラッチ回路15にラッ
チすることにより、カウンタ11が変化し、カウンタ値が
次の値になっても、変化していない上位1バイト13の値
がマルチプレクサ16に転送される。マルチプレクサ16は
必要なデータを選択してデータバス14に転送する。Therefore, at the timing of reading the lower byte 13 to the multiplexer 16, the upper 1 byte 12 is latched in the latch circuit 15. Then, at the next timing, the upper 1 byte 12 latched by the latch circuit 15 is transferred to the multiplexer 16.
By latching the remaining high-order 1 byte 12 in the latch circuit 15 as described above, the value of the high-order 1 byte 13 that has not changed remains in the multiplexer 16 even if the counter 11 changes and the counter value becomes the next value. Transferred. The multiplexer 16 selects necessary data and transfers it to the data bus 14.
このように、ラッチ回路15を追加するだけで、プログラ
ムによるキャリー補正を行なう必要がなく、正しいカウ
ンタ値をデータバス16に転送することができる。したが
って、プログラムのステップ量を大幅に削減することが
でき、また、処理速度も大幅に高めることができる。As described above, by simply adding the latch circuit 15, it is not necessary to perform carry correction by the program, and the correct counter value can be transferred to the data bus 16. Therefore, the step amount of the program can be significantly reduced, and the processing speed can be significantly increased.
[発明の効果] 以上説明してきたように、本発明によれば、カウンタの
上位バイトを、下位バイトを読み出すタイミングでラッ
チ回路にラッチしてからデータバスに転送するようにし
たため、プログラムによるキャリー補正を行なう必要が
なく、プログラムのステップ量を大幅に削減することが
でき、また処理速度を大幅に高めることができる。EFFECTS OF THE INVENTION As described above, according to the present invention, the upper byte of the counter is latched in the latch circuit at the timing of reading the lower byte and then transferred to the data bus. Therefore, carry correction by a program is performed. The number of steps of the program can be greatly reduced and the processing speed can be significantly increased.
第1図は本発明の原理説明図、 第2図は本発明の一実施例を示す図、 第3図はタイムチャート、 第4図は従来例を示す図である。 図中、 11……カウンタ、 12……上位1バイト、 13……下位4バイト、 14……データバス、 15……ラッチ回路(保持手段)、 15A……アンド回路、 16……マルチプレクサ(選択手段)。 FIG. 1 is a diagram illustrating the principle of the present invention, FIG. 2 is a diagram showing an embodiment of the present invention, FIG. 3 is a time chart, and FIG. 4 is a diagram showing a conventional example. In the figure, 11 ... Counter, 12 ... Higher 1 byte, 13 ... Lower 4 bytes, 14 ... Data bus, 15 ... Latch circuit (holding means), 15A ... And circuit, 16 ... Multiplexer (selection means).
Claims (1)
ンタ幅を有するカウンタ(11)から、カウンタ値を上位
ビット(12)と下位ビット(13)に分割して読み出して
選択手段(16)を介して前記データバス(14)に転送す
るカウンタ値の読出方式において、 前記下位ビット(13)を読み出すタイミングで上位ビッ
ト(12)を保持する保持手段(15)を設けて、次のタイ
ミングで前記保持手段(15)に保持した上位ビット(1
2)を前記選択手段(16)に転送するようにしたことを
特徴とするカウンタ値の読出方式。1. A selection means (16) for reading a counter value by dividing it into upper bits (12) and lower bits (13) from a counter (11) having a counter width larger than the bus width of a data bus (14). In the method of reading the counter value to be transferred to the data bus (14) via the holding means (15) for holding the upper bit (12) at the timing of reading the lower bit (13), the next timing The high-order bit (1
The method of reading the counter value is characterized in that 2) is transferred to the selecting means (16).
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP1213469A JPH0786790B2 (en) | 1989-08-18 | 1989-08-18 | Counter value reading method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP1213469A JPH0786790B2 (en) | 1989-08-18 | 1989-08-18 | Counter value reading method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPH0375909A JPH0375909A (en) | 1991-03-29 |
| JPH0786790B2 true JPH0786790B2 (en) | 1995-09-20 |
Family
ID=16639720
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP1213469A Expired - Fee Related JPH0786790B2 (en) | 1989-08-18 | 1989-08-18 | Counter value reading method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0786790B2 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH07295806A (en) * | 1994-04-27 | 1995-11-10 | Kofu Nippon Denki Kk | Timer reading controller |
-
1989
- 1989-08-18 JP JP1213469A patent/JPH0786790B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JPH0375909A (en) | 1991-03-29 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| DE69233412T2 (en) | Device and computer program product for executing branch instructions | |
| US6775789B2 (en) | Method, system and program products for generating sequence values that are unique across operating system images | |
| EP0579375B1 (en) | Difference flag circuit with offset counter | |
| JPH0786790B2 (en) | Counter value reading method | |
| US5357236A (en) | Parallelized difference flag logic | |
| US6377650B1 (en) | Counter register monitor and update circuit for dual-clock system | |
| JP2530873B2 (en) | Instruction prefetch address update circuit | |
| US6148386A (en) | Address generator circuity for a circular buffer | |
| US5566322A (en) | Method and apparatus for performing read accesses from a counter which avoid large rollover error when multiple read access cycles are used | |
| JPH06197009A (en) | Counter with output latch function | |
| JP2725419B2 (en) | Counting circuit | |
| JPS6027059B2 (en) | interrupt control adapter | |
| US6850561B1 (en) | Predictable updating of a baud divisor of an asynchronous serial port during data reception | |
| JPH07129486A (en) | Serial communication circuit | |
| JPH07104851B2 (en) | Data processing device | |
| JP4189729B2 (en) | Asynchronous readout method of timer count value and timer | |
| JPH01137315A (en) | Timer circuit | |
| JP3443215B2 (en) | Serial input and output device | |
| US20020147935A1 (en) | Timer circuit | |
| JPS63251825A (en) | Control system for real time timer | |
| JP2845768B2 (en) | Time information synchronization device | |
| JP3451691B2 (en) | Serial data transmission circuit | |
| JPS6284366A (en) | Microcomputer | |
| JP2994906B2 (en) | Data receiving circuit | |
| JPH0720142B2 (en) | Serial interface circuit |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| LAPS | Cancellation because of no payment of annual fees |