JP2010146521A - Arithmetic processing unit with floating point number computing function for controlling servo motor - Google Patents

Arithmetic processing unit with floating point number computing function for controlling servo motor Download PDF

Info

Publication number
JP2010146521A
JP2010146521A JP2008326358A JP2008326358A JP2010146521A JP 2010146521 A JP2010146521 A JP 2010146521A JP 2008326358 A JP2008326358 A JP 2008326358A JP 2008326358 A JP2008326358 A JP 2008326358A JP 2010146521 A JP2010146521 A JP 2010146521A
Authority
JP
Japan
Prior art keywords
floating
integer
point number
conversion
arithmetic
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2008326358A
Other languages
Japanese (ja)
Inventor
Yoshitaka Kashiwagi
喜孝 柏木
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.)
Yaskawa Electric Corp
Original Assignee
Yaskawa Electric 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 Yaskawa Electric Corp filed Critical Yaskawa Electric Corp
Priority to JP2008326358A priority Critical patent/JP2010146521A/en
Publication of JP2010146521A publication Critical patent/JP2010146521A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To solve the problem that computational performance is reduced due to format conversion required when control operation including both integers and floating point numbers is executed. <P>SOLUTION: A command includes a conversion flag for instructing format conversion to input and output data instructed by an operand. A decoding stage of a pipeline includes a format conversion part for converting the format of the input data, referring to the conversion flag, and preparing input data for an execution stage. A write-back stage of the pipeline includes a format conversion part for converting the format of the computation result of a computing unit in the execution stage, referring to the conversion flag, and preparing input data to be supplied to the execution stage for data in the write-back stage and forwarding. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、整数と浮動少数点数とを混在させてサーボモータ制御用の演算処理を行なう演算処理装置およびそのような演算処理装置を使用したサーボモータ制御装置に関する。   The present invention relates to an arithmetic processing device that performs arithmetic processing for servo motor control by mixing an integer and a floating-point number, and a servo motor control device using such an arithmetic processing device.

サーボモータの制御に特有の演算を高速に効率よく行うために、プログラム演算機能を搭載した専用のASICが使われるようになってきている。サーボモータの制御に必要な変数は、整数値を持つレジスタで管理されてきた。これは、位置決め等を行う場合の目標位置の指令値を、整数値として扱うパルスの数で表現しているからである。また、ゲイン等のサーボ制御を行うパラメータも整数値で管理する。しかし、制御用のフィルタ処理等では、変数同士の乗算等の演算が多く、整数の演算では、桁のオーバーフロー等の問題があり、そのチェックに時間を要するため、高速化を阻害する要因となっていた。サーボモータの制御においても、変数は整数で管理しながら、途中の演算、特に乗算等は浮動小数点数で行いたいという要求が出てきた。そうすれば、桁オーバフローの心配も無く、高速化が実現できる。しかし、そのためには、整数と浮動小数点数とが混在した演算を行う必要がある。従来の演算機能では、浮動小数点演算を行う前に、変換命令を用いて整数を浮動小数点数に変換しておき、演算結果を再び整数に変換命令によって変換するという手法がとられていた。この場合は、当然ながら変換命令の実行に必要な時間だけ、全体の処理が余計に掛かってしまう。
図8は、整数をフォーマット変換し、浮動小数点数で加算し、再び整数にフォーマット変換する場合の例であり、実際に演算を実行するステップ(FADD)以外はすべてフォーマット変換に必要なステップであり、これらのステップの実行時間分だけ余分な時間が発生する。
また、演算処理装置内にフォーマット変換部を持つことにより、フォーマット変換命令によってフォーマット変換を行なう必要がないようにしたもの(例えば特許文献1)がある。図6はそのような従来技術の例である。
図6では、数値演算プロセッサ100は内部データバス110に接続された変換部102およびリミット部106を備え、入力がローカルデータバス111であると共に出力がリミット部となる逆変換部103を備え、制御レジスタ部101に、変換部と逆変換部の動作を制御する変換制御ビット104と、逆変換部の状態出力を保持する変換状態ビット105と、リミット部の動作を制御するリミット部制御ビット107と、リミット部に与える境界値であるリミットデータ108を備えており、そして変換制御ビットとリミット部制御ビットの論理積をとるAND 109を備える。浮動小数点数フォーマット以外の数値フォーマットでインターフェースでき、浮動小数点数で演算部を動作させ、正しい演算結果を得ることを目的とする。(例えば、特許文献1参照)。
しかし、例えば、整数をフォーマット変換し、浮動少数点で加算し、再び整数にフォーマット変換する場合は図9のような記述となり、フォーマット変換の命令は不要だが、制御レジスタ部の変換制御ビットのセットとリセットを行う命令が追加され、この命令に必要な実行時間分の余分な時間が発生する。
特開2004-110665(11頁、図1)
Dedicated ASICs equipped with a program calculation function have come to be used in order to perform calculations specific to servo motor control efficiently at high speed. Variables necessary for servo motor control have been managed by registers having integer values. This is because the command value of the target position when performing positioning or the like is expressed by the number of pulses handled as an integer value. Parameters for servo control such as gain are also managed as integer values. However, in control filter processing, etc., there are many operations such as multiplication of variables.In integer operations, there is a problem such as overflow of digits, which requires time to check. It was. In the control of servo motors, there has been a demand to manage intermediate variables, especially multiplication, etc. with floating-point numbers while managing variables with integers. By doing so, speeding up can be realized without worrying about digit overflow. However, for that purpose, it is necessary to perform an operation in which an integer and a floating-point number are mixed. In the conventional arithmetic function, before performing a floating-point operation, a method is used in which an integer is converted into a floating-point number using a conversion instruction, and an operation result is converted again into an integer using the conversion instruction. In this case, as a matter of course, the entire processing is excessively performed for the time required for executing the conversion instruction.
FIG. 8 shows an example in which an integer is converted in format, added as a floating-point number, and converted into an integer again. All steps other than the step of actually executing an operation (FADD) are necessary for format conversion. Extra time is generated for the execution time of these steps.
In addition, there is an apparatus (for example, Patent Document 1) in which it is not necessary to perform format conversion by a format conversion instruction by having a format conversion unit in the arithmetic processing unit. FIG. 6 is an example of such a prior art.
In FIG. 6, the numerical processor 100 includes a conversion unit 102 and a limit unit 106 connected to the internal data bus 110, and includes an inverse conversion unit 103 whose input is the local data bus 111 and whose output is a limit unit, The register unit 101 includes a conversion control bit 104 for controlling the operation of the conversion unit and the inverse conversion unit, a conversion status bit 105 for holding the status output of the inverse conversion unit, and a limit unit control bit 107 for controlling the operation of the limit unit. And limit data 108 which is a boundary value to be given to the limit part, and AND 109 which takes the logical product of the conversion control bit and the limit part control bit. The purpose is to interface with a numeric format other than the floating-point number format, to operate the arithmetic unit with a floating-point number, and to obtain a correct calculation result. (For example, see Patent Document 1).
However, for example, when format conversion is performed on integers, addition is performed with floating-point numbers, and format conversion is performed again into integers, the description is as shown in FIG. An instruction for resetting is added, and extra time corresponding to the execution time necessary for this instruction is generated.
JP 2004-110665 (11 pages, Fig. 1)

