JP2014067353A - Rtl optimization method, device and program - Google Patents
Rtl optimization method, device and program Download PDFInfo
- Publication number
- JP2014067353A JP2014067353A JP2012213760A JP2012213760A JP2014067353A JP 2014067353 A JP2014067353 A JP 2014067353A JP 2012213760 A JP2012213760 A JP 2012213760A JP 2012213760 A JP2012213760 A JP 2012213760A JP 2014067353 A JP2014067353 A JP 2014067353A
- Authority
- JP
- Japan
- Prior art keywords
- branch
- statement
- correction
- rtl
- signal
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Abstract
Description
本発明は、ハードウェア記述言語(HDL)の1つであるRTL(Register Transfer Level)記述を最適化する処理に関する。 The present invention relates to processing for optimizing RTL (Register Transfer Level) description, which is one of hardware description languages (HDL).
ハードウェア記述の1つであるRTLは、ハードウェア内部の構造を定義し、クロック動作に基づいたレジスタからレジスタへの機能を記述する。ハードウェアの論理回路設計段階では、RTLソースの記述の文法規約をチェックするだけでなく、記述に基づく論理回路がより適正に動作をする構成になっているかをチェックする必要がある。 The RTL, which is one of the hardware descriptions, defines a structure inside the hardware and describes a function from register to register based on a clock operation. At the hardware logic circuit design stage, it is necessary not only to check the grammar conventions of the description of the RTL source, but also to check whether the logic circuit based on the description is configured to operate more appropriately.
RTLソースで、分岐を記述するif−elseについて、if−else文のネスト段階が深い場合に、回路化した際にタイミングが悪化することが認識されている。そのため、RTLチェックの従来手法では、一定数以上の段数を持つif−else文を警告対象としている。警告がなされたif−else分岐について、修正が必要であるか、どのように修正するかを、作業者は自らの経験則に基づいて手作業で修正している。 With regard to if-else describing a branch in an RTL source, it is recognized that the timing is deteriorated when the if-else statement is deeply nested when the nest stage is deep. Therefore, in the conventional method of RTL check, an if-else statement having a certain number of stages or more is targeted for warning. The operator manually corrects whether or not the if-else branch for which warning has been made is necessary or how to correct it based on his own rule of thumb.
また、RTL修正の従来手法として、RTLソース内のif−else文をcase文に自動変更する手法が知られている。 Further, as a conventional technique for RTL correction, a technique for automatically changing an if-else sentence in an RTL source to a case sentence is known.
上記の従来手法では、RTLソース内のif−else文をcase文に修正するが、単に、if−else文をcase文に変形すると、論理回路が冗長な構成になってしまうという問題がある。 In the above conventional method, the if-else statement in the RTL source is corrected to the case statement. However, if the if-else statement is simply transformed into the case statement, there is a problem that the logic circuit becomes redundant.
図34および図35は、従来手法による修正の問題を説明するための図である。図34(A)は、元の(修正前の)RTLソースの例を示す図、図34(B)は、従来手法による修正後のRTLソースの例を示す図である。図35(A)は、図34(A)の元のRTLソースによる回路構成例を示す図、図35(B)は、図34(B)の修正後のRTLソースによる回路構成例を示す図である。 34 and 35 are diagrams for explaining the problem of correction by the conventional method. FIG. 34A is a diagram showing an example of the original (before correction) RTL source, and FIG. 34B is a diagram showing an example of the RTL source after correction by the conventional method. 35A shows a circuit configuration example using the original RTL source in FIG. 34A, and FIG. 35B shows a circuit configuration example using the modified RTL source in FIG. 34B. It is.
図34(A)に示すRTLソースの第7〜11行に記述されているif−else文が、図34(B)に示すRTLソースの第7〜14行に記述されているcase文に変形される。回路構成で示すと、図35(A)に示すように、1ビット(bit)入力のセレクタ3段が直列に接続する構成が、図35(B)に示すように、3ビット一致比較と1ビットANDの構成に変形される。すなわち、元のRTLソースでは、信号の選択条件が1条件であるが、修正後のRTLソースでは、信号の選択条件が2条件となるため2つの比較回路が必要となってしまう。修正後のRTLソースによる回路構成は、一般的に、冗長な判断論理の追加と判断される。 The if-else statement described in the 7th to 11th lines of the RTL source shown in FIG. 34A is transformed into the case statement described in the 7th to 14th lines of the RTL source shown in FIG. Is done. In terms of the circuit configuration, as shown in FIG. 35A, a configuration in which three stages of 1-bit (bit) input selectors are connected in series is shown in FIG. It is transformed into a bit AND configuration. That is, in the original RTL source, the signal selection condition is one condition, but in the corrected RTL source, since the signal selection condition is two conditions, two comparison circuits are required. The circuit configuration with the corrected RTL source is generally determined as addition of redundant determination logic.
従来手法によるif−else文のcase文への自動変形は、回路構成を最適化するものではないため、作業者は、回路構成が最適となる段数を考慮してif−else文を手作業で修正しなければならないという問題は解決できなかった。 Since the automatic transformation of the if-else statement into the case statement by the conventional method does not optimize the circuit configuration, the operator manually handles the if-else statement in consideration of the number of stages at which the circuit configuration is optimal. The problem that had to be fixed could not be solved.
本発明の目的は、RTLソースに含まれるif−else文による分岐の記述を最適化する処理方法、装置およびプログラムを提供することである。 An object of the present invention is to provide a processing method, apparatus, and program for optimizing the description of a branch by an if-else statement included in an RTL source.
本発明の一態様として開示するRTL最適化方法は、コンピュータが、1)対象回路を記述するRTLソースから、予め設定された閾値が示す段数以上のif−else文の段数で構成されたif−else分岐を抽出し、2)予め、if−else分岐の複数の修正方法をif−else文の条件に対応付けて設定しておき、抽出した前記if−else分岐を構成する条件をもとに、該複数の修正方法の1つを決定し、3)前記RTLソースの抽出した前記if−else分岐を、決定した修正方法に基づいて修正する、処理を実行するものである。 The RTL optimization method disclosed as one aspect of the present invention is a method in which a computer 1) if-else statements having a number of stages of an if-else statement equal to or greater than the number of stages indicated by a preset threshold from an RTL source describing a target circuit Else branches are extracted, and 2) a plurality of if-else branch correction methods are set in advance in association with the conditions of the if-else statement, and based on the conditions that constitute the extracted if-else branches. One of the plurality of correction methods is determined, and 3) a process of correcting the extracted if-else branch extracted from the RTL source based on the determined correction method is executed.
開示したRTL最適化方法によれば、ネストの段数が多いif−else分岐を最適な記述に自動変更することができ、論理回路設計においてRTL修正作業の負荷を軽減することができる。 According to the disclosed RTL optimization method, an if-else branch having a large number of nesting stages can be automatically changed to an optimal description, and the load of RTL correction work can be reduced in logic circuit design.
以下、本発明の一態様として開示するRTL最適化装置について説明する。 Hereinafter, an RTL optimization device disclosed as one aspect of the present invention will be described.
図1は、開示するRTL最適化装置の一実施例におけるブロック構成例を示す図である。 FIG. 1 is a diagram illustrating a block configuration example in an embodiment of the disclosed RTL optimization device.
RTL最適化装置1は、if−else抽出部11、閾値決定部12、データ生成部13、修正方法決定部14、修正部15、およびこれらの処理部が使用または生成する各種データを記憶する記憶部を備える。
The
if−else抽出部11は、対象回路をRTL(Register Transfer Level)で記述するRTLソース21から、if−else文による分岐(以下、「if−else分岐」または単に「if−else」という)を全て抽出し、抽出したif−else分岐に関する情報(ログ情報)をログ記憶部22に記憶する。if−else分岐の抽出は、既知のRTLスタイルチェッカーを用いた構文解析処理により実施する。if−elseに関するログ情報は、例えば、if−else文の位置(行)、段数、該if−else文が含まれるファイル名等である。
The if-
閾値決定部12は、if−elseを修正対象とするかを判定する閾値th(if−elseの段数)を決定し、閾値保持部24に記憶する。
The
修正対象とするif−elseの判定手段である閾値thとして、例えば、固定値、ユーザが与える任意の値、対象回路の情報に基づく値(例えば、動作周波数)等を用いることができる。閾値決定部12は、判定手段の指定23に基づいて閾値thを設定する。
For example, a fixed value, an arbitrary value given by the user, a value based on information on the target circuit (for example, operating frequency), or the like can be used as the threshold th that is a means for determining if-else to be corrected. The
判定手段の指定23は、判定手段とする閾値thを指定する情報であり、RTL最適化装置1が初期設定として保持し、または、データ生成部13の処理開始前に閾値決定部12に与えられる。
The determination means
データ生成部13は、ログ記憶部22に記憶されているif−else分岐が、閾値決定部12で決定された閾値thを超える段数を持つかを判定し、閾値thを超える段数を持つif−else分岐を修正対象とし、該当するif−elseに関する情報(修正対象情報)を修正対象記憶部25に記憶する。
The
修正方法決定部14は、予め複数の修正方法を保持し、修正対象記憶部25に記憶されたif−else分岐に対して実行する修正方法を決定し、決定した修正方法26を保持する。修正方法決定部14は、if−else分岐について、構成するif−else文の条件の内容(信号のビット数、各条件での同名信号の有無やAND構成の有無等)をもとに分類した修正方法を決定する。以下は、修正方法の分類の条件の例である。
(1)if−else文の条件が1ビット信号のみで構成されているか。
(2)全ての条件に同名信号が存在しないか。
(3)全条件がANDで構成されているか。
(4)条件に他の信号がないか。
The correction
(1) Whether the condition of the if-else statement is composed of only a 1-bit signal.
(2) Does the same name signal exist in all conditions?
(3) Are all conditions configured with AND?
(4) Is there any other signal in the condition?
修正方法として、例えば、以下のような方法が用意される。 As a correction method, for example, the following method is prepared.
[第1の修正方法]
第1の修正方法は、if−else文の条件に設定された信号が1ビット信号であり、各条件に同名の信号が存在しない場合に選択される。
[First correction method]
The first correction method is selected when the signal set in the condition of the if-else statement is a 1-bit signal and a signal with the same name does not exist in each condition.
第1の修正方法では、分岐の段数が所定数(閾値)以内になるようにif−else文をブロックに分割し、if−else文の構成内に分割した各ブロックのif−else分岐を構成し、各ブロックのif−else分岐が所定の段数以内となるように構成を修正する。 In the first correction method, the if-else statement is divided into blocks so that the number of branch stages is within a predetermined number (threshold value), and the if-else branch of each block is configured in the structure of the if-else statement. Then, the configuration is modified so that the if-else branch of each block is within a predetermined number of stages.
この修正により、元のRTLソース21のif−else分岐に対応する論理回路では、セレクタ回路が適正な段数を超えて直列に接続する構成となる場合に、セレクタ回路が直列に接続する段数が一定数以内に抑えられ、さらに、部分的に並列に接続する構成が実現できる。
With this modification, in the logic circuit corresponding to the if-else branch of the
[第2の修正方法]
第2の修正方法は、前記の第1の修正方法または後述する第3の修正方法に該当しない場合に選択される。例えば、if−else文の条件に設定された信号が複数ビットであり、各条件に同名信号が存在、かつ条件がANDで構成されている場合に、第2の修正方法が選択される。
[Second modification method]
The second correction method is selected when it does not correspond to the first correction method or the third correction method described later. For example, if the signal set in the condition of the if-else statement is a plurality of bits, a signal having the same name exists in each condition, and the condition is composed of AND, the second correction method is selected.
第2の修正方法では、条件に設定された信号名および信号値でif−else文を分類し、分類に用いた信号および信号値でまとめたif−else文のグループごとに第1の修正方法を実施してif−else分岐を修正する。 In the second correction method, the if-else sentence is classified by the signal name and signal value set in the condition, and the first correction method is performed for each group of if-else sentences grouped by the signal and signal value used for classification. To correct the if-else branch.
この修正により、信号名および信号値でまとめた入力信号に対応するセレクタ回路を、適正な段数以内で直列に接続し、部分的に並列に接続する構成が実現できる。 With this modification, it is possible to realize a configuration in which selector circuits corresponding to input signals summarized by signal names and signal values are connected in series within an appropriate number of stages and partially connected in parallel.
[第3の修正方法]
第3の修正方法は、if−else文の条件に設定される信号が複数ビット信号であり、各条件に他の信号が存在しない場合に、選択される。
[Third Modification Method]
The third correction method is selected when the signal set in the condition of the if-else statement is a multi-bit signal and there is no other signal in each condition.
第3の修正方法では、if−else分岐の各段の条件を要素とするcase分岐に変形する。 In the third correction method, the case is transformed into a case branch having the condition of each stage of the if-else branch as an element.
この修正により、元のRTLソース21のif−else分岐に基づく論理回路では、セレクタ回路が適正数を超えて直列に接続する構成を、代替の回路で実現することができる。
With this modification, in the logic circuit based on the if-else branch of the
修正部15は、RTLソース21に含まれる修正対象のif−else分岐を決定した修正方法26に従って修正し、修正済みRTLソース27を出力する。
The
図2は、ログ記憶部22のデータ構成例を示す図である。
FIG. 2 is a diagram illustrating a data configuration example of the
ログ記憶部22には、RTLソース21から抽出されたn個のif−else文各々について、識別番号(n)、段数(an−1)、ファイル名(Fn−1)、行番号(Ln−1)を含むデータが記憶される。「識別番号」はデータの識別番号、「段数」はif−else文のネストの段数、「ファイル名」はif−else文を含むファイルの名称、「行番号」はファイル(RTLソース)内でif−else文が記述されている行の番号である。
In the
図3は、修正対象記憶部25のデータ構成例を示す図である。
FIG. 3 is a diagram illustrating a data configuration example of the correction
修正対象記憶部25には、ログ記憶部22から、段数が閾値thを超えて修正対象として抽出されたm個(m≦n)のif−else文各々について、識別番号(m)、段数(am−1)、ファイル名(Fm−1)、行番号(Lm−1)を含むデータが記憶される。「識別番号」はデータの識別番号、「段数」はif−else文のネストの段数、「ファイル名」はif−else文を含むファイルの名称、「行番号」はファイル(RTLソース)内でif−else文が記述されている行の番号である。
The correction
図4は、閾値決定に用いる設定テーブルの例を示す図である。 FIG. 4 is a diagram illustrating an example of a setting table used for threshold value determination.
設定テーブルは、対象回路の動作周波数(MHz)と閾値との対応を示すデータテーブルである。 The setting table is a data table indicating the correspondence between the operating frequency (MHz) of the target circuit and the threshold value.
閾値決定部12は、判定手段の指定23が「対象回路の動作周波数に基づく設定」である場合に、対象回路の動作周波数(f)を示す情報を取得し、図4に示す設定テーブルから、取得した動作周波数に対応する閾値thを決定する。
When the determination means
上記の構成を有するRTL最適化装置1によって、適正な段数を超えるような直列の接続を解消して、先頭と最後のセレクタ回路で出力タイミング差にばらつきが生じうるという問題を解決し、段数の均等化により出力タイミング差のばらつきをなくすことが可能な回路構成を実現することができる。
The
図5は、RTL最適化装置1の概要処理フロー例を示す図である。
FIG. 5 is a diagram illustrating an example of an outline processing flow of the
RTL最適化装置1では、if−else抽出部11が、対象回路のRTLソース21を取得し(ステップS1)、RTLソース21からif−else文を全て抽出し、抽出したif−else文に関する情報(ログ情報)をログ記憶部22に格納する(ステップS2)。ステップS2の処理により,図2に示す情報がログ記憶部22に記憶される。
In the
データ生成部13は、閾値保持部24に記憶されている閾値thを用いて、ログ記憶部22に記憶されたログ情報から、段数が閾値thを超えるif−else文を処理対象として抽出し、処置対象としたif−else文に関する情報(修正対象情報)を修正対象記憶部25に記憶する(ステップS3)。ステップS3の処理により,図3に示す情報が修正対象記憶部25に記憶される。
The
なお、判定手段の指定23が外部から与えられる場合には、ステップS3の処理前に、閾値決定部12によって閾値thが決定され、閾値保持部24に記憶されているものとする。
If the determination means
修正方法決定部14は、修正対象記憶部25に記憶されたif−else文について修正方法を決定し、決定した修正方法26をif−else文に対応付けて記憶しておく(ステップS4)。修正部15は、RTLソース21の修正対象のif−else文を、決定した修正方法26に従って変形し、修正済みRTLソース27を出力する(ステップS5)。
The correction
図6は、ステップS3の処理のより詳細な処理フロー例を示す図である。 FIG. 6 is a diagram showing a more detailed processing flow example of the processing in step S3.
データ生成部13は、ログ記憶部22に記憶されたログ情報を取得し(ステップS21)、閾値保持部24に記録された閾値thを用いて閾値thを取得する(ステップS22)。データ生成部13は、カウンタiを0に設定して(ステップS23)、i番目(0≦i≦n−1)のif−elseの段数anについて、段数aiが閾値th以下であるかを判定する(ステップS24)。段数ai≦閾値thでなければ(ステップS24のN)、データ生成部13は、そのif−elseの情報を修正対象記憶部25に格納して(ステップS25)、ステップS26に進み、段数ai≦閾値thであれば(ステップS24のY)、そのままステップS26に進む。
The
ステップS26では、データ生成部13は、i=n−1であるかを判定し、i=n−1でなければ(ステップS26のN)、i=i+1として(ステップS27)、ステップS24に戻り、i=n−1であれば(ステップS26のY)、処理を終了する。
In step S26, the
図6に示す処理により、RTLソース21に含まれるm個のif−elseの要素が、閾値th以上と判断され、修正対象となる。
With the processing shown in FIG. 6, it is determined that the m number of if-else elements included in the
図7は、ステップS4の処理のより詳細な処理フロー例を示す図である。 FIG. 7 is a diagram showing a more detailed processing flow example of the processing in step S4.
修正方法決定部14は、修正対象記憶部25から修正対象情報を取得し(ステップS31)、カウンタiを0に設定して(ステップS32)、i番目(0≦i≦m−1)のif−elseの修正方法を選択する(ステップS33)。ステップS33の処理の詳細は、図8を用いて後述する。
The correction
その後、修正方法決定部14は、i=m−1であるかを判定し(ステップS34)、i=m−1でなければ(ステップS34のN)、修正方法決定部14は、i=i+1として(ステップS35)、ステップS33に戻り、i=m−1であれば(ステップS34のY)、処理を終了する。
Thereafter, the correction
図8は、ステップS33の処理のより詳細な処理フロー例を示す図である。 FIG. 8 is a diagram showing a more detailed processing flow example of the processing in step S33.
修正方法決定部14は、修正対象情報のi番目の(0≦i≦m−1)のif−else文を抽出し(ステップS341)、条件に設定された信号が1ビット(bit)信号であるかを判定する(ステップS342)。信号が1ビット信号であれば(ステップS342のY)、修正方法決定部14は、さらに、条件に同名の信号があるかを判定する(ステップS343)。条件に同名信号がなければ(ステップS343のN)、修正方法決定部14は、そのif−elseの修正方法を「第1の修正方法」に決定し(ステップS344)、処理を終了する(ステップS34の処理へ進む)。
The correction
ステップS343の判定で、条件に同名信号があれば(ステップS343のY)、修正方法決定部14は、さらに、条件がANDで構成されているかを判定する(ステップS345)。条件がANDで構成されていれば(ステップS345のY)、修正方法決定部14は、そのif−elseの修正方法を「第2の修正方法」に決定して(ステップS346)、処理を終了し、条件がANDで構成されていなければ(ステップS345のN)、ステップS344へ戻り、そのif−else文の修正方法を「第1の修正方法」に決定する。
If it is determined in step S343 that there is a signal with the same name in the condition (Y in step S343), the correction
ステップS342の判定で、条件に設定された信号が1ビット信号でなければ(ステップS342のN)、修正方法決定部14は、さらに、条件に他の信号があるかを判定する(ステップS347)。条件に他の信号があれば(ステップS347のY)、そのif−else文の修正方法を「第3の修正方法」に決定して(ステップS348)、処理を終了し、条件に他の信号がなければ(ステップS347のN)、ステップS343へ戻る。
If the signal set in the condition is not a 1-bit signal in the determination in step S342 (N in step S342), the correction
修正部15は、修正対象となったRTLソース21のif−elseについて、決定された修正方法に応じた修正を行う。以下に、各修正方法によるif−elseの修正処理を、より詳細に説明する。
The correcting
[第1の修正方法による修正]
(1)前処理(ブロック分割処理)
修正部15は、修正の前処理(ブロック分割処理)として、以下の処理S151〜S152を行う。
[Correction by the first correction method]
(1) Preprocessing (block division processing)
The
処理S151: if−else文の分割するブロック数Lを算出する。 Process S151: The number L of blocks to be divided by the if-else statement is calculated.
処理S152: 各ブロックに格納されるif−else文の段数PLを算出する。 Processing S152: calculating the number P L of if-else statements stored in each block.
ここで段数の分割として、修正部15は、以下の2つの処理のいずれかで行う。
Here, as the division of the number of stages, the
第1の分割方法: 段数aiを2で割る。このとき、段数ai−1を2で割ることになるため、L=2となる。さらに、P0は、(ai−1)/2の小数点以下を切り上げた値となり、P1=(ai−1)−P0となる。すなわち、(ai−1)が偶数のときにP0=(ai−1)/2となり、(ai−1)が奇数のときにP0=P1+1となる(P0=P1−1でもよい)。 First division method: Divide stage number a i by 2. At this time, since the number of stages a i −1 is divided by 2, L = 2. Further, P 0 is a value obtained by rounding up the decimal point of (a i −1) / 2, and P 1 = (a i −1) −P 0 . That, (a i -1) P 0 = (a i -1) when the even / 2, and the P 0 = P 1 +1 when is an odd number (a i -1) (P 0 = P It may be 1 -1).
第2の分割方法: (ai−1)を閾値th−1で割る。このとき、ブロック数Lは、(ai−1)/(th−1)の小数点以下を切り上げた値となる。 Second division method: (a i -1) is divided by a threshold th-1. At this time, the number of blocks L is a value obtained by rounding up the decimals of (a i −1) / (th−1).
図9に示すように、段数aiであるif−else文を閾値th未満になるようにAL−1という名前のL個のブロックに分解し、その中に含まれるif−else文の個数がPL−1(<th)であるとすると、分割した各ブロックにelse項を挿入するために、全てのif−else文の段数が増加する。そこで、段数を閾値thで割った場合には各ブロックのif−else文の段数が最終的に閾値thを超えてしまうことがあるため、段数(ai−1)を閾値th−1で割ることとする。各ブロックのif−else文の段数を閾値th−1に抑制することによって、閾値thを超えることを防止する。また、段数aiから引いている1は、else項を除外して計算することによる。 As shown in FIG. 9, the if-else statement with the number of stages a i is decomposed into L blocks named A L-1 so as to be less than the threshold th, and the number of if-else statements included therein Is P L-1 (<th), the number of stages in all if-else statements increases in order to insert an else term into each divided block. Therefore, when the number of stages is divided by the threshold th, the number of stages in the if-else statement of each block may eventually exceed the threshold th, and therefore the stage number (a i −1) is divided by the threshold th−1. I will do it. By suppressing the number of stages of the if-else statement of each block to the threshold value th-1, it is possible to prevent the threshold value th from being exceeded. Further, 1 subtracted from the stage number a i is obtained by excluding the else term.
以下に、前処理(各PLの算出)の具体例を説明する。第1の分割方法については、PL≦th−1であるときに、第2の分割方法の一例とみなすことができ、同様の手順で説明することができる。よって、第2の分割方法についての具体例を説明する。 Hereinafter, a specific example of the pretreatment (calculation of the P L). The first division method can be regarded as an example of the second division method when P L ≦ th−1, and can be described in the same procedure. Therefore, a specific example of the second division method will be described.
図10(A)は、ai=7のif−else文、th=4の場合の分割例を示す図である。この場合に、L=(ai−1)/(th−1)=(7−1)/(4−1)=6/3=2となり、さらに、P0=(ai−1)/L=(7−1)/2=6/2=3となる。したがって、P0=3、P1=3となる。 FIG. 10A is a diagram illustrating an example of division when an if-else statement with a i = 7 and th = 4. In this case, L = (a i −1) / (th−1) = (7-1) / (4-1) = 6/3 = 2, and P 0 = (a i −1) / L = (7-1) / 2 = 6/2 = 3. Therefore, P 0 = 3 and P 1 = 3.
図10(B)は、ai=6のif−else文、th=4の場合の分割例を示す図である。この場合に、L=(ai−1)/(th−1)=(6−1)/(4−1)=5/3<2となり、さらに、P0=(ai−1)/L=(6−1)/2=5/2<3となる。したがって、P0=2、P1=3となる。各ブロックのPiが異なるとき、最終ブロックから順に並べていき、先頭ブロックが最小の段数となるように割り当てるようにしてもよい。 FIG. 10B is a diagram illustrating an example of division when an if-else statement with a i = 6 and th = 4. In this case, L = (a i −1) / (th−1) = (6-1) / (4-1) = 5/3 <2, and P 0 = (a i −1) / L = (6-1) / 2 = 5/2 <3. Therefore, P 0 = 2 and P 1 = 3. When P i of each block is different, the blocks may be arranged in order from the last block and assigned so that the top block has the minimum number of stages.
図11(A)は、ai=13のif−else文、th=5の場合の分割例を示す図である。この場合に、L=(ai−1)/(th−1)=(13−1)/(5−1)=12/4=3となり、さらに、P0=(ai−1)/L=(13−1)/3=12/3=4となる。したがって、P0=4、P1=4、P2=4となる。 FIG. 11A is a diagram illustrating an example of division when an if-else statement with a i = 13 and th = 5. In this case, L = (a i −1) / (th−1) = (13-1) / (5-1) = 12/4 = 3, and P 0 = (a i −1) / L = (13-1) / 3 = 12/3 = 4. Therefore, P 0 = 4, P 1 = 4, and P 2 = 4.
図11(B)は、ai=12のif−else文、th=5の場合の分割例を示す図である。この場合に、L=(ai−1)/(th−1)=(12−1)/(5−1)=11/4<3となり、さらに、P0=(ai−1)/L=(12−1)/3=11/3<4となる。したがって、P0=3、P1=4、P2=4となる。 FIG. 11B is a diagram illustrating an example of division when an if-else statement with a i = 12 and th = 5. In this case, L = (a i -1) / (th-1) = (12-1) / (5-1) = 11/4 <3, and P 0 = (a i -1) / L = (12-1) / 3 = 11/3 <4. Therefore, P 0 = 3, P 1 = 4, and P 2 = 4.
(2)本処理(修正処理)
次に、本処理(修正処理)として、修正部15は、RTLの文法規約に従ってRTLソース21の修正対象の記述を変形する処理として、以下の処理S153〜S156を行う。
(2) This process (correction process)
Next, as this processing (correction processing), the
処理S153: 前処理で算出した分割したブロック数L、各ブロック内のif−else文の段数PL数に応じて複数ブロックを生成し、各ブロックの記述を行う。 Processing S153: the number of blocks obtained by dividing calculated in preprocessing L, to generate a plurality of blocks according to the number of stages P L number of if-else statements in each block, performing a description of each block.
RTLソース21の文法規約に従って、先頭ブロックでは“if ( ) begin 〜 end”の構造を、最終ブロックでは“else begin 〜 end”の構造をそれぞれ記述する。それ以外のブロックがある場合に各ブロックでは“else if ( ) begin 〜 end”の構造を記述する。なお、この時点で、各if()内の要素(条件式)は空とする。
In accordance with the grammatical rules of the
図12は、第1の修正方法による修正対象を含むRTLソース21の例を示す図である。
FIG. 12 is a diagram illustrating an example of the
図12に示すRTLソース21では、第7行〜27行のif−elseが修正対象となっている。そして、前処理により、if−else文の各段が、先頭ブロックに分類する要素(第7〜15行)と、最終ブロックに分類する要素(第16〜27行)とに分割されているとする。
In the
ここで、各ブロックへのif−else文の段数がわかっていることから、図13に示すように、先頭ブロックの先頭行(第7行)にif−elseの開始記述である“if ( ) begin”、最終行(第20行)に終了記述である“end”を記述する。同様に、最終ブロックの先頭行(第21行)に“else begin”、最終行(第34行)に“end”をそれぞれ記述する。 Here, since the number of stages of the if-else statement for each block is known, as shown in FIG. 13, “if (), which is the start description of if-else, is displayed in the first line (seventh line) of the first block. “begin” and “end” as the end description are described in the last line (line 20). Similarly, “else begin” is described in the first line (the 21st line) of the last block, and “end” is described in the last line (the 34th line).
処理S154: 各ブロックの先頭になるif()に挿入する条件式の論理を抽出する。より詳しくは、if−else文の各段の要素をもとに、j番目のブロックに対して、先頭からΣPi(i=0 〜 j−1)+1番目のif−else文からPj個のif−else文の条件式を抽出しOR結合した条件式を“if ( ) begin”の()内に挿入する。この処理を、全てのブロックについて実行する。 Process S154: The logic of the conditional expression to be inserted into if () at the head of each block is extracted. More specifically, on the j-th block, ΣP i (i = 0 to j−1) +1 P j from the first if-else statement based on the elements in each stage of the if-else statement. The conditional expression of the if-else statement is extracted and ORed and inserted into () of “if () begin”. This process is executed for all blocks.
図14に示すように、図12に示すRTLソース21の第7、第10、第13行のif−else文から抽出した各条件式(A_IN==1’b1)、(B_IN==1’b1)、(C_IN==1’b1)をOR結合した条件を、第7行の“if ( ) begin”の()内に記述する。
As shown in FIG. 14, the conditional expressions (A_IN == 1′b1) and (B_IN == 1 ′) extracted from the if-else statements in the seventh, tenth, and thirteenth lines of the
処理S155: 各ブロックに、if−else文を挿入する。より詳しくは、j番目のブロックに、S154の処理で条件を抽出したif−else文を全て挿入する。この処理を、全てのブロックについて実行する。 Process S155: An if-else statement is inserted into each block. More specifically, all if-else statements whose conditions are extracted in the process of S154 are inserted into the j-th block. This process is executed for all blocks.
図15に示すように、図12に示すRTLソース21の第7〜第15のif−else文を、先頭ブロックの第8〜16行に記述し、RTLソース21の第16〜27行のif−else文を、最終ブロックの第22〜30行に記述する。
As shown in FIG. 15, the 7th to 15th if-else statements of the
処理S156: 各ブロックに、RTLソース21から抽出したelse項の記述を挿入する。
Process S156: The description of the else term extracted from the
図16に示すように、図12に示すRTLソース21の第25〜26行のelse項を、先頭ブロックの第17〜19行、最終ブロックの第31〜33行にそれぞれ記述する。
As shown in FIG. 16, the else terms of the 25th to 26th lines of the
図17は、第1の修正方法による修正前のRTLソース21の回路構成を示す図であり、図18は、第1の修正方法による修正後の修正済みRTLソース27の回路構成を示す図である。図17および図18では、比較のため、回路の構成要素を簡略に表している。
FIG. 17 is a diagram showing a circuit configuration of the
修正前のRTLソース21によれば、図17に示すように、6つのセレクタ回路が直列に接続し、セレクタFに入力する信号3’b110は、出力信号Y_OUT[2:0]までに通過するセレクタ数が6段であり、一方、セレクタCに入力する信号3’b011は、出力信号Y_OUT[2:0]までに通過するセレクタ数が3段となっている。
According to the
これに対し、修正済みRTLソース27によれば、図18に示すように、セレクタ回路数が1つ増加するが、セレクタ回路を並列に接続し、セレクタFに入力する信号3’b110は、出力信号Y_OUT[2:0]までに通過するセレクタ数が4段となり、セレクタCに入力する信号3’b011も、出力信号Y_OUT[2:0]までに通過するセレクタ数が4段となる。
On the other hand, according to the modified
したがって、元のRTLソース21では、出力のタイミング差のバラツキが大きい構成であるが、RTL最適化装置1により出力される修正済みRTLソース27では、出力のタイミング差のバラツキが解消されていることがわかる。
Therefore, the
[第2の修正方法による修正]
(1)前処理(ブロック分割処理)
修正部15は、修正の前処理(ブロック分割処理)として、以下の処理S161〜S162を行う。第2の修正方法による修正の前処理は、第1の修正方法による修正の前処理とほぼ同様の処理である。対象のif−else文の段数をaiとする。
[Correction by the second correction method]
(1) Preprocessing (block division processing)
The
処理S161: if−else文の分割するブロック数Lを算出する。 Process S161: The number L of blocks to be divided by the if-else statement is calculated.
全ての条件文に表れる信号のビット(bit)数に基づいて、以下の規則によりブロック数Lを決定する。
「規則:ビット数をNとするとき、分割するブロック数L=2Nとする。」
処理S162: 各ブロックに格納されるif−else文の段数PLを算出する。
Based on the number of bits of the signal appearing in all conditional statements, the block number L is determined according to the following rules.
“Rule: When the number of bits is N, the number of blocks to be divided is L = 2N .”
Processing S162: calculating the number P L of if-else statements stored in each block.
段数P1は、ブロック数Lの算出で使用した各条件式の信号値をもとに場合分けを行い、該当するif−else文をカウントすることで算出する。 The stage number P 1 is calculated by performing case classification based on the signal value of each conditional expression used in the calculation of the block number L and counting the corresponding if-else statements.
例えば、if−else文の全条件文に現れる信号を抽出し、if−else文を格納するブロック数Lを、以下のように定めておく。
・ 条件文の信号が1ビットの場合は、ブロック数L=最大2とする。
・ 条件文の信号が2ビットの場合は、ブロック数L=最大4とする。
・ 条件文の信号が3ビットの場合は、ブロック数L=最大8とする。
・ 条件文の信号がNビットの場合は、ブロック数L=最大2Nとする。
For example, signals appearing in all conditional statements of an if-else statement are extracted, and the number of blocks L in which the if-else statement is stored is determined as follows.
• If the conditional statement signal is 1 bit, the number of blocks L = 2 at maximum.
• If the conditional statement signal is 2 bits, the number of blocks L = 4 at maximum.
-If the conditional statement signal is 3 bits, the number of blocks L = 8 at maximum.
• If the conditional statement signal is N bits, the number of blocks L = 2 N at maximum.
さらに、抽出した信号の値ごとに分割を行う。これにより、元のRTLソース21のif−else文がどのブロックに挿入されるかが決定する。
Further, division is performed for each value of the extracted signal. Thereby, it is determined in which block the if-else statement of the
図19は、第2の修正方法による修正の場合のブロック分割を説明するための図である。 FIG. 19 is a diagram for explaining block division in the case of correction by the second correction method.
図19(A)は、条件文の信号が1ビットである場合のブロック分割例を示す。この場合に、if−else文の格納ブロック数が最大=2となり、if−else文格納ブロックA0、A1は、それぞれ、段数がP0=2、P1=4となり、else項の段数=1となる。 FIG. 19A shows an example of block division when the conditional statement signal is 1 bit. In this case, the number of storage blocks of the if-else statement is maximum = 2, and the number of stages of the if-else statement storage blocks A 0 and A 1 are P 0 = 2 and P 1 = 4, respectively. = 1.
図19(B)は、条件文の信号が2ビットである場合のブロック分割例を示す。この場合に、if−else文の格納ブロック数が最大=4となり、if−else文格納ブロックA0、A1、A2、A3は、それぞれ、段数がP0=1、P1=2、P2=3、P3=4となり、else項の段数=1となる。 FIG. 19B shows an example of block division when the conditional statement signal is 2 bits. In this case, the maximum number of if-else statement storage blocks is 4, and the if-else statement storage blocks A 0 , A 1 , A 2 , and A 3 have the number of stages P 0 = 1 and P 1 = 2, respectively. , P 2 = 3, P 3 = 4, and the number of stages in the else term = 1.
(2)本処理(修正処理)
次に、修正部15は、本処理(修正処理)を行う。
(2) This process (correction process)
Next, the
図20は、第2の修正方法による修正対象を含むRTLソース21の例を示す図である。図20に示すRTLソース21で、第7〜24行のif−elseが修正対象となっている。前処理により、分割数L=2、段数P0=2、P1=3であるとする。
FIG. 20 is a diagram illustrating an example of the
処理S163: if−else文の全ての条件に現れる同名信号の信号値を探索し、if−else文の条件を同名信号かつ信号値と反転値とに分類する。図20のRTLソース21のif−else文を、条件の同名信号および信号値、ここでは(A_IN==1’b0)と(A_IN==1’b1)とをもとに、2つの要素(第7〜12行)と3つの要素(第13〜21行)とに分類する。
Process S163: The signal value of the signal with the same name that appears in all conditions of the if-else statement is searched, and the condition of the if-else statement is classified into a signal with the same name, a signal value, and an inverted value. The if-else statement of the
以降の処理として、RTLソース21の文法規約に従って、各ブロックで分類した条件式の要素を挿入してif−else文を修正する。この修正は、第1の修正方法による修正の処理S153〜S156とほぼ同様の処理である。
As the subsequent processing, in accordance with the grammatical rules of the
処理S164: 処理S153と同様に、先頭ブロックでは“if ( ) begin 〜 end”の構造を、最終ブロックでは“else begin 〜 end”の構造をそれぞれ記述する。 Process S164: Similar to process S153, the structure of “if () begin to end” is described in the first block, and the structure of “else begin to end” is described in the last block.
図21に示すように、先頭ブロックの先頭行(第7行)に“if ( ) begin”、最終行(第17行)に“end”を、最終ブロックの先頭行(第18行)に“else begin”、最終行(第31行)に“end”をそれぞれ記述する。 As shown in FIG. 21, “if () begin” in the first row (seventh row) of the first block, “end” in the last row (17th row), and “end” in the first row (18th row) of the last block. “else begin” and “end” in the last line (line 31), respectively.
処理S165: 処理S154と同様に、各ブロックの先頭になるif()に挿入する条件式の論理を抽出する。 Process S165: Similarly to process S154, the logic of the conditional expression to be inserted into if () at the head of each block is extracted.
図22に示すように、ブロック数Lの算出で用いた同名信号および信号値の組み合わせの1つとして図20に示すRTLソース21から抽出した条件式(A_IN==1’b0)を第7行の“if ( ) begin ”の()内に記述する。
As shown in FIG. 22, the conditional expression (A_IN == 1′b0) extracted from the
処理S166において、処理S155と同様に、記述した条件以外の条件について、if−else文の()内に記述する。 In process S166, as in process S155, conditions other than the described conditions are described in parentheses in the if-else statement.
図23に示すように、図20に示すRTLソース21の第7〜8行のif−else文の条件((A_IN==1’b0)&&(B_IN==1’b0)&&(C_IN==1’b1))から既に抽出した信号と信号値(A_IN==1’b0)以外の信号と信号値とをANDした条件((B_IN==1’b0)&&(C_IN==1’b1))を設定したif−else文を、先頭ブロックの第8〜13行に記述する。同様に、図20に示すRTLソース21の第10〜12行のif−else文の条件式をもとに、条件((B_IN==1’b1)&&(C_IN==1’b0))を設定したif−else文を、先頭ブロックの第11〜13行に記述する。さらに、同様に、図20のRTLソース21の第13〜15行、第16〜18行、第19〜21行の条件をもとにif−else文を最終ブロックの第19〜21行、第22〜24行、第25〜27行にそれぞれ記述する。
As shown in FIG. 23, the conditions of the if-else statement in the seventh to eighth lines of the
処理S167: 処理S156と同様に、図24に示すように、図20に示すRTLソース21の第22〜23行のelse項を、先頭ブロックの第14〜15行、最終ブロックの第28〜29行にそれぞれ記述する。
Process S167: As in process S156, as shown in FIG. 24, the else term in the 22nd to 23rd lines of the
図25は、第2の修正方法による修正前のRTLソース21の回路構成を示す図であり、図26は、第2の修正方法による修正済みRTLソース27の回路構成を示す図である。図25および図26では、比較のため、回路の構成要素を簡略に表している。
FIG. 25 is a diagram showing a circuit configuration of the
修正前のRTLソース21によれば、図25に示すように、3ビット信号の入力を持つセレクタが5つ直列に接続している。セレクタEに入力する信号3’b111は、出力信号Y_OUT[2:0]までに通過するセレクタ数が5段であり、一方、セレクタBに入力する信号3’b010は、出力信号Y_OUT[2:0]までに通過するセレクタ数が2段となっている。
According to the
これに対し、修正済みRTLソース27によれば、図26に示すように、2ビット信号の入力を持つ5段のセレクタと1ビット信号の入力を持つ1つのセレクタとに構成が変更されている。セレクタ数が1つ増加するが、セレクタが並列に接続される構成となり、セレクタEに入力する信号3’b111は、出力信号Y_OUT[2:0]までに通過するセレクタ数が4段となり、速度が改善されていることがわかる。
On the other hand, according to the corrected
[第3の修正方法による修正]
次に、本処理(修正処理)として、修正部15は、RTLの文法規約に従ってRTLソース21の修正対象のif−else分岐をcase分岐に変形する処理として、以下の処理S171〜S174を行う。
[Modification by the third modification method]
Next, as the main process (correction process), the
図27は、第3の修正方法による修正対象を含むRTLソース21の記述例を示す図である。図27に示すRTLソース21で、第7〜24行のif−elseが修正対象となっている。
FIG. 27 is a diagram illustrating a description example of the
処理S171: if−else文の条件から信号名“SEL_IN”を抽出する。 Process S171: The signal name “SEL_IN” is extracted from the condition of the if-else statement.
処理S172: 抽出した条件文の信号名から、対象のif−else文の段数aiを取得する。 Process S172: The number of stages a i of the target if-else statement is acquired from the signal name of the extracted conditional statement.
処理S173: RTLの文法規約に従って、if−elseの記述の代わりに、case()を構成する開始記述であるcase()文と終了記述であるendcaseとを記述する。 Process S173: In accordance with the RTL grammar rules, instead of describing if-else, a case () statement that is a start description constituting case () and an endcase that is an end description are described.
図28に示すように、先頭行(第7行)に“case ( )”を最終行(第14行)に“endcase”を記述し、“case ( )”の()内に抽出した信号名“SEL_IN”を記述する。 As shown in FIG. 28, “case ()” is described in the first line (seventh line), “endcase” is described in the last line (14th line), and the signal name extracted in () of “case ()”. “SEL_IN” is described.
処理S174: 元のRTLソース21の格段のif−else文の条件を、case文の条件である“条件式の信号値:動作処理”に書き換える。
Process S174: The condition of the exceptional if-else statement of the
図29に示すように、図27に示すRTLソース21の第7〜8行、第10〜11行、第13〜14行、第16〜17行、第19〜20行の条件を、第8〜12行にそれぞれ記述する。例えば、第7〜8行のif文の“SEL_IN == 4’b0000”と“Y_OUT = 3’b000”を取り出し、case文の対応する条件として“4’b0000:Y_OUT = 3’b000”を第8行に記述する。他のif文についても同様に記述する。
As shown in FIG. 29, the conditions of the 7th to 8th lines, the 10th to 11th lines, the 13th to 14th lines, the 16th to 17th lines, and the 19th to 20th lines of the
処理S175: if−else文のelse項を、case文のdefault項に書き換える。 Process S175: The else term of the if-else statement is rewritten to the default term of the case statement.
図30に示すように、図27に示すRTLソース21の第22〜23行のelse項の条件(Y_OUT = 3’b101)をもとに、default項の条件“default:Y_OUT = 3’b101”を第13行に記述する。
As shown in FIG. 30, based on the condition of the else term (Y_OUT = 3′b101) in the 22nd to 23rd lines of the
図31は、第3の修正方法による修正前のRTLソース21の回路構成を示す図であり、図32は、第3の修正方法による修正済みRTLソース27の回路構成を示す図である。図31および図32では、比較のため、回路の構成要素を簡略に表している。
FIG. 31 is a diagram showing a circuit configuration of the
修正前のRTLソース21によれば、図31に示すように、4ビット信号の入力を持つ3ビット出力セレクタが5つ直列に接続し、信号がセレクタを通過する時間が長くなるため、速度改善の余地がある。
According to the
これに対し、修正済みRTLソース27によれば、図32に示すように、4ビットセレクタ信号を、4ビット信号入力の一致比較回路と3ビットAND回路とに構成が変更されている。AND回路が6段となるが並列に接続しているため、出力信号Y_OUT[2:0]までの通過時間の速度が改善されていることがわかる。
On the other hand, according to the corrected
以上説明したRTL最適化装置1は、図1に示す処理部を備える専用ハードウェアとして実施することができる。
The
また、RTL最適化装置1を、図33に示すような、CPU101、メモリ102、記憶装置(ハードディスク)103、入力装置(キーボード、マウス等)104、出力装置(ディスプレイ、プリンタ等)105、通信制御部106等が内部のネットワーク等で接続されたコンピュータ100として実施することができる。
Also, the
さらに、RTL最適化装置1を、コンピュータ100で実行可能なプログラムとして実施することができる。この場合に、図1に示すRTL最適化装置1の処理部の機能を実現するプログラムを実装し、コンピュータ100上で実行することにより実施する。
Furthermore, the
すなわち、図1に示したif−else抽出部11、閾値決定部12、データ生成部13、修正方法決定部14、修正部15の各機能をコンピュータに実行させる実行プログラムをコンピュータ100に読み込ませ、実行させることによって,RTL最適化装置1を実現することができる。
That is, the
この場合に、コンピュータ100のCPU101が、例えば、
・ 上記の実行プログラムおよび入力となる情報(RTLソース21)をファイルとしてハードディスク103に格納する。
・ 入力装置104から実行プログラムを起動し、起動された実行プログラムが、メモリ102にロードされ、必要に応じてRTLソース21,判定手段の指定23をハードディスク103からメモリ102に読み出しながら処理を進め、処理中に、処理結果(ログ情報、修正対象情報、決定した修正方法等)をメモリ102、ハードディスク103に格納する。
・ 修正済みRTLソース27をディスプレイ105に表示し、ファイル形式で出力する、
といった手順で処理を実行する。
In this case, the
The above execution program and input information (RTL source 21) are stored in the
An execution program is activated from the
-Display the corrected
The process is executed according to the procedure.
なお、実行プログラムは、CD−ROM、CD−RW、DVD−R、DVD−RAM、DVD−RW等やフレキシブルディスク等の記録媒体だけでなく、通信回線の先に備えられた他の記憶装置やコンピュータのハードディスク等に記憶されるものであってもよい。 The execution program is not only a recording medium such as a CD-ROM, CD-RW, DVD-R, DVD-RAM, DVD-RW, or flexible disk, but also other storage devices provided at the end of the communication line. It may be stored in a computer hard disk or the like.
なお、RTL最適化装置1を構成する要素は、任意の組合せで実現されてもよい。複数の構成要素が1つの部材として実現されてもよく、1つの構成要素が複数の部材から構成されてもよい。また、RTL最適化装置1は、上述した実施形態に限定されず、本発明の要旨を逸脱しない範囲において各種の改良および変更を行ってもよいことは当然である。
Note that the elements constituting the
以上説明したように、開示したRTL最適化装置1によれば、RTLソース21のif−else文による分岐の記述を、論理回路構成上より最適となるように自動的に修正し、修正済みRTLソース27を出力することができる。よって、論理回路の分岐に関連する構成を改善するための作業工数を大幅に削減することができ、また、人手作業で生じる修正のばらつきをなくすことができる。よって、論理回路設計の効率化を実現することができる。
As described above, according to the disclosed
1 RTL最適化装置
11 if−else抽出部
12 閾値決定部
13 データ生成部
14 修正方法決定部
15 修正部
21 RTLソース
22 ログ記憶部
23 判定手段の指定
24 閾値保持部
25 修正対象記憶部
26 決定した修正方法
27 修正済みRTLソース
DESCRIPTION OF
Claims (8)
コンピュータが、
対象回路を記述するRTLソースから、予め設定された閾値が示す段数以上のif−else文の段数で構成されたif−else分岐を抽出し、
予め、if−else分岐の複数の修正方法をif−else文の条件に対応付けて設定しておき、抽出した前記if−else分岐を構成する条件をもとに、該複数の修正方法の1つを決定し、
前記RTLソースの抽出した前記if−else分岐を、決定した修正方法に基づいて修正する、処理を実行する
ことを特徴とするRTL最適化方法。 A method for optimizing a hardware description language RTL, comprising:
Computer
From the RTL source describing the target circuit, extract an if-else branch composed of the number of stages of an if-else statement equal to or greater than the number of stages indicated by a preset threshold value;
A plurality of correction methods for the if-else branch are set in advance in association with the conditions of the if-else statement, and one of the plurality of correction methods is determined based on the extracted conditions that constitute the if-else branch. Decide
An RTL optimization method comprising: executing a process of correcting the if-else branch extracted from the RTL source based on the determined correction method.
ことを特徴とする請求項1に記載のRTL最適化方法。 The correction method is set in association with the number of signal bits, presence / absence of a signal with the same name, and presence / absence of an AND condition, which are included in a condition of an if-else statement constituting the if-else branch. The RTL optimization method according to claim 1.
前記第1の修正方法は、抽出した前記if−else分岐を修正する際に、該if−else分岐を構成する各段のif−else文を予め設定された段数以内のブロックに分割し、
前記if−else分岐内に、前記ブロックごとに分割したif−else文で構成したif−else分岐を設定する
ことを特徴とする請求項2に記載のRTL最適化方法。 If the number of signal bits in the condition of the if-else statement constituting the if-else branch is 1 bit and there is no signal of the same name in each of the conditions, the first correction method is one of the correction methods. Is determined,
In the first modification method, when modifying the extracted if-else branch, the if-else statement of each stage constituting the if-else branch is divided into blocks within a preset number of stages,
The RTL optimization method according to claim 2, wherein an if-else branch configured by an if-else statement divided for each block is set in the if-else branch.
前記第2の修正方法では、抽出した前記if−else分岐を修正する際に、該if−else分岐を構成する各段のif−else文を、該if−else文の条件の同名信号および該同名信号の信号値をもとに分類し、前記分類した前記if−else文のグループごとに、前記第1の修正方法による修正を行う
ことを特徴とする請求項3に記載のRTL最適化方法。 The correction is made when the number of signal bits of the condition of the if-else statement constituting the if-else branch is 1 bit, a signal having the same name exists in each of the conditions, and all of the conditions are configured by AND conditions. A second correction method is determined as one of the methods,
In the second correction method, when the extracted if-else branch is corrected, the if-else statement of each stage constituting the if-else branch is changed to the same name signal of the condition of the if-else statement and the 4. The RTL optimization method according to claim 3, wherein classification is performed based on signal values of signals having the same name, and correction is performed by the first correction method for each group of the classified if-else statements. .
前記第3の修正方法では、抽出した前記if−else分岐を構成する各if−else文を条件の信号値および動作処理を示す要素とし、抽出した前記if−else分岐を構成するelse文を初期条件とするcase文による分岐に変更する
ことを特徴とする請求項2に記載のRTL最適化方法。 If the number of signal bits of the condition of the if-else statement constituting the if-else branch is a plurality of bits and no other signal exists in each of the conditions, a third correction method is one of the correction methods. Is determined,
In the third correction method, each if-else statement constituting the extracted if-else branch is used as an element indicating a signal value of a condition and an operation process, and the else statement constituting the extracted if-else branch is initialized. The RTL optimization method according to claim 2, wherein the branch is changed to a branch by a case statement as a condition.
ことを特徴とする請求項1ないし請求項5のいずれか一項に記載のRTL最適化方法。 The RTL according to any one of claims 1 to 5, wherein the threshold is at least an arbitrary fixed value or a value determined in advance based on an operating frequency of the target circuit. Optimization method.
対象回路を記述するRTLソースから、予め設定された閾値が示す段数以上のif−else文の段数で構成されたif−else分岐を抽出し、
予め、if−else分岐の複数の修正方法をif−else文の条件に対応付けて設定しておき、抽出した前記if−else分岐を構成する条件をもとに、該複数の修正方法の1つを決定し、
前記RTLソースの抽出した前記if−else分岐を、決定した修正方法に基づいて修正する、処理を実行させる
ことを特徴とするRTL最適化プログラム。 In order to optimize the hardware description language RTL,
From the RTL source describing the target circuit, extract an if-else branch composed of the number of stages of an if-else statement equal to or greater than the number of stages indicated by a preset threshold value;
A plurality of correction methods for the if-else branch are set in advance in association with the conditions of the if-else statement, and one of the plurality of correction methods is determined based on the extracted conditions that constitute the if-else branch. Decide
An RTL optimization program for executing a process of correcting the if-else branch extracted from the RTL source based on a determined correction method.
対象回路を記述するRTLソースから、予め設定された閾値が示す段数以上のif−else文の段数で構成されたif−else分岐を抽出する抽出部と、
予め、if−else分岐の複数の修正方法をif−else文の条件に対応付けて設定しておき、抽出した前記if−else分岐を構成する条件をもとに、該複数の修正方法の1つを決定する修正方法決定部と、
前記RTLソースの抽出した前記if−else分岐を、決定した修正方法に基づいて修正する修正部とを備える
ことを特徴とするRTL最適化装置。 To optimize the hardware description language RTL,
An extraction unit that extracts, from an RTL source describing the target circuit, an if-else branch composed of the number of stages of an if-else statement that is equal to or greater than the number of stages indicated by a preset threshold;
A plurality of correction methods for the if-else branch are set in advance in association with the conditions of the if-else statement, and one of the plurality of correction methods is determined based on the extracted conditions that constitute the if-else branch. A correction method determination unit for determining one;
An RTL optimizing apparatus comprising: a correcting unit that corrects the if-else branch extracted from the RTL source based on the determined correcting method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012213760A JP2014067353A (en) | 2012-09-27 | 2012-09-27 | Rtl optimization method, device and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012213760A JP2014067353A (en) | 2012-09-27 | 2012-09-27 | Rtl optimization method, device and program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2014067353A true JP2014067353A (en) | 2014-04-17 |
Family
ID=50743653
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2012213760A Pending JP2014067353A (en) | 2012-09-27 | 2012-09-27 | Rtl optimization method, device and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2014067353A (en) |
-
2012
- 2012-09-27 JP JP2012213760A patent/JP2014067353A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20100185836A1 (en) | Arithmetic program conversion apparatus, arithmetic program conversion method, and program | |
JP2017517082A (en) | Parallel decision tree processor architecture | |
JP6309795B2 (en) | Information processing apparatus, information processing method, and program | |
US8935512B2 (en) | Instruction operation code generation system | |
US10990073B2 (en) | Program editing device, program editing method, and computer readable medium | |
US8903699B2 (en) | Determining large-scale finite state machines using constraint relaxation | |
JP6925823B2 (en) | Equipment and methods for extracting data | |
JP2014067353A (en) | Rtl optimization method, device and program | |
JP5267243B2 (en) | Behavior description conversion apparatus, behavior description conversion method, and program | |
JP6173571B2 (en) | Circuit design apparatus and circuit design program | |
US8239717B2 (en) | Logic verification apparatus | |
US20190138495A1 (en) | Data processing apparatus, data processing method, and program recording medium | |
US20130254201A1 (en) | Data structure, data structure generation method, information processing apparatus, information processing system, and computer-readable storage medium having stored therein information processing program | |
JP2018124901A (en) | Program analyzing apparatus, program analyzing method, and program analyzing program | |
JP2022034897A (en) | Information processing device, machine learning method and machine learning program | |
JP2005208709A (en) | Data classification processing apparatus, data classification processing method and computer program | |
JP6547345B2 (en) | Test case generation program, test case generation method and test case generation apparatus | |
JP2019153047A (en) | Generation device, generation method, and program | |
JP5136257B2 (en) | Route management method | |
JP6398729B2 (en) | Design support apparatus and design support method | |
JP5417950B2 (en) | Genetic processing apparatus, genetic processing method and program | |
CN109740249B (en) | MUX tree logic structure optimization method, module and storage medium | |
JP2014120119A (en) | Device, method and program for design verification | |
JP6193674B2 (en) | CONVERSION CIRCUIT DESIGN DEVICE, CONVERSION CIRCUIT DESIGN PROGRAM, AND CONVERSION CIRCUIT DESIGN METHOD | |
JP6641749B2 (en) | Document generality estimating apparatus, document generality estimating method and program |