JPH04104323A - Bit length unit conversion system - Google Patents
Bit length unit conversion systemInfo
- Publication number
- JPH04104323A JPH04104323A JP22403190A JP22403190A JPH04104323A JP H04104323 A JPH04104323 A JP H04104323A JP 22403190 A JP22403190 A JP 22403190A JP 22403190 A JP22403190 A JP 22403190A JP H04104323 A JPH04104323 A JP H04104323A
- Authority
- JP
- Japan
- Prior art keywords
- bit
- data
- bits
- unit
- bit length
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Image Processing (AREA)
Abstract
Description
【発明の詳細な説明】
〔概 要〕
取り扱うビット長単位の異なるデータを所望のビット長
単位のデータに変換するビット長単位変換方式に関し、
ビット長単位の変換をサブルーチン形式にまとめ高級言
語を用いたプログラムに使用して高速度で所望のビット
長単位の変換を行うことを目的とし、
mビット単位で構成されたデータをnビット単位で構成
するデータに変換するビット長単位変換方式において、
所定の基準位置から任意のmビット単位データの先頭ビ
ットの直前のビットまでのビット数をnで除して整数商
W1と整数剰余W2を求め、前記基準位置からW 1
* n +1ビットを先頭ビットとするnの整数倍より
なるにビットをにビットで構成されるレジスタに取り出
し、このレジスタ内ビットをW2ビット左へシフトし、
さらに2(0≦ffi<m)ビット左へシフト後、km
+nビット右へシフトし、このレジスタの左側よりに−
m+42ビットまでのビット列には所定の値を入れるこ
とによりnビット単位データを生成するよう構成する。[Detailed Description of the Invention] [Summary] Regarding a bit length unit conversion method that converts data handled in different bit length units into data in a desired bit length unit, the bit length unit conversion is summarized in a subroutine format using a high-level language. In the bit length unit conversion method, which converts data composed of m bits into data composed of n bits, the purpose is to perform conversion in desired bit length units at high speed using a program that is
The number of bits from a predetermined reference position to the bit immediately before the first bit of arbitrary m-bit unit data is divided by n to obtain an integer quotient W1 and an integer remainder W2, and from the reference position W 1
* Take out bits consisting of integral multiples of n with n + 1 bit as the leading bit, and shift the bits in this register to the left by W2 bits,
After further shifting to the left by 2 (0≦ffi<m) bits, km
+ shift to the right by n bits, - to the left of this register
The configuration is such that n-bit unit data is generated by entering a predetermined value into a bit string up to m+42 bits.
本発明は、取り扱うビット長単位の異なるデータを所望
のビット長単位のデータに変換するビット長単位変換方
式に関する。The present invention relates to a bit length unit conversion method for converting data handled in different bit length units into data in a desired bit length unit.
現在コンピュータが取り扱うビット長単位は8ビットま
たはこの整数倍のものが多い。しかし9ビット長単位や
6ビット長草位のデータを用いるコンピュータも用いら
れている。このようなビット長単位の異なるデータを8
ピントをヘースとするビット長単位データを取り扱うコ
ンピュータで使用する場合ビット長単位を8ビット単位
に変換して用いる。The bit length units currently handled by computers are often 8 bits or an integer multiple of 8 bits. However, computers that use data in 9-bit length units or 6-bit length units are also used. Data with different bit lengths like this are divided into 8
When used in a computer that handles data in bit length units based on focus, the bit length units are converted into 8-bit units.
このようなデータ変換の一例を第6図を用いて説明する
。An example of such data conversion will be explained using FIG. 6.
第6図は9ビット単位で表されたASCIIコードを8
ビットで表されるEBCDICコード(BCDコードを
8ビットに拡張したコードで英文であれば英小文字を、
日本語ではカタカナをシ処理を行うためアセンブラであ
っても作成が難しく、また修正等を行う場合のメンテナ
ンス性も悪い。また高級言語のC0BOLで記載する場
合、バイト境界の調整とC0BOI−のビット処理ライ
ブラリーの遅い処理性能が問題となる。Figure 6 shows the ASCII code expressed in 9-bit units.
EBCDIC code (BCD code extended to 8 bits) expressed in bits.
In Japanese, katakana is written in katakana, which makes it difficult to create even with an assembler, and it is also difficult to maintain when making modifications. Furthermore, when writing in the high-level language C0BOL, there are problems with byte boundary adjustment and slow processing performance of the C0BOI- bit processing library.
本発明は、上述の問題点に鑑みてなされたものであり、
ビット長単位を変換するビット操作部分をサブルーチン
形式でまとめC0BOL等の高級言語で簡単かつ高速度
で所望のビット長単位への変換を可能にするビット長単
位変換方式を提供することを目的とする。The present invention has been made in view of the above problems, and
The purpose of the present invention is to provide a bit length unit conversion method that compiles the bit operation part for converting bit length units in a subroutine format and enables easy and high-speed conversion to a desired bit length unit using a high-level language such as C0BOL. .
第1図は本発明の原理を表すフロー図であり、第2図は
第1図の内容を説明する図である。第1図のステップ1
において、Plは第2図(a)に示すようにアドレスP
3で表される所定の基準位置より変換対象となるmビッ
ト単位の直前のビットまでのビット数を表し、WlはP
lを変換するビット単位であるnビットで除した整数商
、W2は整数剰余(0を含む)、W3はnビット単位で
表しζ
フトコードなしで処理できる)に変換する具体例を表し
たもので(a)はアルファベット、数字、カナ記号を表
す文字の変換例を示す。この場合9ビットデータのMS
D (最上位桁)ビットは0であるのでこの0をとって
8ビットデータに変換される。FIG. 1 is a flow diagram showing the principle of the present invention, and FIG. 2 is a diagram explaining the contents of FIG. 1. Step 1 in Figure 1
, Pl is the address P as shown in FIG. 2(a).
3 represents the number of bits from the predetermined reference position to the previous bit in units of m bits to be converted, and Wl is P
This shows a specific example of converting l into an integer quotient divided by n bits, which is the bit unit to be converted, W2 is an integer remainder (including 0), and W3 is expressed in n bit units (ζ can be processed without a foot code). (a) shows an example of conversion of characters representing alphabets, numbers, and kana symbols. In this case, the MS of 9-bit data
Since the D (most significant digit) bit is 0, this 0 is removed and converted to 8-bit data.
(b)は漢字を18ビットで表したものでMSDビット
と第9ビットは0なのでこの2つを除いた8ビット×2
よりなる2バイトのデータに変換した例を示す。(C)
はMSDビットは符号Sを表し、残り8ビットは数字を
表す固定小数点データを表したもので数字8ビットを1
ハイドに変換し、符号Sを2ハイド目の各ビットに全て
記入した例を示す。(b) represents a kanji in 18 bits, and the MSD bit and the 9th bit are 0, so 8 bits excluding these two x 2
An example of converting to 2-byte data consisting of: (C)
The MSD bit represents the code S, and the remaining 8 bits represent fixed-point data that represents a number.
An example is shown in which the code is converted to Hyde and the code S is written in each bit of the second Hyde.
従来このような変換を行うデータコンバータ(データ変
換プログラム)は、アセンブラ言語で記述されている一
般フアイル用と、高級言語(例えばC0BOL)で処理
するリスト用とが存在する。Conventionally, there are two types of data converters (data conversion programs) that perform such conversion: one for general files written in an assembler language, and one for lists processed in a high-level language (for example, COBOL).
ところでアセンブラ言語で記述するプログラムの場合バ
イトマシンでビット列を扱うには特殊なた変換対象とな
るmビット単位に最も近いアドレスを示す。アドレスW
3から使用する計算機のレジスタの長さであるにビット
分のデータを、このレジスタに取り込み(ステップ2)
、次にこのレジスタ内のビットをW2ビット左へシフト
し変換対象となるmビット単位の先頭ビットをこのレジ
スタの左端ビット位置に移動する(ステップ3)。By the way, in the case of a program written in an assembler language, in order to handle a bit string with a byte machine, it is special, so it indicates the address closest to the unit of m bits to be converted. Address W
From step 3, import the data for bits, which is the length of the register of the computer to be used, into this register (step 2).
Then, the bits in this register are shifted to the left by W2 bits, and the first bit of the m-bit unit to be converted is moved to the leftmost bit position of this register (step 3).
この様子を第2図(b)に示す。さらにI!、(0≦l
〈m)ビット左へシフトする。このlはmビットのMS
D(最上位桁)ビットから!ビットまでを捨てる処理を
表し、第6図の(a)、 (b)で説明した処理を表す
。この様子を第2図(C)に示す。ρ−〇の場合はmビ
ットを全てnビット単位に変換する場合を表す。次にに
−m+jl!ビット左シフトすると変換対象となるmビ
ットのLSD (最下位桁)ビットがレジスタの右端に
一致する(ステップ4)。This situation is shown in FIG. 2(b). More I! , (0≦l
<m) Shift bits to the left. This l is an m-bit MS
From the D (most significant digit) bit! It represents the process of discarding up to bits, and represents the process explained in FIGS. 6(a) and (b). This situation is shown in FIG. 2(C). The case of ρ-〇 represents the case where all m bits are converted into n bit units. Next -m+jl! When the bits are shifted to the left, the LSD (least significant digit) bits of m bits to be converted match the right end of the register (step 4).
この様子を第2図(d)に示す。なお(d)においては
左端よりに−m+j!までのビットはバイナリ−ゼロと
しであるが、第6図(C)に示すように符号を記入する
場合もある。このレジスタの内容をnビット単位で出力
する(ステ・シブ5)。This situation is shown in FIG. 2(d). In (d), -m+j! from the left end! The bits up to are binary zeros, but signs may be written as shown in FIG. 6(C). The contents of this register are output in units of n bits (step 5).
上記のように構成することにより、mビット単位で構成
されたデータをnビット単位で構成するデータに変換す
ることが可能となり、この処理ルーチンをサブルーチン
として高級言語で記載されたメインプログラムに組み込
むことによりmビット単位で構成されたデータからnビ
・ント単位データを高速で取り出すことが可能となる。By configuring as above, it is possible to convert data composed of m bits into data composed of n bits, and this processing routine can be incorporated as a subroutine into the main program written in a high-level language. This makes it possible to extract data in units of n bits at high speed from data configured in units of m bits.
以下、本発明の実施例を図面を参照して説明する。第3
図は本発明の実施例であるサブルーチンとこれを使用す
るデータ変換等を行うメインプログラムとを表した図で
ある。同図において11は9ピント単位のデータが格納
されたデータファイルであり、12はデータ変換等を行
うメインプログラム、13は本実施例のサブルーチンで
9ピント単位データを8ピント単位のデータに変換する
。14は情報の受は渡しを行うパラメータである。Embodiments of the present invention will be described below with reference to the drawings. Third
The figure shows a subroutine according to an embodiment of the present invention and a main program that uses the subroutine to perform data conversion and the like. In the figure, 11 is a data file storing data in 9-pinto units, 12 is a main program that performs data conversion, etc., and 13 is a subroutine of this embodiment that converts 9-pinto unit data into 8-pinto units. . 14 is a parameter for receiving and passing information.
第4図は本実施例で実施するビット長変換のフ第5A図
(b)に示すようにPlは、ブロックの先頭から変換対
象の9ビットの先頭ビットまでのピント数であり、Wl
ばこの先頭ピントに最も近いフロックの先頭からのハイ
ド数、W2はこのPlとW1*8との差を表すビット数
、W3はバイト単位で表した変換対象の9ビットの先頭
に最も近いアドレスを示す。次にアドレスW3が示す位
置から4バイト分のデータを計算機の汎用レジスタに取
り込む(ステップ42)。4バイト分としたのはこの汎
用レジスタが4ハイドの大きさを有するからである。こ
の状態を第5A図(C)に示す。この場合W2−1ビッ
トとなっている。次にレジスタ内のビットをW2ビット
左へシフトする(ステップ43)。この様子を第5B図
(d)に示す。このシフトにより変換対象の9ビットの
先頭ピントがレジスタの左端にくる。次にステップ44
で処理モードを決める。この場合上述したように3つの
処理モードに分かれる。第1の処理モードはステップ4
4に示すように9ピントのデータを8ビットのデータに
変換する場合を示す。この場合右へ23ピントジロ一図
であり、第5図は変換時における計算機内の汎用レジス
タの変換処理説明図である。FIG. 4 shows a diagram of the bit length conversion carried out in this embodiment. As shown in FIG. 5A (b), Pl is the number of focuses from the beginning of the block to the first bit of the nine bits to be converted, and Wl
The number of hides from the beginning of the flock closest to the first focus of the cigarette, W2 is the number of bits representing the difference between this Pl and W1*8, and W3 is the address closest to the beginning of the 9 bits to be converted expressed in bytes. show. Next, 4 bytes of data from the position indicated by address W3 are taken into the computer's general-purpose register (step 42). The reason why it is set to 4 bytes is because this general-purpose register has a size of 4 bytes. This state is shown in FIG. 5A (C). In this case, it is the W2-1 bit. Next, the bits in the register are shifted to the left by W2 bits (step 43). This situation is shown in FIG. 5B (d). This shift brings the first focus of the 9 bits to be converted to the left end of the register. Next step 44
to determine the processing mode. In this case, there are three processing modes as described above. The first processing mode is step 4
4 shows a case where 9-pin data is converted to 8-bit data. In this case, it is a 23-pin to the right diagram, and FIG. 5 is an explanatory diagram of the conversion process of the general-purpose register in the computer at the time of conversion.
本実施例においては、9ピッ1〜単位のデータ1010
000(11をそのまま8ビット単位のデータに変換す
る場合、このデータのMSDビット1を除去して8ピン
ト単位のデータに変換する場合、このデータのMSDビ
ットを含め3ビットを除去して6ビソトとじこれを8ビ
ット単位のデータに変換する場合の3つの場合について
説明する。In this embodiment, data 1010 in units of 9 pips
When converting 000 (11) directly to 8-bit unit data, if you remove MSD bit 1 of this data and convert it to 8-pin unit data, remove 3 bits including the MSD bit of this data and convert it to 6-bit data. Three cases of converting this data into 8-bit unit data will be described.
第3図においてメインプログラムは、9ビット長草位を
8ビット長草位に変換するステップに入ってくると、ま
ず変換すべきデータをデータファイル11よりブロック
単位で取り出す。この場合lブロックは3レコードから
なる。各レコードには36ビントからなるR CW (
Record Control Word)が設けられ
ている。このデータを1ブロック取り込むと本実施例の
サブルーチン13を呼び9ビット単位のデータを8ビッ
ト単位のデータに変換しメインプログラム12の出力領
域P4に出力する。次に第4図において、ステップ41
の各記号の意味は、フト(ステップ45)することによ
り9ビットのデータをシフトレジスタの右端に移動し、
3バイト目のデータ00000001と4ハ゛イト目の
データ01000001を得る(ステップ45)。この
様子を第5B図(e)に示す。このデータを2バイトの
データとして出力領域14に取り出す(ステップ48)
。この様子を第8図げ)に示す。In FIG. 3, when the main program enters the step of converting a 9-bit length into an 8-bit length, it first extracts the data to be converted from the data file 11 in blocks. In this case, l block consists of 3 records. Each record has an R CW (
Record Control Word) is provided. When one block of this data is taken in, the subroutine 13 of this embodiment is called, and the data in units of 9 bits is converted into data in units of 8 bits, and the data is output to the output area P4 of the main program 12. Next, in FIG. 4, step 41
The meaning of each symbol is to move 9-bit data to the right end of the shift register by shifting (step 45),
The third byte data 00000001 and the fourth byte data 01000001 are obtained (step 45). This situation is shown in FIG. 5B (e). Extract this data to the output area 14 as 2-byte data (step 48)
. This situation is shown in Figure 8).
次に9ビットの先頭の1ビットを除去して8ビットデー
タに変換する方法をステップ46に示す。Next, step 46 shows a method of removing the first bit of the 9 bits and converting them into 8-bit data.
この場合、第5B図(d)の状態から左へ1ビットシフ
ト後右へ24ビットシフトする(ステップ46)。In this case, from the state shown in FIG. 5B(d), a 1-bit shift is made to the left and then a 24-bit shift is made to the right (step 46).
この様子を第5C図(g5.ω)に示す。また9ビット
の先頭ピント3ビットを除去して6ビットデータに変換
する方法をステップ47に示し、この様子を第5C図(
i)、 (j)に示す。This state is shown in Fig. 5C (g5.ω). Step 47 shows a method of removing the first 3 bits of 9-bit focus and converting it to 6-bit data, and this process is shown in Figure 5C (
Shown in i) and (j).
以上の説明から明らかなように、9ビット単位データを
そのまま8ビットデータ2バイトに変換したり、先頭1
ビットを捨てて8ビットのデータに変換し8ビット単位
データ1バイトとし、又先頭3ビットを捨てて6ビット
データにして8ピット単位データ1バイトで表すことが
できる。なお、本実施例は9ビット長草位データを8ビ
ット長草位データに変換する説明をしたが、mビット長
単位データをnビット長単位データに変換することも同
様に容易にできる。これによりバイト系マシンで扱いに
くいビット列操作をサブルーチン形式でまとめて行うこ
とができるため、C0BOL等の高級言語で容易に任意
のビット長単位データを参照することが可能になる。今
後計算機システムのオープン化に伴い、異機種間でのデ
ータの受は渡し処理の増加が予想されるが、このときメ
ンテナンスしゃすいC0BOLで高速にビット列参照が
実現されるため、効率的にデータコンバータ等を開発で
きる。As is clear from the above explanation, it is possible to directly convert 9-bit unit data into 2 bytes of 8-bit data, or convert the first 1
The bits can be discarded and converted to 8-bit data to make 8-bit unit data of 1 byte, or the first 3 bits can be discarded to make 6-bit data and 8-bit unit data can be expressed as 1 byte of 8-bit data. Although the present embodiment has described converting 9-bit long grass position data to 8-bit long grass position data, m-bit length unit data can be similarly easily converted to n-bit length unit data. This allows bit string operations that are difficult to handle on byte-based machines to be performed all at once in a subroutine format, making it possible to easily reference data in units of arbitrary bit length using a high-level language such as COBOL. As computer systems become more open in the future, it is expected that there will be an increase in the number of passing processes needed to exchange data between different types of devices.In this case, high-speed bit string references can be realized using C0BOL, which is easy to maintain, so data conversion can be performed efficiently. etc. can be developed.
本発明により、mビット長単位のデータをnビット長単
位のデータに変換できるのでこの方法をサブルーチン化
しメインプログラムより呼び出すことによりC0BOL
等の高級言語で簡単に高速度で所望のビット長単位のデ
ータに変換することができる。According to the present invention, data in units of m-bit length can be converted to data in units of n-bit length, so by converting this method into a subroutine and calling it from the main program, C0BOL
It can be easily converted into data in units of desired bit length at high speed using a high-level language such as .
第1図は本発明の原理を示すフロー図、第2図は第1図
の内容を説明する図、第3図は本実施例をサブルーチン
プログラムとしたときのメインプログラムとの関係を示
す図、第4図は実施例の動作を示すフロー図、第5A図
、第5B図、第5C図は本実施例を実施中のレジスタの
シフト操作を説明する図、第6図は9ビットマシンのデ
ータを8ビットマシンデータに変換した具体例を示す図
である。
(a>
本発明の原理を示す図
第1図
第1図の内容を説明する図
第2図FIG. 1 is a flow diagram showing the principle of the present invention, FIG. 2 is a diagram explaining the contents of FIG. 1, and FIG. 3 is a diagram showing the relationship with the main program when this embodiment is a subroutine program. FIG. 4 is a flowchart showing the operation of the embodiment; FIGS. 5A, 5B, and 5C are diagrams explaining register shift operations during implementation of this embodiment; FIG. 6 is a 9-bit machine data FIG. 3 is a diagram showing a specific example of converting the data into 8-bit machine data. (a> Figure 1 showing the principle of the present invention Figure 2 explaining the contents of Figure 1
Claims (1)
で構成するデータに変換するビット長単位変換方式にお
いて、所定の基準位置から任意のmビット単位データの
先頭ビットの直前のビットまでのビット数をnで除して
整数商W1と整数剰余W2を求め、前記基準位置からW
1*n+1ビットを先頭ビットとするnの整数倍よりな
るkビットをkビットで構成されるレジスタに取り出し
、このレジスタ内ビットをW2ビット左へシフトし、さ
らにl(0≦l<m)ビット左へシフト後、k−m+l
ビット右へシフトし、このレジスタの左側よりk−m+
lビットまでのビット列には所定の値を入れることによ
り、nビット単位データを生成することを特徴とするビ
ット長単位変換方式。1. In the bit length unit conversion method that converts data composed of m-bit units to data composed of n-bit units, the bits from a predetermined reference position to the bit immediately before the first bit of arbitrary m-bit unit data Divide the number by n to obtain an integer quotient W1 and an integer remainder W2, and from the reference position W
Take out k bits consisting of an integer multiple of n with the 1*n+1 bit as the first bit into a register consisting of k bits, shift the bits in this register to the left by W2 bits, and further shift l (0≦l<m) bits. After shifting to the left, km+l
Shift bits to the right, k−m+ from the left side of this register
A bit length unit conversion method characterized in that n-bit unit data is generated by entering a predetermined value into a bit string up to l bits.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP22403190A JPH04104323A (en) | 1990-08-23 | 1990-08-23 | Bit length unit conversion system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP22403190A JPH04104323A (en) | 1990-08-23 | 1990-08-23 | Bit length unit conversion system |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH04104323A true JPH04104323A (en) | 1992-04-06 |
Family
ID=16807510
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP22403190A Pending JPH04104323A (en) | 1990-08-23 | 1990-08-23 | Bit length unit conversion system |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH04104323A (en) |
-
1990
- 1990-08-23 JP JP22403190A patent/JPH04104323A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US4611280A (en) | Sorting method | |
| JP5381710B2 (en) | Nondeterministic finite automaton generation system, method and program without ε transition | |
| EP0293161B1 (en) | Character processing system with spelling check function | |
| US4099257A (en) | Markov processor for context encoding from given characters and for character decoding from given contexts | |
| JPH06222903A (en) | Method and means for provision of static dictionary structure for unfolding of compressed data by compressing character data | |
| EP0688104A2 (en) | Data compression method and apparatus | |
| JP2746109B2 (en) | Huffman code decoding circuit | |
| US6822586B2 (en) | Apparatus and method for converting binary numbers to character codes | |
| JP5549177B2 (en) | Compression program, method and apparatus, and decompression program, method and apparatus | |
| US6112208A (en) | Data compressing method and apparatus to generate bit maps in accordance with extracted data symbols | |
| JPH04104323A (en) | Bit length unit conversion system | |
| CN118364917A (en) | Large model data token method and device and large model training method | |
| JPH056398A (en) | Document registration device and document search device | |
| CN106663020B (en) | Migration support device | |
| US20080301416A1 (en) | System and program product of doing pack unicode z series instructions | |
| JPH0440554A (en) | Character data processor | |
| JP4726046B2 (en) | Character string search device, computer program, and character string search method | |
| GB1593136A (en) | Data processing | |
| JP3476618B2 (en) | Barrel shift arithmetic unit | |
| JPH1115836A (en) | Table for searching character string, generation method therefor and character string searching method | |
| JPS642970B2 (en) | ||
| JP2003318739A (en) | System and method for compressing data sequence, and computer readable medium | |
| JPH04167821A (en) | Data coding and decoding method | |
| JP2629040B2 (en) | Japanese processing system | |
| JP3988973B2 (en) | Character string data compression apparatus, character string data compression method, and storage medium |