サーボモータの制御を行うために、整数と浮動少数点が混在したような演算を行なう場合、あるいは演算だけは浮動少数点で実行するが、データとしては整数で保持するような場合、従来は事前にフォーマット変換命令を実行して演算のためのフォーマットを統一し、結果をまたフォーマット変換するといった方法がとられていた。
また、演算処理装置の中にフォーマット変換部を持つことによってフォーマット変換命令を不要にしたものもあるが、いずれも演算に必要なステップ以外の余分なステップが必要であり、その余分なステップを実行する時間分だけ全体の処理が遅くなるという問題があった。
本発明はこのような問題点に鑑みてなされたものであり、整数から浮動少数点数、あるいは浮動少数点数から整数へのフォーマット変換をパイプライン処理の中で並行して実行させることにより、フォーマット変換のための特別なステップを不要とし、演算に必要な時間のみで実行させることにより、サーボモータの制御を高速に行うことにある。
In order to control the servo motor, when performing operations such as mixed integers and floating-point numbers, or when only operations are performed with floating-point numbers, but data are stored as integers, it is conventional The format conversion instruction is executed to unify the format for the operation, and the result is converted again.
Some arithmetic processing units have a format conversion unit that eliminates the need for format conversion instructions, but both require extra steps other than those required for computation, and execute those extra steps. There was a problem that the entire processing was delayed by the amount of time.
The present invention has been made in view of such problems, and format conversion is performed by executing format conversion from an integer to a floating-point number or a floating-point number to an integer in parallel in a pipeline process. Therefore, the servo motor is controlled at a high speed by eliminating the special step for the above and performing it only in the time required for the calculation.

上記問題を解決するため、本発明は次のように構成したのである。
請求項1に記載の発明は、整数演算に加え、IEEE754に準拠する浮動少数点数演算を行うサーボモータ制御用の演算処理装置であって、オペランドで指示される入力および出力データに対して整数から浮動少数点数、あるいは浮動少数点数から整数へのフォーマット変換を指示する変換フラグを命令中に備え、パイプラインのデコード段に、前記変換フラグを参照して入力データを、整数から浮動少数点数、あるいは浮動少数点数から整数へフォーマット変換し、実行段の入力を作成する第1のフォーマット変換部を1つあるいは複数備え、パイプランのライトバック段に、前記変換フラグを参照して実行段の演算器の演算結果を、整数から浮動少数点数、あるいは浮動少数点数から整数へフォーマット変換し、ライトバック段の出力データおよびフォワーディングのための実行段の入力データを作成する第2のフォーマット変換部を備えるものである。
また、請求項2に記載の発明は、整数演算に加え、IEEE754に準拠する浮動少数点数演算を行うサーボモータ制御用の演算処理装置であって、整数から浮動少数点数、あるいは浮動少数点数から整数へのフォーマット変換の条件がエンコードされたオペランドを命令に備え、パイプラインのデコード段でオペコードをデコードすることで整数から浮動少数点数、あるいは浮動少数点数から整数へのフォーマット変換を指示する前記変換フラグを生成することを特徴とするものである。
また、請求項3に記載の発明は、前記浮動小数点数演算機能付き演算処理装置を、サーボモータ制御装置の演算処理装置として利用するものである。
In order to solve the above problem, the present invention is configured as follows.
The invention according to claim 1 is an arithmetic processing unit for servo motor control that performs floating-point arithmetic in conformity with IEEE754 in addition to integer arithmetic, and uses integers for input and output data indicated by operands. The instruction is provided with a conversion flag instructing floating-point number or format conversion from floating-point number to integer, and the pipeline decode stage refers to the conversion flag to input data, integer to floating-point number, or One or more first format converters for converting the format from floating-point number to integer and creating the input of the execution stage are provided. In the write-back stage of the pipeline, the arithmetic unit of the execution stage is referred to the conversion flag. The result of the operation is converted from integer to floating-point number or floating-point number to integer, and the output data of the write-back stage is converted. In which a second format conversion unit for generating input data for execution stage for data and forwarding.
The invention according to claim 2 is an arithmetic processing unit for servo motor control that performs floating-point arithmetic in accordance with IEEE754 in addition to integer arithmetic, and is an integer to floating-point number or a floating-point number to an integer. The conversion flag is provided with an operand encoded with a condition for format conversion to, and instructing format conversion from an integer to a floating-point number or from a floating-point number to an integer by decoding an operation code in a pipeline decoding stage Is generated.
The invention according to claim 3 uses the arithmetic processing device with a floating-point number arithmetic function as an arithmetic processing device of a servo motor control device.

請求項1に記載の発明によると、入力データおよび演算結果における全ての組合せについてフォーマット変換を実現できる。そのため、整数と浮動小数点数が混在して実行される制御演算を、演算性能を落とさず実行可能となる。さらに、変数をチェックすることで変換フラグを作成することが出来るため、例えばC言語のような高級言語での対応が容易という効果も合わせて備える。
また、請求項2に記載の発明によると、入力データおよび演算結果における全ての組合せについてフォーマット変換を実現できる。そのため、整数と浮動小数点数が混在して実行される制御演算を、演算性能を落とさず実行可能となる。さらに、変数をチェックすることで変換フラグを作成することが出来るため、例えばC言語のような高級言語での対応が容易という効果も合わせて備える。
また、請求項3に記載の発明によると、フォーマット変換に無駄な時間を発生させないため、サーボ装置の制御性能を向上することができるようになる。
According to the first aspect of the present invention, format conversion can be realized for all combinations of input data and calculation results. For this reason, it is possible to execute a control operation executed by mixing integers and floating-point numbers without reducing the operation performance. Furthermore, since the conversion flag can be created by checking the variable, for example, it is also possible to easily cope with a high-level language such as C language.
According to the second aspect of the present invention, format conversion can be realized for all combinations of input data and calculation results. For this reason, it is possible to execute a control operation executed by mixing integers and floating-point numbers without reducing the operation performance. Furthermore, since the conversion flag can be created by checking the variable, for example, it is also possible to easily cope with a high-level language such as C language.
According to the third aspect of the present invention, it is possible to improve the control performance of the servo device because no unnecessary time is generated for format conversion.

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

図1は、本発明の浮動小数点数演算を実行する演算処理装置のブロック図である。図1において、演算処理装置2の演算器16は2入力1出力の演算を行う。そのため、本実施例では、変換フラグ11が入力用にそれぞれ1ビットづつと出力用に1ビットの合計3ビットを備えている。フェッチ段6は命令メモリ3に記憶されている命令5をフェッチする。命令はオペコード10、変換フラグとオペランド12がエンコードされている。パイプライン処理を行うため、このフェッチした命令はFFでラッチされて、デコード段7に出力される。デコード段では入力用の変換フラグがフォーマット変換部13 14に入力される。フォーマット変換部は変換フラグが有効な場合はフォーマット変換を行うが、無効な場合はフォーマット変換を行わない。レジスタ4が、フェッチ段に備えられたフォーマット変換部への入力となる。フェッチ段のデータはFFでラッチされ実行段8に出力される。実行段では2つの入力データを用いて演算を行い、演算結果を生成する。実行段のデータはFFでラッチされライトバック段9に出力される。ライトバック段では出力用の変換フラグと、演算結果がフォーマット変換部17に入力される。変換フラグが有効な場合はフォーマット変換を行うが、無効な場合はフォーマット変換を行わない。ライトバック段のフォーマット変換部の出力は最終的にレジスタに書込まれる。また、ライトバック段のフォーマット変換部の出力がフォワーディングのために利用される。フォワーディングとはライトバックされるデータを次の命令がすぐに利用できるように設けられたバイパス回路のことである。
図7は、フォーマット変換部の詳細ブロック図である。フォーマット変換部13、14、17は、基本的に同一の構成を持つのでフォーマット変換部13で説明する。フォーマット変換部13は、入力のセレクタ30と、浮動少数点数生成部31、整数生成部37、出力のセレクタ42から構成される。入力のセレクタ30はFFでラッチされたオペランド12とレジスタ5の出力をFFでラッチされたオペコード10で選択する。オペコードは即値命令の場合、オペランドを、それ以外の命令の場合はレジスタを選択する。
整数を浮動少数点に変換する浮動小数点数生成部は、整数調整部32と、符号生成部33、指数生成部34、仮数生成部35、浮動少数点数符号化部36から構成される。整数調整部は、浮動少数点の場所を確定するための最上位の1の位置を算出する(図2のS1)。符号生成部は、セレクタ出力の最上位ビットを符号として利用する(図2のS2)。指数生成部は、符号を除く最上位の1の位置から指数を決定する(図2のS3)。これは、オフセット127に最上位の1の位置を加算することで得ることができる。仮数生成部は、符号を除く最上位の1の位置より右側を利用して仮数を決定する。(図2のS4)。浮動少数点符号化部は、最上位に符号生成部の出力を、その下位に指数生成部の出力を、さらにその下位に仮数生成部の出力を並べて符号化する(図2のS5)ことで、浮動少数点数を生成する。
浮動少数点数を整数に変換する整数変換部は、符号生成部38と、指数検査部39、仮数調整部40、整数符号化部41から構成される。指数検査部は、指数が整数で表される範囲内か(図3のS7)を検査する。仮数調整部は、仮数の最上位に1を付加する(図3のS6)。1を付加した仮数に対して、指数が整数で表される範囲内の場合、仮数を指数だけシフトして符号無し整数とする(図3のS8)。この時指数からオフセットの127を引いておく。符号生成部は、セレクタ出力の最上位ビットを利用して、最上位に符号ビットを付加する(図3のS9)。整数符号化部は、指数が整数で表される範囲内の場合は、最上位を符号生成部の出力に、その下位に仮数調整部の出力を符号化して整数として出力する。また、指数が整数で表される範囲外の場合は、エラー用符号なし整数を生成し(図3のS10)、これを出力する。
出力のセレクタ42は、浮動少数点数生成部の出力と、整数生成部の出力、セレクタ30の出力を入力として、FFでラッチだれた変換フラグ11により、出力を選択する。変換フラグが整数を浮動少数点数に変換する場合は、浮動少数点数生成部の出力を選択し、また、変換フラグが浮動少数点数を整数に変換する場合は、整数生成部の出力を選択し、変換フラグが無変換の場合はセレクタ30の出力を選択し、セレクタ42の出力とする。
フォーマット変換部は、シフタやセレクタで構成できるので、論理の段数を実行段の演算に要する段数に比べて少なくすることができる。そのため、デコード段やライトバック段にフォーマット変換の回路を実装しても、パイプラインのクロックの動作周波数を落とさないですむのである。
パイプライン処理においては、実行段は複雑な処理を行なうため、他の段に比べて組合せ回路の段数が深くなり、処理に必要な時間が長くなり、パイプラインを動作させるクロックは実行段の実行時間で決定される。よってデコード段やライトバック段では実行時間は余裕があり、フォーマット変換を本来のデコードやライトバックと並行して実行することは可能である。
図10は、整数をフォーマット変換し、浮動小数点数で加算し、再び整数にフォーマット変換する場合の例である。
この記述では、LD命令の後、ピリオドに続いて書かれた“f”が、整数を浮動少数点数に変換することを示す変換フラグである。また、ST命令の後、ピリオドに続いて書かれた“d”も、浮動小数点数を整数に変換することを示す変換フラグである。
さらに、FADD命令がオペランドにメモリを使用できる場合には、図11のように演算命令のみとなる。
この記述では、FADD命令の後、ピリオドに続いて書かれた“f1”、 “f2”、 “d3”が変換フラグである。“f1”はオペランド1(INT_D1)に対して整数を浮動少数点数に変換することを示し、“f2”はオペランド2(INT_D2)に対して整数を浮動少数点数に変換することを示し、“d3”はオペランド3(INT_D3)に対して浮動少数点数を整数に変換することを示す。
FIG. 1 is a block diagram of an arithmetic processing unit for executing floating point number arithmetic operations according to the present invention. In FIG. 1, the arithmetic unit 16 of the arithmetic processing unit 2 performs a 2-input 1-output operation. For this reason, in this embodiment, the conversion flag 11 has a total of 3 bits, one bit for input and one bit for output. The fetch stage 6 fetches the instruction 5 stored in the instruction memory 3. The instruction is encoded with an opcode 10, a conversion flag and an operand 12. In order to perform pipeline processing, the fetched instruction is latched by FF and output to the decode stage 7. In the decoding stage, a conversion flag for input is input to the format conversion unit 131. The format conversion unit performs format conversion when the conversion flag is valid, but does not perform format conversion when it is invalid. The register 4 becomes an input to the format conversion unit provided in the fetch stage. The fetch stage data is latched by FF and output to the execution stage 8. In the execution stage, an operation is performed using two input data, and an operation result is generated. The execution stage data is latched by FF and output to the write back stage 9. In the write-back stage, an output conversion flag and an operation result are input to the format conversion unit 17. If the conversion flag is valid, format conversion is performed. If the conversion flag is invalid, format conversion is not performed. The output of the format conversion unit in the write-back stage is finally written into the register. Further, the output of the format conversion unit in the write-back stage is used for forwarding. Forwarding is a bypass circuit provided so that data to be written back can be used immediately by the next instruction.
FIG. 7 is a detailed block diagram of the format conversion unit. Since the format converters 13, 14, and 17 have basically the same configuration, the format converter 13 will be described. The format conversion unit 13 includes an input selector 30, a floating point number generation unit 31, an integer generation unit 37, and an output selector 42. The input selector 30 selects the operand 12 latched by FF and the output of the register 5 by the operation code 10 latched by FF. The opcode selects an operand for an immediate instruction and a register for any other instruction.
The floating-point number generation unit that converts an integer into a floating-point number includes an integer adjustment unit 32, a code generation unit 33, an exponent generation unit 34, a mantissa generation unit 35, and a floating-point number encoding unit 36. The integer adjustment unit calculates the highest 1 position for determining the location of the floating point (S1 in FIG. 2). The code generation unit uses the most significant bit of the selector output as a code (S2 in FIG. 2). The exponent generation unit determines the exponent from the highest 1 position excluding the sign (S3 in FIG. 2). This can be obtained by adding the most significant 1 position to the offset 127. The mantissa generation unit determines the mantissa by using the right side of the most significant 1 position excluding the sign. (S4 in FIG. 2). The floating point encoder encodes the output of the code generator at the top, the output of the exponent generator below it, and the output of the mantissa generator below it (S5 in FIG. 2). Generate floating point numbers.
The integer conversion unit that converts a floating-point number into an integer includes a code generation unit 38, an exponent check unit 39, a mantissa adjustment unit 40, and an integer encoding unit 41. The exponent inspection unit inspects whether the exponent is within a range represented by an integer (S7 in FIG. 3). The mantissa adjustment unit adds 1 to the most significant mantissa (S6 in FIG. 3). If the exponent is in the range represented by an integer with respect to the mantissa with 1 added, the mantissa is shifted by the exponent to make an unsigned integer (S8 in FIG. 3). At this time, the offset 127 is subtracted from the index. The code generator uses the most significant bit of the selector output to add the sign bit to the most significant (S9 in FIG. 3). When the exponent is within the range represented by an integer, the integer encoding unit encodes the output of the mantissa adjustment unit in the lower order and the output of the mantissa adjustment unit as an integer. If the exponent is out of the range represented by an integer, an unsigned integer for error is generated (S10 in FIG. 3) and output.
The output selector 42 receives the output of the floating-point generator, the output of the integer generator, and the output of the selector 30, and selects the output by the conversion flag 11 latched at FF. If the conversion flag converts an integer to a floating-point number, select the output of the floating-point number generator, and if the conversion flag converts a floating-point number to an integer, select the output of the integer generator. When the conversion flag is not converted, the output of the selector 30 is selected and used as the output of the selector 42.
Since the format conversion unit can be composed of a shifter and a selector, the number of logical stages can be reduced compared to the number of stages required for execution stage calculations. Therefore, even if a format conversion circuit is mounted in the decode stage or write back stage, it is not necessary to reduce the operating frequency of the pipeline clock.
In pipeline processing, since the execution stage performs complex processing, the number of stages of combinational circuits becomes deeper than other stages, and the time required for processing increases, and the clock that operates the pipeline executes the execution stage. Determined by time. Therefore, the decoding stage and the write back stage have a sufficient execution time, and format conversion can be executed in parallel with the original decoding and write back.
FIG. 10 shows an example in which an integer is converted in format, added as a floating-point number, and converted into an integer again.
In this description, “f” written after the period after the LD instruction is a conversion flag indicating that an integer is converted to a floating-point number. Also, “d” written after the period after the ST instruction is a conversion flag indicating that a floating-point number is converted to an integer.
Further, when the FADD instruction can use a memory as an operand, only an arithmetic instruction is used as shown in FIG.
In this description, “f1”, “f2”, and “d3” written after the period after the FADD instruction are conversion flags. “F1” indicates that an integer is converted to a floating-point number for operand 1 (INT_D1), “f2” indicates that an integer is converted to a floating-point number for operand 2 (INT_D2), and “d3 "" Indicates that floating-point numbers are converted to integers for operand 3 (INT_D3).

図2は、本発明の浮動小数点数演算を実行する演算処理装置のフローチャートであり、フォーマット変換部で実行する整数から浮動小数点数への変換を説明する。整数から浮動小数点数へ変換を行うには、以下の5つのステップを実行する。

ステップ1:浮動小数点の場所を確定するため最上位の1の位置を算出する S1
ステップ2:符号付整数の場合には最上位の1ビットを符号とする S2
ステップ3:符合を除いた最上位の1の位置から指数を決定する S3
ステップ4:符合を除いた最上位の1の位置より右側を利用して仮数を決定する S4
ステップ5:符号、指数と仮数を利用して浮動小数点数を作成する S5
FIG. 2 is a flowchart of the arithmetic processing unit that executes the floating point number arithmetic operation according to the present invention, and describes the conversion from integer to floating point number executed by the format conversion unit. To convert an integer to a floating point number, perform the following five steps:

Step 1: Calculate the highest 1 position to determine the floating point location S1
Step 2: For signed integers, the most significant bit is the sign S2
Step 3: Determine the exponent from the highest 1 position excluding the sign S3
Step 4: Determine the mantissa using the right side of the highest 1 position excluding the sign S4
Step 5: Create floating-point number using sign, exponent and mantissa S5

図3は、本発明の浮動小数点数演算を実行する演算処理装置のフローチャートであり、フォーマット変換部で実行する浮動小数点数から整数への変換を説明する。浮動小数点数から整数へ変換を行うには、以下の3つのステップを実行する。

ステップ1:仮数の先頭に1を付加する S6
ステップ2:指数が整数で表される範囲内かチェックする S7
ステップ2.1:範囲内の場合には仮数を指数だけシフトして符号無し整数を作成するS8
ステップ2.2:範囲外はエラーのためエラー用の符号なし整数を作成する S10
ステップ3:先頭に符号ビットを付加して符号付整数とする S9

浮動小数点数は整数より大きな数を扱えるので、整数の範囲外の場合はオーバフローであり、エラーとする必要がある。このときエラー用の符号なし整数には、例えば32ビット整数だと符合を除いた31ビット全てが1の0x80000000を利用するとよい。
FIG. 3 is a flowchart of the arithmetic processing unit that executes the floating point number arithmetic operation according to the present invention, and describes the conversion from the floating point number to the integer executed by the format conversion unit. To convert from a floating point number to an integer, perform the following three steps:

Step 1: Add 1 to the beginning of the mantissa S6
Step 2: Check whether the exponent is within the range represented by an integer S7
Step 2.1: Create an unsigned integer by shifting the mantissa by an exponent if it is within range S8
Step 2.2: Create an unsigned integer for error because it is out of range S10
Step 3: Add a sign bit to the beginning to make a signed integer S9

Floating point numbers can handle numbers larger than integers, so if they are outside the range of integers, it is an overflow and must be an error. At this time, for an unsigned integer for error, for example, if it is a 32-bit integer, it is good to use 0x80000000 in which all 31 bits except the sign are 1.

図4は、本発明の浮動小数点数演算を実行する演算処理装置のブロック図である。実施例1と異なるのは、フォーマット変換がエンコードされたオペコード10を命令5が備えている点と、フェッチ段6においてオペコード10をデコードするデコーダ18を備え、デコーダ出力で変換フラグ11とオペコード19を生成する点である。入力データが2個、出力データが1個の場合の演算では、演算の種類は1つであるが、フォーマット変換の組合せが8通りであるので、命令は8個になる。デコーダはこの命令をデコードし、オペコード19と変換フラグ11を生成する。
図12は、整数をフォーマット変換し、浮動小数点数で加算し、再び整数にフォーマット変換する場合の例である。
この記述では、LDF命令がロード時に整数を浮動少数点数に変換することを示す命令である。また、STD命令もストア時に浮動小数点数を整数に変換することを示す命令である。
さらに、FADD命令がオペランドにメモリを使用できる場合には、図13のように演算命令のみとなる。
この記述では、FADDf1f2d3命令が変換命令である。はオペランド1(INT_D1)とオペランド2(INT_D2)に対して整数を浮動少数点数に、オペランド3(INT_D3)に対して浮動少数点数を整数に変換することを示す。
FIG. 4 is a block diagram of an arithmetic processing unit for executing the floating point number arithmetic operation of the present invention. The difference from the first embodiment is that the instruction 5 includes the operation code 10 encoded in the format conversion, and the decoder 18 that decodes the operation code 10 in the fetch stage 6, and the conversion flag 11 and the operation code 19 are set at the decoder output. It is a point to generate. In an operation with two input data and one output data, there is one operation type, but there are eight combinations of format conversion, so there are eight instructions. The decoder decodes this instruction and generates an operation code 19 and a conversion flag 11.
FIG. 12 shows an example in which an integer is converted in format, added as a floating-point number, and converted into an integer again.
In this description, the LDF instruction is an instruction indicating that an integer is converted to a floating-point number at the time of loading. The STD instruction is also an instruction indicating that a floating point number is converted to an integer at the time of storing.
Further, when the FADD instruction can use a memory as an operand, only an operation instruction is provided as shown in FIG.
In this description, the FADDf1f2d3 instruction is a conversion instruction. Indicates that integers are converted to floating-point numbers for operand 1 (INT_D1) and operand 2 (INT_D2), and floating-point numbers are converted to integers for operand 3 (INT_D3).

図5は、浮動小数点数演算を実行する演算処理装置とそれを利用したサーボ装置のブロック図である。サーボ装置1は制御演算を実行する演算処理装置 2と、サーボモータ24へのモータ電流を生成するパワー部と、パワー部の出力をAD変換し演算処理装置とインターフェースするADC 21と、エンコーダ24とインターフェースするエンコーダIF 22から構成される。ADCやエンコーダIFから入力されるフィードバック値は整数であるため、演算処理装置では浮動小数点数と整数が混在して制御演算が実行される。そのため、浮動小数点数と整数間のフォーマット変換が不可欠であり、フォーマット変換に無駄な時間を発生させないため、サーボ装置の制御性能を向上することができるようになる。   FIG. 5 is a block diagram of an arithmetic processing unit that executes floating point number arithmetic and a servo device using the arithmetic processing unit. The servo device 1 includes an arithmetic processing unit 2 that executes control calculation, a power unit that generates a motor current to the servo motor 24, an ADC 21 that AD converts the output of the power unit and interfaces with the arithmetic processing unit, an encoder 24, It consists of an encoder IF 22 that interfaces. Since the feedback value input from the ADC or encoder IF is an integer, the arithmetic processing unit executes a control operation with a mixture of floating point numbers and integers. For this reason, format conversion between a floating point number and an integer is indispensable, and unnecessary time is not required for format conversion, so that the control performance of the servo device can be improved.

本発明の第1実施例を示す浮動小数点数演算を実行する演算処理装置のブロック図1 is a block diagram of an arithmetic processing unit that performs floating-point arithmetic operations according to a first embodiment of the present invention. 本発明の第1実施例を示す浮動小数点数演算を実行する演算処理装置のフローチャート図The flowchart figure of the arithmetic processing unit which performs floating point number arithmetic which shows 1st execution example of this invention 本発明の第1実施例を示す浮動小数点数演算を実行する演算処理装置のフローチャート図The flowchart figure of the arithmetic processing unit which performs floating point number arithmetic which shows 1st execution example of this invention 第2実施例を示す浮動小数点数演算を実行する演算処理装置のブロック図The block diagram of the arithmetic processing unit which performs the floating point number calculation which shows 2nd Example 第3実施例を示す浮動小数点数演算を実行する演算処理装置とそれを搭載したサーボ装置のブロック図Block diagram of an arithmetic processing unit for executing floating point number arithmetic and a servo device equipped with the same according to a third embodiment 従来の浮動小数点数演算を実行する演算処理装置のブロック図A block diagram of an arithmetic processing unit that executes conventional floating-point number arithmetic 第1実施例のフォーマット変換部の詳細ブロック図Detailed block diagram of format converter of first embodiment フォーマット変換命令によってフォーマット変換を行なう命令の記述例 (従来技術)Description example of instructions for format conversion by format conversion instructions (prior art) フォーマット変換機能を持った演算処理装置用の命令記述例 (従来技術)Example of instruction description for arithmetic processing unit with format conversion function (prior art) 第1実施例の場合の演算命令の記述例1Description example 1 of operation instruction in the case of the first embodiment 第1実施例の場合の演算命令の記述例2Description example 2 of operation instruction in the case of the first embodiment 第2実施例の場合の演算命令の記述例1Description example 1 of the operation instruction in the case of the second embodiment 第2実施例の場合の演算命令の記述例2Description example 2 of operation instruction in the case of the second embodiment

符号の説明Explanation of symbols

1 サーボ装置
2 演算処理装置
3 命令メモリ
4 命令
5 レジスタ
6 フェッチ段
7 デコード段
・ 実行段
・ ライトバック段
・ オペコード
・ 変換フラグ
・ オペランド
・ フォーマット変換部
14 フォーマット変換部
15 セレクタ
16 演算器
17 フォーマット変換部
18 デコーダ
19 オペコード
20 パワー部
21 ADC
22 エンコーダIF
23 サーボモータ
・ エンコーダ
・ セレクタ
・ 浮動小数点数生成部
・ 整数調整部
・ 符号生成部
・ 指数生成部
・ 仮数生成部
・ 浮動小数点数符号化部
・ 整数生成部
・ 符号生成部
・ 指数検査部
・ 仮数調整部
・ 整数符号化部
・ セレクタ
100 数値演算プロセッサ
101 制御レジスタ部
102 変換部
103 逆変換部
104 変換制御ビット
105 変換状態ビット
106 リミット部
107 リミット部制御ビット
108 リミットデータ
109 AND1
110 内部データバス
111 ローカルデータバス
1 Servo device
2 Arithmetic processing unit
3 Instruction memory
4 instructions
5 registers
6 fetch stages
7 Decode stage, execution stage, write back stage, opcode, conversion flag, operand, format converter
14 Format converter
15 Selector
16 Calculator
17 Format converter
18 Decoder
19 Opcode
20 Power section
21 ADC
22 Encoder IF
23 Servo motor, Encoder, Selector, Floating point number generator, Integer adjuster, Sign generator, Exponent generator, Mantissa generator, Floating point encoder, Integer generator, Sign generator, Exponent checker, Mantissa Adjustment unit, integer coding unit, selector
100 math processor
101 Control register section
102 Conversion unit
103 Inverse converter
104 Conversion control bit
105 Conversion status bit
106 Limit section
107 Limit control bit
108 Limit data
109 AND1
110 Internal data bus
111 Local data bus

Claims (3)

整数演算に加え、IEEE754に準拠する浮動少数点数演算を行うサーボモータ制御用の演算処理装置であって、オペランドで指示される入力および出力データに対して整数から浮動少数点数、あるいは浮動少数点数から整数へのフォーマット変換を指示する変換フラグを命令中に備え、パイプラインのデコード段に、前記変換フラグを参照して入力データを、整数から浮動少数点数、あるいは浮動少数点数から整数へフォーマット変換し、実行段の入力を作成する第1のフォーマット変換部を1つあるいは複数備え、パイプランのライトバック段に、前記変換フラグを参照して実行段の演算器の演算結果を、整数から浮動少数点数、あるいは浮動少数点数から整数へフォーマット変換し、ライトバック段の出力データおよびフォワーディングのための実行段の入力データを作成する第2のフォーマット変換部を備えることを特徴とするサーボモータ制御用浮動少数点数演算機能付き演算処理装置。   An arithmetic processing unit for servo motor control that performs floating-point arithmetic conforming to IEEE 754 in addition to integer arithmetic, from an integer to a floating-point number or a floating-point number for input and output data indicated by an operand A conversion flag for instructing format conversion to an integer is provided in the instruction, and the input data is converted from an integer to a floating-point number or from a floating-point number to an integer by referring to the conversion flag in the pipeline decoding stage. One or more first format conversion units for creating the execution stage input are provided, and the calculation result of the execution stage arithmetic unit is converted from an integer to a floating-point number by referring to the conversion flag in the pipeline write-back stage. Or format conversion from floating-point number to integer, output data and forwardin of write-back stage An arithmetic processing unit with a floating-point number arithmetic function for servo motor control, comprising: a second format conversion unit that creates input data of an execution stage for operation. 整数演算に加え、IEEE754に準拠する浮動少数点数演算を行うサーボモータ制御用の演算処理装置であって、整数から浮動少数点数、あるいは浮動少数点数から整数へのフォーマット変換の条件がエンコードされたオペランドを命令を備え、パイプラインのデコード段でオペコードをデコードすることで整数から浮動少数点数、あるいは浮動少数点数から整数へのフォーマット変換を指示する前記変換フラグを生成することを特徴とする請求項1記載のサーボモータ制御用浮動少数点数演算機能付き演算処理装置。   An arithmetic processing unit for servo motor control that performs floating-point arithmetic conforming to IEEE 754 in addition to integer arithmetic, and an operand in which a format conversion condition from integer to floating-point number or floating-point number to integer is encoded The conversion flag is generated by instructing format conversion from an integer to a floating-point number or from a floating-point number to an integer by decoding an opcode at a decoding stage of a pipeline. Arithmetic processing device with floating-point arithmetic function for servo motor control as described. 前記サーボモータ制御用浮動少数点数演算機能付き演算処理装置を使ったサーボモータ制御装置。   A servo motor control device using the arithmetic processing device with a floating-point arithmetic function for servo motor control.
JP2008326358A 2008-12-22 2008-12-22 Arithmetic processing unit with floating point number computing function for controlling servo motor Pending JP2010146521A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008326358A JP2010146521A (en) 2008-12-22 2008-12-22 Arithmetic processing unit with floating point number computing function for controlling servo motor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008326358A JP2010146521A (en) 2008-12-22 2008-12-22 Arithmetic processing unit with floating point number computing function for controlling servo motor

Publications (1)

Publication Number Publication Date
JP2010146521A true JP2010146521A (en) 2010-07-01

Family

ID=42566852

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008326358A Pending JP2010146521A (en) 2008-12-22 2008-12-22 Arithmetic processing unit with floating point number computing function for controlling servo motor

Country Status (1)

Country Link
JP (1) JP2010146521A (en)

Similar Documents

Publication Publication Date Title
TWI608410B (en) Standard format intermediate result
US8832166B2 (en) Floating point multiplier circuit with optimized rounding calculation
CN108647044B (en) Floating point scaling processor, method, system and instructions
TWI515649B (en) Reducing power consumption in a fused multiply-add (fma) unit responsive to input data values
TWI402766B (en) Graphics processor
US7949696B2 (en) Floating-point number arithmetic circuit for handling immediate values
US9104479B2 (en) Apparatus and method for rounding a floating-point value to an integral floating-point value
EP2435906B1 (en) Dsp engine with implicit mixed operands
JP2009536771A (en) Mode-based multiply-add processor for denormalized operands
JP2001256038A (en) Data processor with flexible multiplication unit
JP2008083795A (en) Bit field operation circuit
Wahba et al. Area efficient and fast combined binary/decimal floating point fused multiply add unit
Boersma et al. The POWER7 binary floating-point unit
JP4601544B2 (en) Data processing apparatus and method for generating result value by performing reciprocal operation on input value
US20060218380A1 (en) Add-shift-round instruction with dual-use source operand for DSP
GB2423385A (en) Determining an initial estimate of a result value of a reciprocal operation
US20060218377A1 (en) Instruction with dual-use source providing both an operand value and a control value
GB2410097A (en) Constant generation in floating point processing
JP2010146521A (en) Arithmetic processing unit with floating point number computing function for controlling servo motor
TWI822952B (en) Processing of iterative operation
US20060218381A1 (en) Rounding correction for add-shift-round instruction with dual-use source operand for DSP
JP7099197B2 (en) Arithmetic processing unit, arithmetic unit and control method of arithmetic processing unit
JP3462670B2 (en) Calculation execution method and calculation device
Takamaeda-Yamazaki et al. Ultrasmall: a tiny soft processor architecture with multi-bit serial datapaths for FPGAs
JPH0469734A (en) Underflow exception generation predicting circuit for floating point addition/subtraction