JP2004094951A - シミュレータをスピードアップするためのコンパイラ型コードの生成 - Google Patents

シミュレータをスピードアップするためのコンパイラ型コードの生成 Download PDF

Info

Publication number
JP2004094951A
JP2004094951A JP2003300902A JP2003300902A JP2004094951A JP 2004094951 A JP2004094951 A JP 2004094951A JP 2003300902 A JP2003300902 A JP 2003300902A JP 2003300902 A JP2003300902 A JP 2003300902A JP 2004094951 A JP2004094951 A JP 2004094951A
Authority
JP
Japan
Prior art keywords
coding algorithm
interpretable
executable
code
algorithm
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.)
Withdrawn
Application number
JP2003300902A
Other languages
English (en)
Inventor
Christopher Robin Schene
クリストファー・ロビン・スキーン
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.)
Anadigm Inc
Original Assignee
Anadigm Inc
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 Anadigm Inc filed Critical Anadigm Inc
Publication of JP2004094951A publication Critical patent/JP2004094951A/ja
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45516Runtime code conversion or optimisation
    • G06F9/45525Optimisation or modification within the same instruction set architecture, e.g. HP Dynamo
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45508Runtime interpretation or emulation, e g. emulator loops, bytecode interpretation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)
  • Accessory Devices And Overall Control Thereof (AREA)
  • Debugging And Monitoring (AREA)
  • Control Of Transmission Device (AREA)
  • Stored Programmes (AREA)

Abstract

 【課題】 インタープリット可能なコードに機能的に等価である時に、そしてこの場合にだけ、高速のコンパイラ型コードを選択する方法および装置を提供する。
 【解決手段】 インタープリット可能なコード化アルゴリズムを供給するステップと、実行可能なコード化アルゴリズムを供給するステップと、インタープリット可能なコード化アルゴリズムが、実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断するステップと、インタープリット可能なコード化アルゴリズムのインタープリットと実行可能なコード化アルゴリズムの実行のうちの一方を選択的に実行するステップとを含む方法。
【選択図】   図1

Description

 本発明は、インタープリット可能なコード化アルゴリズムを含むコンピュータ設計ソフトウェア・ツールに関する。本発明は、また、コンピュータ援用設計ソフトウェア・スイート内の、コード化アルゴリズムを含むソフトウェア・インタープリタ、コンパイラおよびモジュールに関する。
(関連出願への相互参照)
 本出願は、引用によって本明細書の記載に援用する、2002年8月29日出願の米国仮特許出願番号60/407,040の優先権を主張する。
 当業者にとって、ソフトウェア・インタープリタは周知のものである。解釈実行されたプログラムまたはスクリプトは、その命令が、論理的に順序付けされたオペレーティング・システム・コマンドのセットからなるプログラムである。コマンドは、コマンド・インタープリタにより、1回に1つずつ処理される。インタープリタは、オペレーティング・システムに要求を送る。このような動作は、遥かに効率的なコンパイル済みのプログラムとは対照的である。
 コンパイラは、プログラミング言語で書かれたソフトウェア・ステートメントを処理し、このステートメントをコンピュータのプロセッサが使用する機械語に変換する。人間のコンピュータ・プログラマは、エディタ・プログラムにより、C言語のようなコンピュータ言語でステートメントの複数のラインのファイルを生成する。このコードはソース・コードと呼ばれる。コンパイラは、ソース・コードを、マイクロプロセッサに送られる1と0のストリングに近いものに変換する。この変換は、出力コードを形成するために、1つまたはそれ以上の段階またはパス(pass)で、1つずつ構文法によりステートメントを分析(「パージング」)することにより行われる。コンパイラは、また、他のステートメントを参照するステートメントが、最終コードで正しく呼ばれていることを確認する。出力コードは、通常、オブジェクト・コードまたはオブジェクト・モジュールと呼ばれる。機械語に変換する作業は、コンパイル済みのプログラムを実行する前にすでに行われている。それ故、コンパイル済みのプログラムは、遥かに迅速に動作する。
 あるオペレーティング・システムの場合には、「ロード・モジュール」を生成する連係編集と呼ばれるコンパイル作業の後で、追加のステップが必要になる。連係編集により、2つ以上の目的モジュールが、同時に動作し、命令またはデータの相互参照が行われる場合の命令およびデータの相対的位置が解決される。
 Javaプログラミング言語は、オブジェクト指向言語である。Javaは、バイトコード・インタープリタが供給される任意のコンピュータ・システム上で実行することができるコンパイル出力(「バイトコード」)の可能性を導入した。バイトコード・インタープリタは、Java仮想機械と呼ばれる。それ故、バイトコードは、ハードウェア・プロセッサによってではなく、プログラムにより処理される。それ故、Javaバイトコードは、プラットフォームに依存しないコードである。仮想機械は、一般化した各機械命令を、プロセッサが使用するための特定の機械命令に変換する。過去においては、コンピュータ言語は、各コンピュータ・プラットフォーム(例えば、Intel(商標)、Apple(商標)等)に対して別々のコンパイラを必要とした。より詳細に説明すると、過去においては、任意の特定の言語で書かれたプログラムは、再度コンパイルし、場合によっては、異なるコンピュータ・プラットフォームに対して書き直さなければならなかった。各プラットフォームに対して、仮想機械と一緒に供給されるJavaのような言語の1つの利点は、ソース言語のステートメントを1回だけコンパイルしさえすれば、ほぼ任意のプラットフォーム上で実行することができることである。しかし、仮想機械は、1回に1つのバイトコード命令を処理する。1回に1つの命令をインタープリットするのではなく、Javaバイトコードは、そうしたい場合には、「ジャスト・イン・タイム・コンパイラ」により、特定の各システム・プラットフォームのところで再度コンパイルすることができる。Microsoft.Netもジャスト・イン・タイム・コンパイラを備える。
 ジャスト・イン・タイム・コンパイラは、本当は、第2のコンパイラである。ジャスト・イン・タイム・コンパイラは、Javaバイトコードを、プロセッサに直接送ることができる命令に変換する。Javaジャスト・イン・タイム・コンパイラは、プログラムが、最初にそのプラットフォームに対してコンパイルされたかのように、バイトコードをシステム特定コードにコンパイルする。ジャスト・イン・タイム・コンパイラによりコードが再度コンパイルされると、そのコードの動作は、通常、迅速になる。ジャスト・イン・タイム・コンパイラは、仮想機械と一緒に供給され、オプションとして使用される。ジャスト・イン・タイム・コンパイラは、バイトコードを、直ちに実行することができるプラットフォーム特定の実行可能なコードにコンパイルする。通常、ジャスト・イン・タイム・コンパイラを使用するためのオプションの選択はより迅速に行われ、特に、実行可能な方法が反復して再度使用される場合には、より迅速に行われる。ある市販のインタープリタは、IntelliSense(商標)インタープリタと呼ばれている。
米国特許出願番号10/171,334
 過去においては、設計者は、コンパイラ型コードか、インタープリタ型コードを選択してきた。この選択は、組み立てる時に行われ、構成する時(システム組立て時)にも行われる。Interpreted Basic、Microsoft(商標)net技術、Microsoft(商標)Visual Studio、p−code、Java、Labview、Simulink、およびMathcadが注目されている。
 ある態様によれば、本発明は、インタープリット可能なコードに機能的に等価である時に、そしてこの場合にだけ、高速のコンパイラ型コードを選択する方法および装置を提供する。機能的に等価でない場合には、低速のインタープリタ型コードが使用される。
 他の態様によれば、本発明は、複数のインタープリット可能なコード化アルゴリズムを含む少なくとも1つのモジュールを供給するステップと、インタープリット可能なコード化アルゴリズムからコンパイル可能なコード化アルゴリズムを生成するステップと、インタープリット可能なコード化アルゴリズムから、コンパイル可能なコード化アルゴリズムをインタープリット可能なコード化アルゴリズムと比較するための比較準備完了アルゴリズム・コードを生成するステップと、インタープリット可能なコード化アルゴリズムをコンパイル可能なコード化アルゴリズムと機能的に比較するように構成された選択装置エンジンを生成するステップと、機能的な比較の結果をコンパイラ型コード化アルゴリズムに関連付けるために、コンパイル可能なコード化アルゴリズムと比較準備完了アルゴリズム・コードとの間にリンケージを形成するステップと、コンパイル可能なコード化アルゴリズムからコンパイラ型コード化アルゴリズムを生成するステップとを含む方法を提供する。
 他の態様によれば、本発明は、インタープリット可能なコード化アルゴリズムを供給するステップと、実行可能なコード化アルゴリズムを供給するステップと、インタープリット可能なコード化アルゴリズムが、実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断するステップと、インタープリット可能なコード化アルゴリズムのインタープリットと、実行可能なコード化アルゴリズムの実行のうちの一方を選択的に実行するステップとを含む方法を提供する。
 他の態様によれば、本発明は、インタープリット可能なコード化アルゴリズムを供給するステップと、複数の実行可能なコード化アルゴリズムを供給するステップと、産業用制御プロセスを設計するためのコンピュータ援用設計ツールで、インタープリット可能なコード化アルゴリズムが、実行可能なコード化アルゴリズムと機能的に等価であるかどうかを判断するステップと、すべての状況下において、インタープリット可能なコード化アルゴリズムが、実行可能なコード化アルゴリズムと機能的に等価である場合、実行可能なコード化アルゴリズムを無条件で使用するステップと、インタープリット可能なコード化アルゴリズムが、どのような状況下でも、実行可能なコード化アルゴリズムに機能的に等価でない場合、インタープリット可能なコード化アルゴリズムを無条件でインタープリットするステップとを含む方法を提供する。
 さらに他の態様によれば、本発明は、インタープリット可能なコード化アルゴリズムを供給するステップと、複数の実行可能なコード化アルゴリズムを供給するステップと、電気回路を設計するためのコンピュータ援用設計ツールで、インタープリット可能なコード化アルゴリズムが、実行可能なコード化アルゴリズムと機能的に等価であるかどうかを判断するステップと、すべての状況下において、インタープリット可能なコード化アルゴリズムが、実行可能なコード化アルゴリズムと機能的に等価である場合には、実行可能なコード化アルゴリズムを無条件で使用するステップと、インタープリット可能なコード化アルゴリズムが、どのような状況下でも、実行可能なコード化アルゴリズムに機能的に等価でない場合、インタープリット可能なコード化アルゴリズムを無条件でインタープリットするステップとを含む方法を提供する。
 さらに他の態様によれば、本発明は、複数のインタープリット可能なコード化アルゴリズムを含む少なくとも1つのモジュールと、インタープリット可能なコード化アルゴリズムからコンパイル可能なコード化アルゴリズムを生成するための手段と、インタープリット可能なコード化アルゴリズムから、コンパイル可能なコード化アルゴリズムをインタープリット可能なコード化アルゴリズムと比較するための比較準備完了アルゴリズム・コードを生成するための手段と、インタープリット可能なコード化アルゴリズムをコンパイル可能なコード化アルゴリズムと機能的に比較するように構成された選択装置エンジンと、機能的な比較の結果をコンパイラ型コード化アルゴリズムに関連付けるために、コンパイル可能なコード化アルゴリズムと比較準備完了アルゴリズム・コードとの間にリンケージを生成するための手段と、コンパイル可能なコード化アルゴリズムから、コンパイラ型コード化アルゴリズムを生成するための手段とを備えるシステムを提供する。
 他の態様によれば、本発明は、インタープリット可能なコード化アルゴリズムを備え、実行可能なコード化アルゴリズムを供給し、インタープリット可能なコード化アルゴリズムが、実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、インタープリット可能なコード化アルゴリズムのインタープリットと実行可能なコード化アルゴリズムの実行のうちの一方を選択的に実行するシステムを提供する。
 他の態様によれば、本発明は、インタープリット可能なコード化アルゴリズムと、複数の実行可能なコード化アルゴリズムと、産業用制御プロセスを設計するためのコンピュータ援用設計ツールとを備え、インタープリット可能なコード化アルゴリズムが、実行可能なコード化アルゴリズムと機能的に等価であるかどうかを判断し、すべての状況下において、インタープリット可能なコード化アルゴリズムが、実行可能なコード化アルゴリズムと機能的に等価である場合には、実行可能なコード化アルゴリズムを無条件で使用し、インタープリット可能なコード化アルゴリズムが、どのような状況下でも、実行可能なコード化アルゴリズムに機能的に等価でない場合、インタープリット可能なコード化アルゴリズムを無条件でインタープリットするように構成されているシステムを提供する。
 他の態様によれば、本発明は、インタープリット可能なコード化アルゴリズムと、複数の実行可能なコード化アルゴリズムと、電気回路を設計するためのコンピュータ援用設計ツールとを備え、インタープリット可能なコード化アルゴリズムが、実行可能なコード化アルゴリズムと機能的に等価であるかどうかを判断し、すべての状況下において、インタープリット可能なコード化アルゴリズムが、実行可能なコード化アルゴリズムと機能的に等価である場合には、実行可能なコード化アルゴリズムを無条件で使用し、インタープリット可能なコード化アルゴリズムが、どのような状況下でも、実行可能なコード化アルゴリズムに機能的に等価でない場合、インタープリット可能なコード化アルゴリズムを無条件でインタープリットするように構成されているシステムを提供する。
 添付の図面を参照しながら、本発明の好ましい実施形態について以下に説明する。
 本特許明細書を、米国特許法の法律上の目的の推進、すなわち、「科学および有用な技術の進歩の促進」(第1条第8節)のために提出する。
 ある態様によれば、本発明は、インタープリット可能なコードに機能的に等価である場合、また等価である場合にだけ、実行時に、高速のコンパイラ型コードを選択する方法および装置を提供する。機能的に等価でない場合には、低速のインタープリタ型コードが使用される。本発明は、設計ツールを再度形成または再度構成しなければならない設計ツールのサプライヤがいなくても、コード化アルゴリズムを変更することができる柔軟性を持つ設計装置を提供する。設計装置は、現在のコンパイラ型コードに対して機能的に等価である場合には、高速のコンパイラ型コードの利点を持つ。機能的に等価であるコンパイラ型コードが存在しない場合でも、設計装置のコードを依然としてインタープリットすることができる。設計装置は、また、ソフトウェア開発環境の費用または諸経費を必要としないで、コード化アルゴリズムを変更することができる。
 引用によって本明細書の記載に援用する、Danny Austin Bersch,Ian Craig Macbeth,Howard C.Anderson,Brian Eugene Nottingham,Troy Franklin Giles,およびTimothy James Streitの、「構成可能なハードウェア・デバイスでアナログ素子を構成するためのシステムおよび方法」(System and Method for Configuring Analog Elements in a Configurable Hardware Device)という名称の、2002年6月11日付けの、共通に譲渡された米国特許出願番号10/171,334(弁理士整理番号AN21−001)に留意されたい。また、引用によって本明細書の記載に援用する付録AおよびBにも留意されたい。付録Aは、2002年6月11日付けの米国特許出願番号10/171,334のコピーと、本願と一緒に提出したソース・コードのコピーも含む。付録Bは、インタープリタ型コードから機能的に等価であるコードを生成する方法を示すスライドを印刷したものである。
 図1は、インタープリット可能なコード化アルゴリズムを含むモジュールからのコンパイル可能なコードの抽出および形成を示す機能ブロック図である。コード化アルゴリズムは、既知のまたは未知のあるコンピュータ言語で書かれたアルゴリズムである。コンピュータ言語としては、C言語、C++言語、ビジュアル・ベーシック、Java、Perl、Pascal、Simulink、Mathlab等がある。図1は、インタープリット可能なコードを含むモジュール10を示す。より詳細に説明すると、図の実施形態の場合には、モジュール10は、モジュール内の他の素子に対してインタフェースとして機能するか、相互に作用することができるか、またはできないインタープリット可能なコード化アルゴリズムを含む。インタープリット可能なコード化アルゴリズムは、インタープリタにより実行することができるように、インタフェース情報と結合している(例えば、モジュール10の)コード化アルゴリズムである。インタープリット可能なコード化アルゴリズムは、メモリまたは実行毎に保持した状態情報を持つこともあるし、持たない場合もある。ある実施形態の場合には、インタープリット可能なコード化アルゴリズムは、インタープリタによる実行のために必要な追加のフォーマット化情報およびインタフェース情報を含むモジュール・コード化アルゴリズムである。
 一実施形態の場合には、モジュール10は、インタープリット可能なコード化アルゴリズムを含む任意のタイプのコンピュータ設計ソフトウェアの交換可能な構成要素である。例えば、このようなソフトウェア・ツールとしては、01760 マサチューセッツ州ナティック、アップル・ヒル・ドライブ3所在のMathWorks,Inc.社が市販しているMatlab Simulink(商標)がある。他のこのようなツールとしては、CW1 6QZ 英国クルー、クルー・ビジネス・パーク、マラード・ウェイ、マラード・コート3−5所在のAnadigm,Ltd.社が市販しているAnadigmDesigner(およびそのバージョン)がある。
 モジュール10(または追加のモジュール10)からのコード化アルゴリズムは抽出エンジン12に送られる。コンピュータ・プログラミングの際には、他のプログラムに対してある機能を実行するあるプログラムにとって、エンジンという言葉は、ちんぷんかんぷんな言葉である。あるエンジンは、あるオペレーティング・システム、サブシステムまたは他のプログラムの全動作を調整するアプリケーション・プログラムで中心的または重要なプログラムになり得る。エンジンという言葉は、場合によっては変更することができる、あるアルゴリズムを含む特殊な目的のプログラムを記述するためにも使用される。もっともよく知られている用法は、探索引数が与えられた場合、トピックスの索引を探索するためにあるアルゴリズムを使用する用語探索エンジンである。
 コード化アルゴリズムは、ソフトウェア設計ツール(例えば、Simulink、AnadigmDesignerまたはその他)から、またはモジュールから入力を受信することもできるし、受信しないこともできる。抽出エンジン12は、関連コードを抽出し、コンパイル可能なコード化アルゴリズム、比較準備完了アルゴリズム・コード、コンパイル可能なコード化アルゴリズムと比較準備完了アルゴリズム・コードとの間のリンケージ、および選択装置エンジン(以下にさらに詳細に説明する)を生成する。
 コンパイル可能なコード化アルゴリズムは、(既知のまたは未知の)任意のタイプのコンパイラによりオブジェクト・コードに変換することができるインタープリット可能なコード化アルゴリズムである。これらのコンパイル可能なコード化アルゴリズムは、インタープリット可能なコード化アルゴリズムに「機能的に等価」である。コンパイル可能なコード化アルゴリズムは、インタープリット可能なコード化アルゴリズムの形からコンパイル可能なコード化アルゴリズムの形への変換を必要とする場合もあるし、必要としない場合もある。コンパイル可能なコード化アルゴリズムは、「メモリ」または実行毎の保持状態情報を持つ場合もあるし、持たない場合もある。コンパイル可能なコード化アルゴリズムは、コンパイラによりすでにオブジェクト・コードに変換済みのコンパイル可能なコード化アルゴリズムであるコンパイラ型コード化アルゴリズムに匹敵する。
 抽出エンジン12によるコンパイル可能なコード化アルゴリズムの生成は、コードの変換、コンパイル可能なコード化アルゴリズムへのインタフェースに対するインタフェース情報の追加を含む場合がある。
 比較準備完了アルゴリズム・コードは、コンパイル可能なコード化アルゴリズムとインタープリット可能なコード化アルゴリズムの高速比較を行うことができるデータ・フォームへのインタープリット可能なコード化アルゴリズムの変換である。この比較は、下記のもの、すなわち、チェックサム、決定ツリー、ソートしたリスト、ハッシュ・テーブル(参照テーブル)、2進ツリー等の中の任意のものを含むことができるが、これらに限定されない。
 コンパイル可能なコード化アルゴリズム、比較準備完了アルゴリズム・コード、コンパイル可能なコード化アルゴリズムと比較準備完了アルゴリズム・コードとの間のリンケージ、選択装置エンジンは、ソフトウェア開発プラットフォーム14により使用される。ソフトウェア開発プラットフォーム14は、コンパイラ型コードを生成することができる任意のタイプのものである。ソフトウェア開発プラットフォーム14は、実行可能なコード16を生成する。抽出プロセスからのすべての素子は、実行可能な形で利用できるようになる。実行可能なコード16は、1つまたはそれ以上の別々の独立の実行可能なファイルを含むことができる。実行可能なコードの例としては、例えば、.com、.exe、.dll、.ldおよび.ocxタイプのファイル等がある。抽出プロセスは、一般的なプロセスで、任意の特定の目的コンピュータ言語に限定されない。
 コンパイル可能なコード化アルゴリズムと比較準備完了アルゴリズム・コードとの間のリンケージは、選択装置(以下に説明する)の結果を、コンパイラ型コード化アルゴリズムの正しいセットに関連づける機能を供給する。
 図2は、図1の機能を実行した後で行う、実行時の比較/選択装置の機能を示す機能ブロック図である。図2は、1つまたはそれ以上のモジュール18を示す。各モジュール18は、インタープリット可能なコード化アルゴリズムを含む、任意の既知のまたは未知のモジュールである。コード化アルゴリズムは、モジュールの他の素子に対してインタフェースとして機能したり、または相互に作用する場合もあるし、そのような機能および作用を行わない場合もある。モジュール集合体20は、各モジュール18から選択される。モジュール集合体20は、モジュール10とは異なるものである。何故なら、実行中のモジュールは、コンパイル可能なコード化アルゴリズムが生成された時点で、既知のモジュールの場合もあるし、そうでない場合もあるからである。依然として、実行時に、コンパイル可能なコード化アルゴリズムを形成した時点で既知の、所与のモジュール・コード化アルゴリズムと機能的に等価である1つまたはそれ以上のコンパイル可能なコード化アルゴリズムを発見することができる。「機能的に等価である」という用語については、以下にさらに詳細に説明する。
 ブロック22において、インタープリット可能なコード化アルゴリズムが、モジュール20および/または18から抽出される。抽出されたインタープリット可能なコード化アルゴリズムは、合成選択装置エンジンまたは選択装置26が利用できるようになる。その結果、合成選択装置エンジン26は、1つまたはそれ以上のモジュール・コード化アルゴリズムとマッチする、「機能的に等価である」コンパイル可能なコード化アルゴリズムが存在するかどうかを判断するために、抽出プロセスからのすべての素子16と一緒に、インタープリット可能なコード化アルゴリズムを使用することができる。
 ブロック26において、合成選択装置エンジンは、図3のところで以下にさらに詳細に説明するロジックにより、ブロック28、30および32と接続している経路1、2および3の中の1つを選択する。合成選択装置エンジン26は、抽出したコード化アルゴリズム22、実行可能な素子16、およびアプリケーション環境変数およびパラメータ24に基づいてその選択を行う。アプリケーション環境変数およびパラメータは、モジュール・コード化アルゴリズムまたはコンパイル可能なコード化アルゴリズムに送られる種々の変数およびパラメータの現在の動的内容である。これらのアプリケーション環境変数およびパラメータは、時間、利得または数学的情報を含むが、これらに限定されない。
 選択装置エンジン26が経路1を選択した場合には、相対的に高速のコンパイラ型コード化アルゴリズムが無条件で使用される。すべての状況下で、所与のモジュール・コード化アルゴリズムに「機能的に等価である」、コンパイル可能なコード化アルゴリズムが発見された場合に、この経路が使用される。機能的に等価であるコンパイル可能なコード化アルゴリズムの識別子は、実行エンジン38に送られる。機能的に等価である場合には無条件なので、このモジュール・コード化アルゴリズムに対して、選択装置エンジン26を一度だけ呼び出すだけでよい。
 経路2が選択された場合には、(一般的に)相対的に低速のインタープリタ型コード化アルゴリズムが、ブロック30において無条件で使用される。すべての状況下で、所与のモジュール・コード化アルゴリズムに「機能的に等価」である、コンパイル可能なコード化アルゴリズムを識別できない場合には、経路2が使用される。インタープリット可能なコード化アルゴリズムを実行すべきであるという内容の識別子は、実行エンジン38に送られる。「機能的に等価である」ことは決して真でないので、このモジュール・コード化アルゴリズムに対して、選択装置エンジン26を1回呼び出すだけでよい。
 経路3が選択された場合には、コンパイラ型コード化アルゴリズム、インタープリタ型コード化アルゴリズムおよびアプリケーション環境変数およびパラメータは、条件付き選択装置エンジン34により処理される。所与のモジュール・コード化アルゴリズムに機能的に等価である少なくとも1つのコンパイル可能なコード化アルゴリズムが識別された場合には、経路3が使用されるが、その機能的に等価であるということは、どのコード経路および変数がアクセスされるかにより異なる。アクセスされたコード経路および変数は、コンパイル可能なコード化アルゴリズムおよびインタープリット可能なコード化アルゴリズムに送られる場合もあるし、送られない場合もある、アプリケーション環境変数およびパラメータの値により異なる。これは条件付きなので、経路3の場合には、モジュール・コード化アルゴリズムの必要な各実行に対して選択装置エンジン26を呼び出さなければならないが、選択装置エンジン26は、各反復に対して、ブロック36において、(一般的に)高速のコンパイラ型コード化アルゴリズム、または低速のインタープリタ型コード化アルゴリズム・コードを使用するかどうかを示す。ある実施形態の場合には、条件付き選択装置エンジン34は、合成選択装置エンジン26の一部である。
 経路1、2および3は、実行エンジン38に接続している。コンパイル可能なコード化アルゴリズムに対する識別子(例えば、整数またはASCII文字列)は、経路1、2または3を通して選択装置エンジン26から返送される。機能的に等価であるコンパイル可能なコード化アルゴリズムが発見されなかった場合には、返送されたコンパイル可能なコード化アルゴリズム識別子は、「NULL」であり、このことは、インタープリタ型コード化アルゴリズムを、このモジュール・コード化アルゴリズムに対して実行すべきことを示している。
 図3は、ある特定の実施形態で、図2の合成選択装置エンジンが使用するロジックの流れを示すフローチャートである。他の実施形態も可能である。アプリケーション環境変数およびパラメータ24、インタープリタ型コード化アルゴリズムと呼ばれる、モジュールから抽出したコード化アルゴリズム42、および抽出プロセスからのすべての素子16は、決定ブロック44で使用される。
 決定ブロック44においては、コード化アルゴリズムが、前に使用できる条件付きの機能的に等価なものを持っていると判断されたかどうかについての判断が行われる。そのような判断がすでに行われていた場合には、ブロック46において経路3が選択され(図2)、すべての入力データがブロック46で条件付きの選択装置エンジンに送られる。そのような判断が行われていなかった場合には、プロセスは、ブロック48に進む。
 ブロック48においては、インタープリット可能なコード化アルゴリズムが、広いスペースおよびコメントを除いて、1つまたはそれ以上のコンパイル可能なコード化アルゴリズムと構文的に同じであるかどうかについての判断が行われる。同じである場合には、ブロック50において、経路1が選択され、識別子が、コンパイル可能なコード化アルゴリズムに返送され、実行される。選択装置エンジンを再度呼び出す必要はない。何故なら、コンパイル可能なコード化アルゴリズムは何時でも等価であるからである。構文的に同じでない場合には、プロセスはブロック52に進む。
 ブロック52においては、このインタープリット可能なコード化アルゴリズムが、1)決してアクセスされないまたは読み出されない変数が追加されている点、または2)現在の1つまたはそれ以上の変数および各変数がアクセスされる、各位置に対する名称だけが変化している点、または1)および2)の両方の点だけで、少なくとも1つのコンパイル可能なコード化アルゴリズムとは異なっているかどうかについての判断が行われる。異なっている場合には、プロセスは、上記ブロック50に戻り、異なっていない場合には、プロセスは、ブロック54に進む。
 ブロック54においては、インタープリット可能なコード化アルゴリズムが、例えば、モジュール・コード化アルゴリズムに追加されている条件付きのコードのような経路決定コードだけが、1つまたはそれ以上のコンパイル可能なコード化アルゴリズムと異なっているかどうかについての判断が行われる。異なっている場合には、プロセスはブロック56に進み、そこで経路3が選択され(図2参照)、すべての入力データが、条件付きの選択装置エンジンに送られる。異なっていない場合には、プロセスは、ブロック58に進む。ブロック58においては、経路2が選択される(図2参照)。何故なら、モジュール・コード化アルゴリズムにマッチするコンパイル可能なコード化アルゴリズムを発見することができないからである。選択装置エンジンを再度読み出す必要はない。何故なら、マッチするコンパイル可能なコード化アルゴリズムを使用することができないからである。インタープリット可能なコード化アルゴリズムは、このモジュール・コード化アルゴリズムに対して何時でも実行される。
 図4は、ある特定の実施形態において、図2の条件付きの選択装置エンジンが使用するロジックの流れを示すフローチャートである。
 アプリケーション環境変数およびパラメータ24、インタープリタ型コード化アルゴリズムと呼ばれる、モジュールから抽出したコード化アルゴリズム42、および抽出プロセスからのすべての素子16は、決定ブロック60により使用される。ブロック60においては、条件決定データ構造(例えば、ハッシュ・テーブル、参照テーブル、または他の決定データ構造)が、このインタープリット可能なコード化アルゴリズムに対してすでに形成済みかどうかについての判断が行われる。形成済みである場合には、プロセスはブロック62に進み、形成済みでない場合には、プロセスはブロック64に進む。
 ブロック62においては、アプリケーション環境変数およびパラメータおよび条件付きの決定データ構造情報(ハッシュ・テーブル、参照テーブルまたはその他)が、変数のこの組合わせに対して一致するコンパイル可能なコード化アルゴリズムが存在するかどうかを判断するために使用される。存在する場合には、ブロック70において、一致するコンパイル可能なコード化アルゴリズムの識別子が、そのコンパイル可能なコード化アルゴリズムを実行するために返送される。存在していない場合には、ブロック68において、このパスに対してインタープリット可能なコード化アルゴリズムが実行される。
 ブロック64においては、条件付き決定データ構造(ハッシュ・テーブルまたは参照テーブル)が、このインタープリット可能なコード化アルゴリズムに対して形成される(ハッシュ・テーブルまたは参照テーブルの形成方法の一例については、図6参照)。ブロック64の後で、プロセスは、ブロック66に進む。
 ブロック66においては、このインタープリット可能なコード化アルゴリズムに対して何らかの一致するコンパイル可能なコード化アルゴリズムが形成済みであるかどうかについての判断が行われる。形成済みでない場合には、ブロック72において、類似のインタープリタ型コード化アルゴリズムが無条件で使用される。このインタープリット可能なコード化アルゴリズムに対して一致するコンパイル可能なコード化アルゴリズムが発見された場合には、プロセスは(上記の)ブロック70に進む。
 図5は、事前コンパイル型コードをインタープリタ型コードと比較し、「機能的に等価」かどうかを判断するために、ある実施形態で実行されるステップのフローチャートである。
 ブロック74においては、モジュール・コードおよびコンパイラ型コードが構文的に同じであるかどうかについての判断が行われる。同じである場合には、プロセスは、ブロック76に進み、同じでない場合には、プロセスはブロック78に進む。
 ブロック76においては、インタープリタ型コードではなく、事前コンパイル型コードが使用される。何故なら、コンパイラ型コードは機能的に等価であるからである。
 ブロック78においては、違いがコメントの変更または白いスペースの変更だけであるかどうかについての判断が行われる。そうであり、上記のものだけが違いである場合には、プロセスはブロック76に進む。そうでない場合には、プロセスはブロック80に進む。
 ブロック80においては、新しいコードが、「デッド」コード、すなわち、決して実行されないコードであるかどうかについての判断が行われる。異なる(例えば、新しいまたは追加の)コードが「デッド」コードである場合には、プロセスはブロック76に進む。「デッド」コードでない場合には、プロセスはブロック82に進む。
 ブロック82においては、変数定義だけが追加されていた場合には、これらの変数が、読み出しアクセスのために前に参照されたかどうかについての判断が行われる。参照されていなかった場合には(新しい変数のどれもが読み出しのためにアクセスされていない場合には)、プロセスはブロック76に進み、参照されていた場合には、新しい変数が読み出しのためにアクセスされ、プロセスはブロック84に進む。
 ブロック84においては、現在の入力パラメータ・セットが、新しいコードを実行させることができるかどうかについての判断が行われる(「新しい_コード」は、インタープリット可能なモジュール・コード内には含まれているが、コンパイル可能なコード内には含まれていないコードである)。実行させることができる場合には、プロセスはブロック86に進み、そうでない場合には、コードは、指定されたパラメータ・セットに対して「デッド」コードであり、プロセスはブロック76に進む。
 ブロック86においては、必要に応じて、他のチェックを行うことができる。ブロック86を実行した後で、コードが機能的に等価でない場合には、プロセスはブロック88に進む。
 ブロック88に進んだ場合には、事前コンパイル型コードは、モジュール18および20内のインタープリット可能なコード化アルゴリズムと機能的に等価でない。低速のインタープリットされたバージョンが実行される。
 それ故、ある実施形態の場合には、1つまたはそれ以上のインタープリットされたかまたはコンパイラ型コード化アルゴリズムは、入力変数の所与のセットに対する所与の計算環境および所与の動作コンテキストおよび動作環境に対して、コード化アルゴリズムが、コンピュータ・プログラム、スイートまたは問題の動作環境の特定の動作要件により定義されたものと等価である結果を生成する場合には、機能的に等価であるといわれる。以下にいくつかの例について説明する。
 例1:simulink内のコード化アルゴリズムは、ある式に対して数学的な結果を生成し、インタープリタ型コード(A+B)を実行し、8を超えるすべての有効数字を無視する。コンパイラ型コード化アルゴリズムは、同じ式に対して有効数字18桁までの数学的結果を生成するが、いつでも第1の8桁と一致する。このアルゴリズムは、問題の環境に対して「機能的に等価」である。この特殊な例の場合には、コンパイル可能なコード化アルゴリズムは、無条件で機能的に等価である。何故なら、最初の有効数字8桁が、両方のアルゴリズムに対して同じであるからである。
 例2:Simulink内の同じコード化アルゴリズムを、AまたはBが5より大きい場合に、下記のように、結果に2を掛ける条件付きのステートメントを追加することにより変更する。
 Result=A+B;
    if((A>5)|(B>5))
       result=result2;
    end
記述するために使用した前のコンパイル可能なコード化アルゴリズムは下記の通りである。
    Result=A+B
コンパイル可能なコード化アルゴリズムは、AおよびBの両方が5より小さいすべての場合、インタープリタ型コードに条件付きで機能的に等価である。
 例3:あるエンジニアがコードのシミュレートしたバージョンを加工し、システムに新しい変数を追加する。しかし、この変数は、決してアクセスされない。現在の高速のコンパイラ型コードは、依然として、機能的に等価である。何故なら、新しいインタープリットされた変数は、決して使用されないために何の効果もないからである。
 例4:あるエンジニアが、シミュレートした「C」コードを加工し、10〜100のエントリから、シミュレートしたコードで参照テーブルの大きさを2倍にし、一方、高速のコンパイル済みバージョンは、10の参照テーブル・エントリを持つ。値、実行経路および状態の組合わせが、実際には、アクセスされる参照テーブルの新しい上部90のエントリにアクセスすることができないと判断した場合には、コンパイラ型コードおよびシミュレートされたコードは、依然として、「機能的に」等価で、そのため、高速のコンパイル済みバージョンが依然として実行される。
 例5:あるエンジニアが、コードを読む人に対して変数名をもっと意味あるものにするために、シミュレートした「C」コードの整数変数の名前を、「k」から「参照テーブル_索引」に変更する。このコードは分析され、変数「参照テーブル_索引」は、変数「k」の単なる置換であり、コードの動作をぜんぜん変更しないと判断される。このコードは、コンパイル済み「C」と「機能的に」等価であると判断されたので、高速のコンパイル済みバージョンが実行され、性能が改善される。
 また、下記の例、「C」コードについて考えてみよう。
int example_subroutine(int a){
     int k=1;
     if(a>10){
        //DPathA
        k=11;
     }
     if(a>50){
        //DPathB
        k=50;
     }
     if(a≦50)
     {
        //DPathC
        k=30;
     }
     return k;

 このコードの場合、下記の可能な組合わせが存在し、
a>50に対して、DPathAおよびDPathBが実行され、
a>10およびa≦50に対して、DPathAおよびDPathCが実行され、
a≦10に対して、DPathCが実行される。
 選択装置エンジンが遵守しなければならない規則の中の1つは、コードにおいて入力変数を変更することはできないという規則である。何故なら、入力変数は、機能的に等価であるかどうかを判断するために使用されるからである。コード内で入力変数に対する変更が検出された場合には、条件付きの機能的な等価は評価されない。
 それ故、これら3つの各経路の場合、評価はコードの別々のものに対して行われる。すなわち、インタープリット可能なコード化アルゴリズムは、下記の3つのアルゴリズムまたはコード・スニピト(code snippit)になるように、実際には、ある実施形態で3回変更される。
 a>50に対して、DPathAおよびDPathBが実行される。
     int k=1;
     if(a>10){
        //DPathA
        k=11;
     }
     if(a>50){
        //DPathB
        k=50;
     }
     return k;

 a>10およびa≦50に対して、DPathAおよびDPathCが実行される。
int example_subroutine(int a){
     int k=1;
     if(a>10){
        //DPathA
        k=11;
     }
     if(a≦50)
     {
        //DPathC
        k=30;
     }
     return k;

または、これは、下記のようにすることができる。
int example_subroutine(int a){
     int k=1;
     k=11;
     k=30;
     return k;

および、同じ「機能的に等価である」結果となる。
 a≦10に対して、DPathCが実行される。
     int example_subroutine(int a){
     int k=1;
     if(a≦50)
     {
        //DPathC
        k=30;
     }
     return k;

他の実施形態の場合には、コードをさらに簡単にすることができる。
 図6は、参照テーブル(LUT)を形成するために実行するステップのフローチャートである。ブロック90においては、インタープリット可能なコード化アルゴリズムの第1のレベルの決定経路に対してループがスタートする。
 ブロック92においては、この決定経路の実行が、入力変数により制御されるかどうか、また、その関係を識別することができるかどうかについての判断が行われる。ブロック90は、すべての第1のレベルの決定経路に対して反復して行われる。
 ブロック94においては、決定経路のすべての可能な組合わせが決定される。各組合わせに対して、実際に実行するインタープリット可能なコード化アルゴリズム・コードの変更したものが形成される。
 ブロック96においては、ブロック94において決定した各コードの組合わせに対して、各コンパイルされ、コード化アルゴリズムに対して比較が行われる。コンパイル可能なコード化アルゴリズムが、入力および指定された変数の組合わせに対して評価される。
 ブロック98においては、ブロック96において入手した各一致に対して、所与の入力変数の組合わせに対する、適当なコンパイルされ、コード化アルゴリズムをポイントする参照テーブル・エントリが追加される。
 上記方法および装置は、インタープリタ型コードが使用されるほとんどすべてのアプリケーションで使用することができる。例えば、図7は、プロセス制御コンピュータ援用設計ツールの一例を示す。プロセス制御コンピュータ援用設計(CAD)ツールを使用する産業用コントローラの設計の場合には、「ポイント定義モジュール」100は、シミュレーションおよびシステム構成のためのコード化アルゴリズムを含む。ポイント定義モジュールは、プロセス制御システムのハードウェア素子間の接続を記述している物理的相互接続情報のような制御システム情報を含むモジュールである。コード化アルゴリズムは、インタープリット可能なコード化アルゴリズムとしてインタープリットすることができる。図2〜図6のところで説明したロジックは、所与のインタープリット可能なコード化アルゴリズムに機能的に等価である場合には、実行することができる高速のコンパイラ型コード化アルゴリズムを生成するために使用することができる。そうである場合には、高速のシミュレーションおよび構成を行うことができる。
 1つまたはそれ以上のモジュール100からのポイント情報は、プロセス制御CADツール110で使用される。プロセス制御CADツールは、制御システムを設計するために、制御エンジニアが使用するコンピュータ援用設計ツールである。他の実施形態の場合には、任意の他のタイプの制御システムを設計するために使用されるツール110を使用することができる。
 図7のCADツール110は、プロセス制御システム内で制御システムを形成するために使用される。CADツールは、視覚的表示、シミュレーション、ハードウェアへの回路のダウンロード、構成のセーブ、および構成の復元のような機能を行う。
 設計は、制御システム構成112としてセーブされる。セーブされた制御システム構成112は、コンピュータ・ディスク上にファイルの形でセーブされた制御システム構成である。CADツール110は、セーブされた構成(例えば、1つのファイルまたは複数のファイル)112から構成を読み出したり、ロードすることができる。
 ある実施形態の場合には、ブロック100、110および112はパーソナル・コンピュータのような普通のコンピュータで実行される。
 プロセス制御CADツール110からのポイント情報は、産業用プロセス制御コンピュータ114にダウンロードされる。産業用プロセス制御コンピュータは、産業用プロセス制御のために特に設計されたものである。産業用プロセス制御コンピュータは、工業プロセスが、指定のパラメータ内から決して逸脱しないようにするのを助ける。産業用プロセス制御コンピュータ114は、ヒータを制御し、タンクを制御し、または任意の他の産業用制御のような1つまたは複数の物理的プロセス116を制御する。
 産業用プロセス制御コンピュータ114は、産業用プロセス制御用途用に特に設計されたコンピュータ・システムである。このコンピュータ114は、工業プロセスを必ず指定のパラメータ内に納めるために使用される。
 図8は、CW1 6QZ 英国クルー、クルー・ビジネス・パーク、マラード・ウェイ、マラード・コート3−5所在のAnadigm,Ltd.社(www.adadigm.com)が市販しているAnadigmDesigner、または、Danny Austin Bersch、Ian Craig Macbeth、Howard C.Anderson、Brian Eugene Nottingham、Troy Franklin Giles、およびTimothy James Streitの、「構成可能なハードウェア・デバイス内で、アナログ素子を構成するためのシステムおよび方法」という名称の、2002年6月11日付けの、上記米国特許出願番号10/171,334(弁理士整理番号AN21−001)に詳細に記載されているツールのようなフィールド・プログラマブル・アナログ・アレイ内で実行される回路を設計するための、設計およびシミュレーション・ツールと一緒に使用される構成可能なアナログ・モジュールの機能ブロック図である。
 1つまたはそれ以上の構成可能なアナログ・モジュール118からの情報は、回路設計およびシミュレーション・ツール120で使用される。より詳細に説明すると、図の実施形態においては、ツール120は、フィールド・プログラマブル・アナログ・アレイ124内にアップロードされる回路を設計し、形成するために特に設計される。しかし、他の実施形態の場合には、ツール120は、任意の用途に対する任意の回路を設計し、形成するために使用される。図の実施形態のツール120は、下記の機能、すなわち、回路の視覚的表現の供給、回路シミュレーションの実行(およびオシロスコープの機能を有する)、チップ124(例えば、フィールド・プログラマブル・アナログ・アレイまたは他のプログラム可能なロジック・デバイス)への回路のダウンロード、ファイル122内への回路のセーブ、およびファイル122からの回路の復元または検索を実行する。構成可能なアナログ・モジュール118は、設計およびシミュレーション・ツール120で操作することができる、機能的レベルで抽出された回路形成ブロック(例えば、フィルタ、増幅器、コンパレータ等)である。例えば、回路素子間の接続は、回路レイアウトまたは略図242で変更することができ、回路素子(例えば、フィルタまたは増幅器)のパラメータは、ダイアログ・ボックスまたは他の入力方法により変更することができる(例えば、利得の調整、フィルタ特性の設定等を行うことができる)。モジュールおよび設計ツールの詳細については、www.anadigm.comおよび上記米国特許出願を参照されたい。
 ある実施形態の場合には、ブロック118、120および122は、パーソナル・コンピュータのような普通のコンピュータで実行される。
 図1および図2のところで説明した方法と類似の方法で、図9は、システム形成段階中のプロセスを示し、図10は、実行時のプロセスを示す。より詳細に説明すると、図9は、図8のタイプの構成可能なアナログ・モジュールからのコンパイル可能なコードの抽出および形成を示す機能ブロック図である。
 図9は、インタープリット可能なコードを含む、1つまたはそれ以上の構成可能なアナログ・モジュール210を示す。より詳細に説明すると、図の実施形態においては、モジュール210は、モジュール内の他の素子に対してインタフェースとして機能したり相互に作用する場合もあるし、そうしない場合もあるインタープリット可能なコード化アルゴリズムを含む。構成可能なアナログ・モジュールは、回路記号、ユーザ・インタフェース(例えば、利得のような回路素子に対するパラメータを設定するためのダイアログ・ボックス)、回路トポロジー、およびCADツール219内で実行されるコード化アルゴリズム(例えば、擬似コード、Cコードの簡略化したバージョン類似のコード、または周知のコンピュータ言語のコード)を含む。ある実施形態の場合には、追加のフォーマット化およびインタフェース情報が、インタープリタが使用するCAMの擬似コードに追加される。
 一実施形態の場合には、モジュール210は、CW1 6QZ 英国クルー、クルー・ビジネス・パーク、マラード・ウェイ、マラード・コート3−5所在のAnadigm,Ltd.社が市販している設計ツールの交換可能な構成要素である。
 モジュール210(または、追加のモジュール210)からのコード化アルゴリズムは、抽出エンジン212に送られる。抽出エンジン212は、関連するコードを抽出し、コンパイル可能なコード化アルゴリズム、比較準備完了構成可能なアナログ・モジュール・アルゴリズム・コード、コンパイル可能なコード化アルゴリズムと比較準備完了構成可能なアナログ・モジュール・アルゴリズム・コードとの間のリンケージ、(以下にさらに詳細に説明する)選択装置エンジンを形成する。
 コンパイル可能なコード化アルゴリズムは、(既知のまたは未知の)任意のタイプのコンパイラによりオブジェクト・コードに変換することができる、インタープリット可能なコード化アルゴリズムである。これらのコンパイル可能なコード化アルゴリズムは、インタープリット可能なコード化アルゴリズムに「機能的に等価」である。コンパイル可能なコード化アルゴリズムは、インタープリット可能なコード化アルゴリズムの形からコンパイル可能なコード化アルゴリズムの形への変換を必要とする場合もあるし、必要としない場合もある。コンパイル可能なコード化アルゴリズムは、「メモリ」または実行毎の保持状態情報を持つ場合もあるし、持たない場合もある。コンパイル可能なコード化アルゴリズムは、コンパイラにより、すでにオブジェクト・コードに変換済みのコンパイル可能なコード化アルゴリズムであるコンパイラ型コード化アルゴリズムに匹敵する。
 抽出エンジン212によるコンパイル可能なコード化アルゴリズムの生成は、コードの変換、コンパイル可能なコード化アルゴリズムへのインタフェースに対するインタフェース情報の追加を含む場合がある。
 比較準備完了構成可能なアナログ・モジュール・アルゴリズム・コードは、インタープリット可能なコード化アルゴリズムを、コンパイル可能なコード化アルゴリズムとインタープリット可能なコード化アルゴリズムの高速比較を行うことができるデータ・フォームへ変換することである。比較準備完了構成可能なアナログ・モジュール・アルゴリズム・コードは、モジュール・コード化アルゴリズムを、実行時に、モジュール・コード化アルゴリズムを効率よくまたうまく、機能的に同一かどうかの比較を行うことができる形に変換することにより定義される。
 実行する比較のタイプとしては、下記のもの、すなわち、チェックサム、決定ツリー、ソートしたリスト、ハッシュ・テーブル(参照テーブル)2進ツリー等があるが、これらに限定されない。
 コンパイル可能なコード化アルゴリズム、比較準備完了アルゴリズム・コード、コンパイル可能なコード化アルゴリズムと比較準備完了アルゴリズム・コードとの間のリンケージ、選択装置エンジンは、ソフトウェア開発プラットフォーム214により使用される。ソフトウェア開発プラットフォーム214は、コンパイラ型コードを生成することができる任意のタイプのものである。ソフトウェア開発プラットフォーム214は、実行可能なコード216を生成する。ある実施形態の場合には、抽出プロセスからのすべての素子は、実行可能な形で入手することができる。
 コンパイル可能なコード化アルゴリズムと比較準備完了アルゴリズム・コードとの間のリンケージは、選択装置エンジンからの結果を、コンパイラ型コード化アルゴリズムの正しいセットに関連づける機能を供給する。
 図10は、図9の機能を実行した後で行われる、実行時の比較および選択装置の機能を示す機能ブロック図である。図10は、1つまたはそれ以上のモジュール218を示す。各構成可能なアナログ・モジュール218は、インタープリットすることができるコード化アルゴリズムを含む。コード化アルゴリズムは、モジュールの他の素子に対してインタフェースとして機能したり、または相互に作用する場合もあるし、そのような機能および作用を行わない場合もある。モジュール集合体220は、各モジュール218から選択される。モジュール集合体220は、モジュール210(図9)とは異なるものである。何故なら、実行中のモジュールは、コンパイル可能なコード化アルゴリズムが生成された時点で、既知のモジュールであってもよいし、そうでなくてもよいからである。依然として、実行時に、コンパイル可能なコード化アルゴリズムを形成した時点で既知の所与のモジュール・コード化アルゴリズムと機能的に等価である、1つまたはそれ以上のコンパイル可能なコード化アルゴリズムを発見することができる。
 ブロック222においては、インタープリット可能なコード化アルゴリズムが、モジュール220および/または218から抽出される。これらのアルゴリズムは、構成可能なアナログ・モジュール内に含まれる、任意のプログラミング言語で書くことができるアルゴリズムである。ある実施形態の場合には、これらのアルゴリズムは、「C」プログラミング言語またはそのサブセットで書かれるが、任意のプログラミング言語で書くこともできる。
 抽出したインタープリット可能なコード化アルゴリズムは、合成選択装置エンジンまたは選択装置226が利用できる。その結果、合成選択装置エンジン226は、1つまたはそれ以上のモジュール・コード化アルゴリズムとマッチする、「機能的に等価」であるコンパイル可能なコード化アルゴリズムが存在するかどうかを判断するために、抽出プロセスからのすべての素子216と一緒に、インタープリット可能なコード化アルゴリズムを使用することができる。合成選択装置エンジン226は、機能的比較プロセスを管理し、設計時モジュール・コード化アルゴリズムへの機能的等価が、品目216のコンパイラ型コード化アルゴリズム内に存在するかどうかを判断する。比較は、所与のコンパイル可能なコード化アルゴリズムおよび設計構成可能なアナログ・モジュール・セットに対して、何時でも真または偽である。
 ブロック226において、合成選択装置エンジンは、図3のところですでに説明したロジックとほぼ同じロジックにより、(それぞれ、ブロック228,230および232と接続している)経路301,302および303の中の1つを選択する。合成選択装置エンジン226は、抽出したコード化アルゴリズム222、実行可能な素子216、および設計ツール・アプリケーション環境変数およびパラメータ224に基づいてその選択を行う。アプリケーション環境変数およびパラメータは、モジュール・コード化アルゴリズムまたはコンパイル可能なコード化アルゴリズムに送られる種々の変数およびパラメータの現在の動的内容である。これらは、構成可能なアナログ・モジュールに関連する内部パラメータである。これらは、例えば、時間、利得、数学的情報、クロック位相、クロック周波数、回路の消費電力、コーナ周波数、ヒステリシス、利得帯域幅、モジュール入力値等を含むことができる。
 合成選択装置エンジン226が経路301を選択した場合には、相対的にもっと高速のコンパイラ型コード化アルゴリズムが無条件で使用される。すべての状況下で、所与のモジュール・コード化アルゴリズムに「機能的に等価である」コンパイル可能なコード化アルゴリズムが発見された場合にこの経路が使用される。機能的に等価であるコンパイル可能なコード化アルゴリズムの識別子は、実行エンジン238に送られる。機能的に等価である場合は無条件なので、このモジュール・コード化アルゴリズムに対して、選択装置エンジン226を一度だけ呼び出すだけでよい。
 経路302が選択された場合には、相対的にもっと低速のインタープリットされ、コード化アルゴリズムが、ブロック230において無条件で使用される。すべての状況下で、所与のモジュール・コード化アルゴリズムに「機能的に等価である」コンパイル可能なコード化アルゴリズムを識別できない場合には、経路302が使用される。インタープリット可能なコード化アルゴリズムを実行すべきであるという内容の識別子は、実行エンジン238に送られる。「機能的に等価である」は決して真でないので、このモジュール・コード化アルゴリズムに対して、選択装置エンジン226を1回呼び出すだけでよい。
 経路303が選択された場合には、コンパイルされ、インタープリットされた、コード化アルゴリズムおよびアプリケーション環境変数およびパラメータは、条件付き選択装置エンジン334により処理される。条件付き選択装置エンジン334は、機能比較プロセスを管理し、コンパイル可能なコード化アルゴリズム、設計時モジュール・コード化アルゴリズム、および設計者環境変数およびパラメータに基づいて、機能的に等価であるコンパイル済みコンパイル可能なコード化アルゴリズムが存在するかどうかを判断する。それ故、所与のコンパイル可能なコード化アルゴリズム・セットおよび設計CAMセットに対して、比較は、変数値およびコードにより真または偽である。
 所与のモジュール・コード化アルゴリズムに機能的に等価である少なくとも1つのコンパイル可能なコード化アルゴリズムが識別された場合には、経路303が使用されるが、その機能的な等価は、どのコード経路および変数がアクセスされるかにより異なる。アクセスされたコード経路および変数は、コンパイル可能なコード化アルゴリズムおよびインタープリット可能なコード化アルゴリズムに送られる場合もあるし、送られない場合もあるアプリケーション環境変数およびパラメータの値により異なる。これは条件付きなので、経路303の場合には、モジュール・コード化アルゴリズムの必要な各実行に対して選択装置エンジン226を呼び出さなければならないが、選択装置エンジン226は、各反復に対して、ブロック236において、高速のコンパイラ型コード化アルゴリズム、または低速のインタープリタ型コード化アルゴリズム・コードを使用するかどうかを示す。ある実施形態の場合には、条件付き選択装置エンジン234は、合成選択装置エンジン226の一部である。
 経路301、302および303は、すべて実行エンジン238に接続している。コンパイル可能なコード化アルゴリズムに対する識別子は、経路301、302または303を通して選択装置エンジン226から返送される。コンパイル可能なコード化アルゴリズムが機能的に等しくなかった場合には、返送されたコンパイル可能なコード化アルゴリズム識別子は、「NULL」であり、このことは、インタープリタ型コード化アルゴリズムを、このモジュール・コード化アルゴリズムに対して実行すべきことを示している。
 参照番号219は、設計およびシミュレーション・ツールを示す。このツールは、構成可能な各アナログ・モジュールからアルゴリズム・コードを抽出し、(経路301、302および303に関連する)3つの別々の可能性に対する構成可能なアナログ・モジュール・コードの状態を判断するために、抽出プロセスからの素子216を使用する。
 図11は、どのコードがインタープリットされたか、どのコードがコンパイル済みかを示すダイアログ・ボックス240を示す回路設計ツール・スクリーン242の一例である。ある実施形態の場合には、設計ツールは、どのコードがインタープリットされたか、どのコードがコンパイル済みかを示すために、図に示すようなダイアログ・ボックスの生成を含む。
 さらに、ある場合には、機能的に等価でないためにコンパイラ型コードを使用できないことがある。このような場合には、(図に示すダイアログ・ボックス以外の)もう1つのダイアログ・ボックスは、コンパイラ型コードが使用できないことを示し、ある実施形態の場合には、何故コンパイラ型コードを使用することができないのかを示す。別の方法としては、このデータをダイアログ・ボックス240内に表示することもできる。
 本発明の方法および装置は、また、それに対して、最初の開発をより速くより安いコストで容易に行うために、シミュレートしたバージョンを使用することができる任意のコンピュータ言語に拡張することができるが、その場合には、改善された性能を供給するために、機能的に等価である(この場合、機能的に等価であることは実行時に判断される)コンパイル済みバージョンが、シミュレートしたバージョンの代わりに実行される。これらのコンピュータ言語としては、「C++」「Pascal」、「Fortran」、「Visual Basic」等があるが、これらに限定されない。
 それ故、上記システムおよび方法は、設計ツールのメーカーが設計ツールを再形成または再構成しなくても、設計者にコード化アルゴリズム(例えば、設計ツール内のコード化アルゴリズムの変更)の変更ができるという柔軟性を供給する。設計者は、高速のコンパイラ型コードの利点を持つ。この場合、現在のコンパイラ型コードに関して機能的等価が存在する。機能的に等価であるコンパイラ型コードが存在しない場合でも、設計者のコードをインタープリットすることができる。設計者は、また、ソフトウェア開発環境の費用または諸経費を使用しないで、コード化アルゴリズムを変更することができる(すなわち、設計者は、コンパイラを購入する必要はない)。
 状況に従って、本発明を、構造的および方法的特徴を、多かれ少なかれ特有の言語で説明してきたが、本発明は、図に示し説明してきた特定の機能に制限されないことを理解されたい。何故なら、本発明の手段は、本発明を実行するのに好適な形を含んでいるからである。それ故、本発明は、等価物の原則に従って正しき解釈した添付の特許請求の範囲の正しい範囲内で種々の形に変更または修正することができる。
 本発明で使用するコンピュータープログラムリスト(付録A)は下記のとおりである。
#include "gentypes.h"
 
#ifdef _PAGE0
#define _FAR @indir
#else
#ifdef _PAGEF
#define _FAR
#else
#define _FAR @far
#endif
#endif
 
#ifndef hc916y3_h
#define hc916y3_h
 
#define BAUD_57600 (9)
#define BAUD_38400 (14)
#define BAUD_19200 (28)
#define BAUD_9600 (55)
 
/**********************************************************************
*
* Register : MMCR - MCCI Module Configuration Register
*
* Address : 0xFFC00
*
* Mapping : 1
* 5xxxxxxx7xxx3210
* | | ||||_ IARB : Interrupt Arbitration Number
* | |________ SUPV : Supervisor/Unrestricted
* |________________ STOP : 0 = Normal, 1 = Low Power
*
**********************************************************************/
 
typedef struct
{
ubin16 IARB : 4;
ubin16 usused_2 : 3;
ubin16 SUPV : 1;
ubin16 unused_1 : 7;
ubin16 STOP : 1;
} sMMCR;
 
typedef union
{
ubin16 w;
sMMCR b;
} uMMCR;
 
_FAR uMMCR MMCR @0xFFC00; /* Module Configuration Register */
 
/**********************************************************************
*
* Register : ILSCI - SCI Interrupt Level Register
*
* Address : 0xFFC04
*
* Mapping :
* xx543210
* ||||||_ ILSCIA : Interrupt Level for SCIA
* |||____ ILSCIB : Interrupt Level for SCIB
*
**********************************************************************/
 
typedef struct
{
ubin8 ILSCIA : 3;
ubin8 ILSCIB : 3;
ubin8 unused_1 : 2;
} sILSCI;
 
typedef union
{
ubin8 w;
sILSCI b;
} uILSCI;
 
_FAR uILSCI ILSCI @0xFFC04;
 
/**********************************************************************
*
* Register : MIVR - MCCI Interrupt Vector Register
*
* Address : 0xFFC05
*
* Mapping :
* 76543210
* ||||||||_ INTV : Interrupt Vector
*
**********************************************************************/
 
_FAR ubin8 MIVR @0xFFC05;
 
/**********************************************************************
*
* Register : ILSPI - SPI Interrupt Level Register
*
* Address : 0xFFC06
*
* Mapping :
* xx543xxx
* |||____ ILSPI : Interrupt Level for SPI
*
**********************************************************************/
 
typedef struct
{
ubin8 usused_2 : 3;
ubin8 ILSPI : 3;
ubin8 unused_1 : 2;
} sILSPI;
 
typedef union
{
ubin8 w;
sILSPI b;
} uILSPI;
 
_FAR uILSPI ILSPI @0xFFC06;
 
/**********************************************************************
*
* Register : PORTMC - MCCI Port Data Register
*
* Address : 0xFFC0D
*
* Mapping :
* 76543210
* ||||||||_ PMC0 : MCCI Port Data Register
* |||||||__ PMC1
* ||||||___ PMC2
* |||||____ PMC3
* ||||_____ PMC4
* |||______ PMC5
* ||_______ PMC6
* |________ PMC7
*
**********************************************************************/
 
typedef struct
{
ubin8 PMC0 : 1;
ubin8 PMC1 : 1;
ubin8 PMC2 : 1;
ubin8 PMC3 : 1;
ubin8 PMC4 : 1;
ubin8 PMC5 : 1;
ubin8 PMC6 : 1;
ubin8 PMC7 : 1;
} sPORTMC;
 
typedef union
{
ubin8 w;
sPORTMC b;
} uPORTMC;
 
_FAR uPORTMC PORTMC @0xFFC0D;
 
/**********************************************************************
*
* Register : PORTMCP - MCCI Port Pin State Register
*
* Address : 0xFFC0F
*
* Mapping :
* 76543210
* ||||||||_ PMC0 : MCCI Port Pin State Register
* |||||||__ PMC1
* ||||||___ PMC2
* |||||____ PMC3
* ||||_____ PMC4
* |||______ PMC5
* ||_______ PMC6
* |________ PMC7
*
**********************************************************************/
 
typedef struct
{
ubin8 PMC0 : 1;
ubin8 PMC1 : 1;
ubin8 PMC2 : 1;
ubin8 PMC3 : 1;
ubin8 PMC4 : 1;
ubin8 PMC5 : 1;
ubin8 PMC6 : 1;
ubin8 PMC7 : 1;
} sPORTMCP;
 
typedef union
{
ubin8 w;
sPORTMC b;
} uPORTMCP;
 
_FAR uPORTMCP PORTMCP @0xFFC0F;
 
/**********************************************************************
*
* Register : MPAR - MCCI Pin Assignment Register
*
* Address : 0xFFC09
*
* Mapping :
* xxxx3x10
* | ||_ MISO : Pin Assignment Register
* | |__ MOSI
* |____ SS
*
**********************************************************************/
 
typedef struct
{
ubin8 MISO : 1;
ubin8 MOSI : 1;
ubin8 unused_2 : 1;
ubin8 SS : 1;
ubin8 unused_1 : 4;
} sMPAR;
 
typedef union
{
ubin8 w;
sMPAR b;
} uMPAR;
 
_FAR uMPAR MPAR @0xFFC09;
 
/**********************************************************************
*
* Register : MDDR - MCCI Data Direction Register
*
* Address : 0xFFC0B
*
* Mapping :
* 76543210
* ||||||||_ MISO : Data Direction Register
* |||||||__ MOSI
* ||||||___ SCK
* |||||____ SS
* ||||_____ RXDB
* |||______ TXDB
* ||_______ RXDA
* |________ TXDA
*
**********************************************************************/
 
typedef struct
{
ubin8 MISO : 1;
ubin8 MOSI : 1;
ubin8 SCK : 1;
ubin8 SS : 1;
ubin8 RXDB : 1;
ubin8 TXDB : 1;
ubin8 RXDA : 1;
ubin8 TXDA : 1;
} sMDDR;
 
typedef union
{
ubin8 w;
sMDDR b;
} uMDDR;
 
_FAR uMDDR MDDR @0xFFC0B;
 
/**********************************************************************
*
* Register : SCCR0A - SCI Control Register 0
*
* Address : 0xFFC18 (A), 0xFFC28 (B)
*
* Mapping : 111
* xxx2109876543210
* |||||||||||||_ BR : Baud Rate
*
**********************************************************************/
 
_FAR ubin16 SCCR0A @0xFFC18;
_FAR ubin16 SCCR0B @0xFFC28;
 
/**********************************************************************
*
* Register : SCCR1A, SCCR1B - SCI Control Register 1
*
* Address : 0xFFC1A (A), 0xFFC2A (B)
*
* Mapping : 11111
* x432109876543210
* |||||||||||||||_ SBK : Send Break
* ||||||||||||||__ RWU : Receiver Wakeup
* |||||||||||||___ RE : Receiver Enable
* ||||||||||||____ TE : Transmitter Enable
* |||||||||||_____ ILIE : Idle-Line Interrupt
* ||||||||||______ RIE : Receiver Interrupt
* |||||||||_______ TCIE : Transmit Complete Interrupt
* ||||||||________ TIE : Transmit Interrupt
* |||||||_________ WAKE : Wakeup
* ||||||__________ M : Mode Select
* |||||___________ PE : Parity Enable
* ||||____________ PT : Parity Type
* |||_____________ ILT : Idle-Line Detect Type
* ||______________ WOMC : Wired-OR Mode
* |_______________ LOOPS : Loop Mode
*
**********************************************************************/
 
typedef struct
{
ubin16 SBK : 1;
ubin16 RWU : 1;
ubin16 RE : 1;
ubin16 TE : 1;
ubin16 ILIE : 1;
ubin16 RIE : 1;
ubin16 TCIE : 1;
ubin16 TIE : 1;
ubin16 WAKE : 1;
ubin16 M : 1;
ubin16 PE : 1;
ubin16 PT : 1;
ubin16 ILT : 1;
ubin16 WOMC : 1;
ubin16 LOOPS : 1;
ubin16 unused : 1;
} sSCCR1;
 
typedef union
{
ubin16 w;
sSCCR1 b;
} uSCCR1;
 
_FAR uSCCR1 SCCR1A @0xFFC1A;
_FAR uSCCR1 SCCR1B @0xFFC2A;
 
/**********************************************************************
*
* Register : SCSRA, SCSRB - SCI Status Register
*
* Address : 0xFFC1C (A), 0xFFC2C (B)
*
* Mapping :
* xxxxxxx876543210
* |||||||||_ PF : Parity Error Flag
* ||||||||__ FE : Framing Error Flag
* |||||||___ NF : Noise Error Flag
* ||||||____ OR : Overrun Error Flag
* |||||_____ IDLE : Idle-Line Detected Flag
* ||||______ RAF : Receiver Active Flag
* |||_______ RDRF : Receive Data Register Full Flag
* ||________ TC : Transmit Complete Flag
* |_________ TDRE : Transmit Data Register Empty Flag
*
**********************************************************************/
 
typedef struct
{
ubin16 PF : 1;
ubin16 FE : 1;
ubin16 NF : 1;
ubin16 OR : 1;
ubin16 IDLE : 1;
ubin16 RAF : 1;
ubin16 RDRF : 1;
ubin16 TC : 1;
ubin16 TDRE : 1;
} sSCSR;
 
typedef union
{
ubin16 w;
sSCSR b;
} uSCSR;
 
_FAR uSCSR SCSRA @0xFFC1C;
_FAR uSCSR SCSRB @0xFFC2C;
 
/**********************************************************************
*
* Register : SCDRA, SCDRB - SCI Data Register
*
* Address : 0xFFC1E (A), 0xFFC2E (B)
*
* Mapping :
* xxxxxxxx76543210
* ||||||||_ SCDR : SCI Data Register
*
**********************************************************************/
 
_FAR ubin8 SCDRA @0xFFC1F;
_FAR ubin8 SCDRB @0xFFC2F;
 
/**********************************************************************
*
* Register : QSMCR - QSM Configuration Register
*
* Address : 0xFF400
*
* Mapping : 111
* 543xxxxx7xxx3210
* ||| | ||||_ IARB : Interrupt Arbitration Number
* ||| |________ SUPV : Supervisor/Unrestricted
* |||______________ FRZ0 : Not Implemented
* ||_______________ FRZ1 : FREEZE Assertion Response
* |________________ STOP : 0 = Normal Operation,
* 1 = Low Power
*
**********************************************************************/
 
typedef struct
{
ubin16 IARB : 4;
ubin16 usused_2 : 3;
ubin16 SUPV : 1;
ubin16 unused_1 : 5;
ubin16 FRZ0 : 1;
ubin16 FRZ1 : 1;
ubin16 STOP : 1;
} sQSMCR;
 
typedef union
{
ubin16 w;
sQSMCR b;
} uQSMCR;
 
_FAR uQSMCR QSMCR @0xFF400; /* Module Configuration Register */
 
/**********************************************************************
*
* Register : QILR - QSM Interrupt Levels Register
*
* Address : 0xFF404
*
* Mapping :
* xx543210
* ||||||_________ ILSCI : Interrupt Level for SCI
* |||____________ ILQSPI : Interrupt Level for QSPI
*
**********************************************************************/
 
typedef struct
{
ubin8 ILSCI : 3;
ubin8 ILQSPI : 3;
ubin8 unused : 2;
} sQILR;
 
typedef union
{
ubin8 w;
sQILR b;
} uQILR;
 
_FAR uQILR QILR @0xFF404;
 
/**********************************************************************
*
* Register : QIVR - QSM Interrupt Vector Register
*
* Address : 0xFF405
*
* Mapping :
* 76543210
* ||||||||_________ INTV : Interrupt Vector Number
*
**********************************************************************/
 
_FAR ubin8 QIVR @0xFF405;
 
/**********************************************************************
*
* Register : PORTQS - Port QS Data Register
*
* Address : 0xFF415
*
* Mapping :
* 76543210
* ||||||||_________ PQS0 :
* |||||||__________ PQS1 :
* ||||||___________ PQS2 :
* |||||____________ PQS3 :
* ||||_____________ PQS4 :
* |||______________ PQS5 :
* ||_______________ PQS6 :
* |________________ PQS7 :
*
**********************************************************************/
 
typedef struct
{
ubin8 PQS0 : 1;
ubin8 PQS1 : 1;
ubin8 PQS2 : 1;
ubin8 PQS3 : 1;
ubin8 PQS4 : 1;
ubin8 PQS5 : 1;
ubin8 PQS6 : 1;
ubin8 PQS7 : 1;
} sPORTQS;
 
typedef union
{
ubin8 w;
sPORTQS b;
} uPORTQS;
 
_FAR uPORTQS PORTQS @0xFF415;
 
/**********************************************************************
*
* Register : PQSPAR - PORT QS Pin Assignment Register
*
* Address : 0xFF416
*
* Mapping :
* x6543x10
* |||| ||_________ PQSPA0 :
* |||| |__________ PQSPA1 :
* ||||____________ PQSPA3 :
* |||_____________ PQSPA4 :
* ||______________ PQSPA5 :
* |_______________ PQSPA6 :
*
**********************************************************************/
 
typedef struct
{
ubin8 PQSPA0 : 1;
ubin8 PQSPA1 : 1;
ubin8 unused_1 : 1;
ubin8 PQSPA3 : 1;
ubin8 PQSPA4 : 1;
ubin8 PQSPA5 : 1;
ubin8 PQSPA6 : 1;
ubin8 unused_2 : 1;
} sPQSPAR;
 
typedef union
{
ubin8 w;
sPQSPAR b;
} uPQSPAR;
 
_FAR uPQSPAR PQSPAR @0xFF416;
 
/**********************************************************************
*
* Register : DDRQS - PORT QS Data Direction Register
*
* Address : 0xFF417
*
* Mapping :
* 76543210
* ||||||||_________ DDQS0 :
* |||||||__________ DDQS1 :
* ||||||___________ DDQS2 :
* |||||____________ DDQS3 :
* ||||_____________ DDQS4 :
* |||______________ DDQS5 :
* ||_______________ DDQS6 :
* |________________ DDQS7 :
*
**********************************************************************/
 
typedef struct
{
ubin8 DDQS0 : 1;
ubin8 DDQS1 : 1;
ubin8 DDQS2 : 1;
ubin8 DDQS3 : 1;
ubin8 DDQS4 : 1;
ubin8 DDQS5 : 1;
ubin8 DDQS6 : 1;
ubin8 DDQS7 : 1;
} sDDRQS;
 
typedef union
{
ubin8 w;
sDDRQS b;
} uDDRQS;
 
_FAR uDDRQS DDRQS @0xFF417;
 
/**********************************************************************
*
* Register : SPCR0 - QSPI Control Register 0
*
* Address : 0xFF418
*
* Mapping : 111111
* 5432109876543210
* ||||||||||||||||_ SPBR : Serial Clock Baud Rate
* ||||||||_________ CPHA : Clock Phase
* |||||||__________ CPOL : Clock Polarity
* ||||||___________ BITS : Bits Per Transfer
* ||_______________ WOMQ : Wired-OR Mode for QSPI Pins
* |________________ MSTR : Master/Slave Mode Select
*
**********************************************************************/
 
typedef struct
{
ubin16 SPBR : 8;
ubin16 CPHA : 1;
ubin16 CPOL : 1;
ubin16 BITS : 4;
ubin16 WOMQ : 1;
ubin16 MSTR : 1;
} sSPCR0;
 
typedef union
{
ubin16 w;
sSPCR0 b;
} uSPCR0;
 
_FAR uSPCR0 SPCR0 @0xFF418;
 
/**********************************************************************
*
* Register : SPCR1 - QSPI Control Register 1
*
* Address : 0xFF41A
*
* Mapping : 111111
* 5432109876543210
* ||||||||||||||||_ DTL : Length of Delay after Transfer
* ||||||||_________ DSCKL : Delay before SCK
* |________________ SPE : QSPI Enable
*
**********************************************************************/
 
typedef struct
{
ubin16 DTL : 8;
ubin16 DSCKL : 7;
ubin16 SPE : 1;
} sSPCR1;
 
typedef union
{
ubin16 w;
sSPCR1 b;
} uSPCR1;
 
_FAR uSPCR1 SPCR1 @0xFF41A;
 
/**********************************************************************
*
* Register : SPCR2 - QSPI Control Register 2
*
* Address : 0xFF41C
*
* Mapping : 111 11
* 543x1098xxxx3210
* ||| |||| ||||_ NEWQP : New Queue Pointer Value
* ||| ||||_________ ENDQP : Ending Queue Pointer
* |||______________ WRTO : Wrap To
* ||_______________ WREN : Wrap Enable
* |________________ SPIFIE : SPI Finished Interrupt Enable
*
**********************************************************************/
 
typedef struct
{
ubin16 NEWQP : 4;
ubin16 unused_1 : 4;
ubin16 ENDQP : 4;
ubin16 unused_2 : 1;
ubin16 WRTO : 1;
ubin16 WREN : 1;
ubin16 SPIFIE : 1;
} sSPCR2;
 
typedef union
{
ubin16 w;
sSPCR2 b;
} uSPCR2;
 
_FAR uSPCR2 SPCR2 @0xFF41C;
 
/**********************************************************************
*
* Register : SPCR3 - QSPI Control Register 3
*
* Address : 0xFF41E
*
* Mapping :
* xxxxx210
* |||_________ HALT : Halt QSPI
* ||__________ HMIE : HALTA and MODF Interrupt Enable
* |___________ LOOPQ : QSPI Loop Mode
*
**********************************************************************/
 
typedef struct
{
ubin8 HALT : 1;
ubin8 HMIE : 1;
ubin8 LOOPQ : 1;
ubin8 unused : 5;
} sSPCR3;
 
typedef union
{
ubin8 w;
sSPCR3 b;
} uSPCR3;
 
_FAR uSPCR3 SPCR3 @0xFF41E;
 
/**********************************************************************
*
* Register : SPSR - QSPI Status Register
*
* Address : 0xFF41F
*
* Mapping :
* 765x3210
* ||| ||||_________ CPTQP : Completed Queue Pointer
* |||______________ HALTA : Halt Acknowledge Flag
* ||_______________ MODF : Mode Fault Flag
* |________________ SPIF : QSPI Finished Flag
*
**********************************************************************/
 
typedef struct
{
ubin8 CPTQP : 4;
ubin8 unused : 1;
ubin8 HALTA : 1;
ubin8 MODF : 1;
ubin8 SPIF : 1;
} sSPSR;
 
typedef union
{
ubin8 w;
sSPSR b;
} uSPSR;
 
_FAR uSPSR SPSR @0xFF41F;
 
/**********************************************************************
*
* Register : RR - Receive Data RAM
*
* Address : 0xFF500
*
**********************************************************************/
 
_FAR ubin16 RR_16[16] @0xFF500;
_FAR ubin8 RR_8[32] @0xFF500;
_FAR ubin32 RR_32[8] @0xFF500;
 
/**********************************************************************
*
* Register : TR - Transmit Data RAM
*
* Address : 0xFF520
*
**********************************************************************/
 
_FAR ubin16 TR_16[16] @0xFF520;
_FAR ubin8 TR_8[32] @0xFF520;
_FAR ubin32 TR_32[8] @0xFF520;
 
/**********************************************************************
*
* Register : CR - QSPI Command RAM
*
* Address : 0xFF540
*
* Mapping :
* 76543210
* ||||||||_________ PCS : Peripheral Chip Select
* ||||_____________ DSCK : PCS to SCK Delay
* |||______________ DT : Delay after Transfer
* ||_______________ BITSE : Bitse per Transfer Enable
* |________________ CONT : Continue
*
**********************************************************************/
 
typedef struct
{
ubin8 PCS : 4;
ubin8 DSCK : 1;
ubin8 DT : 1;
ubin8 BITSE : 1;
ubin8 CONT : 1;
} sCR;
 
typedef union
{
ubin8 w;
sCR b;
} uCR;
 
_FAR uCR CR[16] @0xFF540;
 
/**********************************************************************
*
* Register : TFMCR - TPUFLASH Module Configuration Register
*
* Address : 0xFF860
*
* Mapping : 11 11
* 54x21x98xxx432xx
* || || || |||___ BUSY : TPUFLASH Busy Flag
* || || || ||____ TPU : TPU Status Flag
* || || || |_____ TME* : TPU Mode Enable Shadow
* || || ||_________ ASPC : TPUFLASH Array Space
* || ||____________ LOCK : Lock Registers
* || |_____________ BOOT* : Boot Control
* ||_______________ FRZ : Freeze Mode Control
* |________________ STOP : Stop Mode Control
*
*
**********************************************************************/
 
typedef struct
{
ubin16 unused_1 : 2;
ubin16 BUSY : 1;
ubin16 TPU : 1;
ubin16 TME : 1;
ubin16 unused_2 : 3;
ubin16 ASPC : 2;
ubin16 unused_3 : 1;
ubin16 LOCK : 1;
ubin16 BOOT : 1;
ubin16 unused_4 : 1;
ubin16 FRZ : 1;
ubin16 STOP : 1;
} sTFMCR;
 
typedef union
{
ubin16 w;
sTFMCR b;
} uTFMCR;
 
_FAR uTFMCR TFMCR @0xFF860;
 
/**********************************************************************
*
* Register : TFBAH - TPUFLASH Base Address High Register
*
* Address : 0xFF864
*
* Mapping :
* xxxxxxxx76543210
* ||||||||_ ADDR : High-order bits of the array
* base address
*
**********************************************************************/
 
_FAR ubin16 TFBAH @0xFF864;
 
/**********************************************************************
*
* Register : TFBAL - TPUFLASH Base Address Low Register
*
* Address : 0xFF866
*
* Mapping : 1111
* 5432xxxxxxxxxxxx
* ||||_____________ ADDR : Low-order bits of the array
* base address
*
**********************************************************************/
 
_FAR ubin16 TFBAL @0xFF866;
 
/**********************************************************************
*
* Register : TFCTL - TPUFLASH Control Register
*
* Address : 0xFF868
*
* Mapping :
* xxxxxxxxxxxx3210
* ||||_ ENPE : Enable Program/Erase
* |||__ LAT : Latch Control
* ||___ ERAS : Erase Control
* |____ VFPE : Verify Program/Erase
*
**********************************************************************/
 
typedef struct
{
ubin16 ENPE : 1;
ubin16 LAT : 1;
ubin16 ERAS : 1;
ubin16 VFPE : 1;
ubin16 unused : 12;
} sTFCTL;
 
typedef union
{
ubin16 w;
sTFCTL b;
} uTFCTL;
 
_FAR uTFCTL TFCTL @0xFF868;
 
#define GPTBaseAddr 0xFF900
 
/**********************************************************************
*
* Register : GPTMCR - GPT Module Configuration Register
*
* Address : 0xFF900
*
* Mapping : 11111
* 54321xxx7xxx3210
* ||||| | ||||_ IARB : Interrupt Arbitration Number
* ||||| |________ SUPV : Supervisor/Unrestricted
* |||||____________ INCP : Increment Prescaler
* ||||_____________ STOPP : Stop Prescaler
* |||______________ FRZ0 : FEEZE Assertion Response
* ||_______________ FRZ1 : Not Implemented
* |________________ STOP : 0 = Normal Operation,
* 1 = Low Power
*
**********************************************************************/
 
typedef struct
{
ubin16 IARB : 4;
ubin16 unused_1 : 3;
ubin16 SUPV : 1;
ubin16 unused_2 : 3;
ubin16 INCP : 1;
ubin16 STOPP : 1;
ubin16 FRZ0 : 1;
ubin16 FRZ1 : 1;
ubin16 STOP : 1;
} sGPTMCR;
 
typedef union
{
ubin16 w;
sGPTMCR b;
} uGPTMCR;
 
_FAR uGPTMCR GPTMCR @GPTBaseAddr;
 
/**********************************************************************
*
* Register : GPTICR - GPT Interrupt Configuration Register
*
* Address : 0xFF904
*
* Mapping : 1111 1
* 5432x0987654xxxx
* |||| |||||||_____ IVBA : Interrupt Vector Base Address
* |||| |||_________ IPL : Interrupt Priority Level
* ||||_____________ IPA : Interrupt Priority Adjust
*
**********************************************************************/
 
typedef struct
{
ubin16 unused_1 : 4;
ubin16 IVBA : 4;
ubin16 IPL : 3;
ubin16 unused_2 : 1;
ubin16 IPA : 4;
} sGPTICR;
 
typedef union
{
ubin16 w;
sGPTICR b;
} uGPTICR;
 
_FAR uGPTICR GPTICR @(GPTBaseAddr + 0x04);
 
/**********************************************************************
*
* Register : DDRGP - Port GP Data Direction Register
*
* Address : 0xFF906
*
* Mapping :
* 76543210
* ||||||||_________ DDRGP : Data Direction Register
*
**********************************************************************/
 
typedef struct
{
ubin8 GP0 : 1;
ubin8 GP1 : 1;
ubin8 GP2 : 1;
ubin8 GP3 : 1;
ubin8 GP4 : 1;
ubin8 GP5 : 1;
ubin8 GP6 : 1;
ubin8 GP7 : 1;
} sDDRGP;
 
typedef union
{
ubin8 w;
sDDRGP b;
} uDDRGP;
 
_FAR uDDRGP DDRGP @(GPTBaseAddr + 0x06);
 
/**********************************************************************
*
* Register : PORTGP - Port GP Data Register
*
* Address : 0xFF907
*
* Mapping :
* 76543210
* ||||||||_________ PORTGP : Data Register
*
**********************************************************************/
 
typedef union
{
ubin8 w;
sDDRGP b;
} uPORTGP;
 
_FAR uPORTGP PORTGP @(GPTBaseAddr + 0x07);
 
/**********************************************************************
*
* Register : OC1M - OC1 Action Mask Register
*
* Address : 0xFF908
*
* Mapping :
* 76543xxx
* |||||____________ OC1M : OC1 Mask Field
*
**********************************************************************/
 
typedef struct
{
ubin8 unused : 3;
ubin8 OC1M : 5;
} sOC1M;
 
typedef union
{
ubin8 w;
sOC1M b;
} uOC1M;
 
_FAR uOC1M OC1M @(GPTBaseAddr + 0x08);
 
/**********************************************************************
*
* Register : TCNT - Timer Counter Register
*
* Address : 0xFF90A
*
* Mapping :
*
**********************************************************************/
 
_FAR ubin16 TCNT @(GPTBaseAddr + 0x0A);
 
/**********************************************************************
*
* Register : PACTL - Pulse Accumulator Control Register
*
* Address : 0xFF90C
*
* Mapping :
* 76543210
* ||||||||_________ PACLK : Pulse Accumulator Clock Select
* ||||||___________ I4O5 : Input Capture 4/Output Compare 5
* |||||____________ PCLKS : PCLK Pin State (R/O)
* ||||_____________ PEDGE : Pulse Accumulator Edge Control
* |||______________ PAMOD : Pulse Accumulator Mode
* ||_______________ PAEN : Pulse Accumulator Enable
* |________________ PAIS : PAI Pin State (R/O)
*
**********************************************************************/
 
typedef struct
{
ubin8 PACLK : 2;
ubin8 I4O5 : 1;
ubin8 PCLKS : 1;
ubin8 PEDGE : 1;
ubin8 PAMOD : 1;
ubin8 PAEN : 1;
ubin8 PAIS : 1;
} sPACTL;
 
typedef union
{
ubin8 w;
sPACTL b;
} uPACTL;
 
_FAR uPACTL PACTL @(GPTBaseAddr + 0x0C);
 
/**********************************************************************
*
* Register : TMSK - GPT Timer Interrupt Mask Register
*
* Address : 0xFF920
*
* Mapping : 111111
* 543210987x543210
* ||||||||| ||||||_ CPR : Timer Prescaler/PCLK Select Field
* ||||||||| |||____ CPROUT : Capture/Compare Unit Clock
* ||||||||| || Output Enable
* ||||||||| ||_____ PAII : Pulse Accumulator Input
* ||||||||| | Interrupt Enable
* ||||||||| |______ PAOVI : Pulse Accumulator Overflow
* ||||||||| Interrupt Enable
* |||||||||________ TOI : Timer Overflow Interrupt Enable
* ||||||||_________ ICI[3:1]: Input Capture Interrupt Enable
* |||||____________ OCI[4:1]: Output Compare Interrupt
* | Enable
* |________________ I4O5I : Input Capture 4/Output Compare
* 5 Interrupt Enable
*
**********************************************************************/
 
typedef struct
{
ubin16 CPR : 3;
ubin16 CPROUT : 1;
ubin16 PAII : 1;
ubin16 PAOVI : 1;
ubin16 unused : 1;
ubin16 TOI : 1;
ubin16 ICI1 : 1;
ubin16 ICI2 : 1;
ubin16 ICI3 : 1;
ubin16 OCI1 : 1;
ubin16 OCI2 : 1;
ubin16 OCI3 : 1;
ubin16 OCI4 : 1;
ubin16 I4O5I : 1;
} sTMSK;
 
typedef union
{
ubin16 w;
sTMSK b;
} uTMSK;
 
_FAR uTMSK TMSK @(GPTBaseAddr + 0x20);
 
typedef struct
{
unsigned int unused_1 : 4;
unsigned int PAIF : 1;
unsigned int PAWVF : 1;
unsigned int unused_2 : 1;
unsigned int TOF : 1;
unsigned int ICF : 3;
unsigned int OCF : 4;
unsigned int I4O5F : 1;
} sTFLG;
 
typedef union
{
sTFLG b;
ubin16 w;
} uTFLG;
 
_FAR uTFLG TFLG1 @(GPTBaseAddr + 0x22);
 
_FAR ubin16 PRESCL @(GPTBaseAddr + 0x2C);
 
 
#define SCIM2BaseAddr 0xFFA00
 
typedef struct
{
ubin8 PF0 : 1;
ubin8 PF1 : 1;
ubin8 PF2 : 1;
ubin8 PF3 : 1;
ubin8 PF4 : 1;
ubin8 PF5 : 1;
ubin8 PF6 : 1;
ubin8 PF7 : 1;
} sPORTF;
 
typedef union
{
ubin8 w;
sPORTF b;
} uPORTF;
 
@far uPORTF PORTF0 @(SCIM2BaseAddr + 0x19);
@far uPORTF PORTF1 @(SCIM2BaseAddr + 0x1B);
 
/**********************************************************************
*
* Register : PICR - SCIM2 Periodic Interrupt Control Register
*
* Address : 0xFFA22
*
* Mapping : 1
* xxxxx09876543210
* |||||||||||_ PIV : Periodic Interrupt Request Level
* |||_________ PIRQL : Periodic Interrupt Vector
*
**********************************************************************/
 
typedef struct
{
ubin16 PIV : 8;
ubin16 PIRQL : 3;
ubin16 unused : 5;
} sPICR;
 
typedef union
{
ubin16 w;
sPICR b;
} uPICR;
 
_FAR uPICR PICR @(SCIM2BaseAddr + 0x22);
 
/**********************************************************************
*
* Register : PITR - SCIM2 Periodic Interrupt Timer Register
*
* Address : 0xFFA24
*
* Mapping :
* xxxxxxx876543210
* |||||||||_ PITM : Periodic Interrupt Timing Modulus
* |_________ PTP : Periodic Timer Prescaler
*
**********************************************************************/
 
typedef struct
{
ubin16 PITM : 8;
ubin16 PTP : 1;
ubin16 unused : 7;
} sPITR;
 
typedef union
{
ubin16 w;
sPITR b;
} uPITR;
 
_FAR uPITR PITR @(SCIM2BaseAddr + 0x24);
 
#define ADCBaseAddr 0xFF700
 
typedef struct
{
ubin16 unused_1 : 7;
ubin16 SUPV : 1;
ubin16 unused_2 : 5;
ubin16 FRZ : 2;
ubin16 STOP : 1;
} sADMCR;
 
typedef union
{
ubin16 w;
sADMCR b;
} uADMCR;
 
_FAR uADMCR ADMCR @(ADCBaseAddr + 0x00);
 
typedef struct
{
ubin16 PADA0 : 1;
ubin16 PADA1 : 1;
ubin16 PADA2 : 1;
ubin16 PADA3 : 1;
ubin16 PADA4 : 1;
ubin16 PADA5 : 1;
ubin16 PADA6 : 1;
ubin16 PADA7 : 1;
ubin16 unused : 8;
} sPORTADA;
 
typedef union
{
ubin16 w;
sPORTADA b;
} uPORTADA;
 
_FAR uPORTADA PORTADA @(ADCBaseAddr + 0x06);
 
typedef struct
{
ubin16 PRS : 5;
ubin16 STS : 2;
ubin16 RES10 : 1;
ubin16 unused : 8;
} sADCTL0;
 
typedef union
{
ubin16 w;
sADCTL0 b;
} uADCTL0;
 
_FAR uADCTL0 ADCTL0 @(ADCBaseAddr + 0x0A);
 
typedef struct
{
ubin16 C : 4;
ubin16 S8CM : 1;
ubin16 MULT : 1;
ubin16 SCAN : 1;
ubin16 unused : 9;
} sADCTL1;
 
typedef union
{
ubin16 w;
sADCTL1 b;
} uADCTL1;
 
_FAR uADCTL1 ADCTL1 @(ADCBaseAddr + 0x0C);
 
typedef struct
{
ubin16 CCF : 8;
ubin16 CCTR : 3;
ubin16 unused : 4;
ubin16 SCF : 1;
} sADCSTAT;
 
typedef union
{
ubin16 w;
sADCSTAT b;
} uADCSTAT;
 
_FAR uADCSTAT ADCSTAT @(ADCBaseAddr + 0x0E);
 
_FAR ubin16 RJURR[16] @(ADCBaseAddr + 0x10);
_FAR
 
 
/**********************************************************************
*
* Register : FEExMCR - Flash EEPROM Module Configuration Register
*
* Address : 0xFF800, 0xFF820, 0xFF840
*
* Mapping : 11 11
* 54x21x9876xxxxxx
* || || ||||_______ WAIT : Wait States
* || || ||_________ ASPC : Flash EEPROM Array Space
* || ||____________ LOCK : Lock Register
* || |_____________ BOOT* : Boot Control
* ||_______________ FRZ : Freeze Mode Control
* |________________ STOP : Stop Mode Control
*
**********************************************************************/
 
typedef struct
{
ubin16 unused_1 : 6;
ubin16 WAIT : 2;
ubin16 ASPC : 2;
ubin16 unused_2 : 1;
ubin16 LOCK : 1;
ubin16 BOOT : 1;
ubin16 unused_3 : 1;
ubin16 FRZ : 1;
ubin16 STOP : 1;
} sFEEMCR;
 
typedef union
{
ubin16 w;
sFEEMCR b;
} uFEEMCR;
 
_FAR uFEEMCR FEE1MCR @0xFF800;
_FAR uFEEMCR FEE2MCR @0xFF820;
_FAR uFEEMCR FEE3MCR @0xFF840;
 
/**********************************************************************
*
* Register : FEExBA - Flash EEPROM Module Base Address Registers
*
* Address : 0xFF804, 0xFF824, 0xFF844
*
**********************************************************************/
 
_FAR ubin16 *FEE1BA @0xFF804;
_FAR ubin16 *FEE2BA @0xFF824;
_FAR ubin16 *FEE3BA @0xFF844;
 
_FAR uTFCTL FEE1CTL @0xFF808;
_FAR uTFCTL FEE2CTL @0xFF828;
_FAR uTFCTL FEE3CTL @0xFF848;
 
typedef struct
{
uFEEMCR MCR;
ubin16 Test_Reg;
ubin16 *BA;
uTFCTL CTL;
} sFlashRegs;
 
_FAR sFlashRegs FEE1 @0xFF800;
_FAR sFlashRegs FEE2 @0xFF820;
_FAR sFlashRegs FEE3 @0xFF840;
 
/**********************************************************************
*
* TPU2 - Time Processing Unit 2
*
**********************************************************************/
 
/**********************************************************************
*
* Register : TPUMCR - TPU2 Module Configuration Register
*
* Address : 0xFFE00
*
* Mapping : 111111
* 5432109876543210
* ||||||||||||||||_ IARB : Interrupt Arbitration ID
* ||||||||||||_____ T2CSL : TCR2 Counter Clock Edge
* |||||||||||______ TPU2 : TPU2 Enable
* ||||||||||_______ PSCK : Prescaler Clock
* |||||||||________ SUPV : Supervisor/Unrestricted
* ||||||||_________ STF : Stop Flag
* |||||||__________ T2CG : TCR2 Clock/Gate Control
* ||||||___________ EMU : Emulation Control
* |||||____________ TCR2P : Timer Count Register 2
* ||| Prescaler Control
* |||______________ TCR1P : Timer Count Register 1
* | Prescaler Control
* |________________ STOP : Low-Power Stop Mode Enable
*
**********************************************************************/
 
typedef struct
{
ubin16 IARB : 4;
ubin16 T2CSL : 1;
ubin16 TPU2 : 1;
ubin16 PSCK : 1;
ubin16 SUPV : 1;
ubin16 STF : 1;
ubin16 EMU : 1;
ubin16 TCR2P : 2;
ubin16 TCR1P : 2;
ubin16 STOP : 1;
} sTPUMCR;
 
typedef union
{
ubin16 w;
sTPUMCR b;
} uTPUMCR;
 
_FAR uTPUMCR TPUMCR @0xFFE00;
 
/**********************************************************************
*
* Register : DSCR - Development Support Control Register
*
* Address : 0xFFE04
*
* Mapping : 1 1
* 5xxxx09876543210
* | |||||||||||_ BT : Breakpoint Enable Bits
* | ||||||||||__ BM : "
* | |||||||||___ BL : "
* | ||||||||____ BH : "
* | |||||||_____ BC : "
* | ||||||______ BP : "
* | |||||_______ CCL : Channel Conditions Latch
* | ||||________ FRZ : FREEZE Assertion Response
* | ||__________ CLKS : Stop Clocks
* | |___________ BLC : Branch Latch Control
* |________________ HOT4 : Hang on T4
*
**********************************************************************/
 
typedef struct
{
ubin16 BT : 1;
ubin16 BM : 1;
ubin16 BL : 1;
ubin16 BH : 1;
ubin16 BC : 1;
ubin16 BP : 1;
ubin16 CCL : 1;
ubin16 FRZ : 2;
ubin16 CLKS : 1;
ubin16 BLC : 1;
ubin16 unused : 4;
ubin16 HOT4 : 1;
} sDSCR;
 
typedef union
{
ubin16 w;
sDSCR b;
} uDSCR;
 
_FAR uDSCR DSCR @0xFFE04;
 
/**********************************************************************
*
* Register : DSSR - Development Support Status Register
*
* Address : 0xFFE06
*
* Mapping :
* 76543xxx
* |||||____ TPUF : TPU2 FREEZE Flag
* ||||_____ SRBK : Service Request Breakpoint Flag
* |||______ CHBK : Channel Register Breakpoint Flag
* ||_______ PCBK : uPC Breakpoint Flag
* |________ BKPT : Breakpoint Asserted Flag
*
**********************************************************************/
 
typedef struct
{
ubin16 unused_1 : 3;
ubin16 TPUF : 1;
ubin16 SRBK : 1;
ubin16 CHBK : 1;
ubin16 PCBK : 1;
ubin16 BKPT : 1;
ubin16 unused_2 : 8;
} sDSSR;
 
typedef union
{
ubin16 w;
sDSSR b;
} uDSSR;
 
_FAR uDSSR DSSR @0xFFE06;
 
/**********************************************************************
*
* Register : TICR - TPU2 Interrupt Configuration Register
*
* Address : 0xFFE08
*
* Mapping : 1
* xxxxx0987654xxxx
* |||||||_____ CIBV : Channel Interrupt Base Vector
* |||_________ CIRL : Channel Interrupt Request Level
*
**********************************************************************/
 
typedef struct
{
ubin16 unused_1 : 4;
ubin16 CIBV : 4;
ubin16 CIRL : 3;
ubin16 unused_2 : 5;
} sTICR;
 
typedef union
{
ubin16 w;
sTICR b;
} uTICR;
 
_FAR uTICR TICR @0xFFE08;
 
/**********************************************************************
*
* Register : CIER - Channel Interrupt Enable Register
*
* Address : 0xFFE0A
*
* Mapping : 111111
* 5432109876543210
* ||||||||||||||||_ CH0 : Channel 0
* |||||||||||||||__ CH1 : Channel 1
* ||||||||||||||___ CH2 : Channel 2
* |||||||||||||____ CH3 : Channel 3
* ||||||||||||_____ CH4 : Channel 4
* |||||||||||______ CH5 : Channel 5
* ||||||||||_______ CH6 : Channel 6
* |||||||||________ CH7 : Channel 7
* ||||||||_________ CH8 : Channel 8
* |||||||__________ CH9 : Channel 9
* ||||||___________ CH10 : Channel 10
* |||||____________ CH11 : Channel 11
* ||||_____________ CH12 : Channel 12
* |||______________ CH13 : Channel 13
* ||_______________ CH14 : Channel 14
* |________________ CH15 : Channel 15
*
**********************************************************************/
 
typedef struct
{
ubin16 CH0 : 1;
ubin16 CH1 : 1;
ubin16 CH2 : 1;
ubin16 CH3 : 1;
ubin16 CH4 : 1;
ubin16 CH5 : 1;
ubin16 CH6 : 1;
ubin16 CH7 : 1;
ubin16 CH8 : 1;
ubin16 CH9 : 1;
ubin16 CH10 : 1;
ubin16 CH11 : 1;
ubin16 CH12 : 1;
ubin16 CH13 : 1;
ubin16 CH14 : 1;
ubin16 CH15 : 1;
} sCIER;
 
typedef union
{
ubin16 w;
sCIER b;
} uCIER;
 
_FAR uCIER CIER @0xFFE0A;
 
#define CIER.CH0 CIER.b.CH0
 
/**********************************************************************
*
* Register : CFSRx - Channel Function Select Register
*
* Address : 0xFFE0C Channels 15-12
* 0xFFE0E Channels 11-8
* 0xFFE10 Channels 7-4
* 0xFFE12 Channels 3-0
*
* Mapping : 111111
* 5432109876543210
* ||||||||||||||||_ CH12 : Channel 12
* ||||||||||||_____ CH13 : Channel 13
* ||||||||_________ CH14 : Channel 14
* ||||_____________ CH15 : Channel 15
*
**********************************************************************/
 
typedef struct
{
ubin16 CHANNEL12 : 4;
ubin16 CHANNEL13 : 4;
ubin16 CHANNEL14 : 4;
ubin16 CHANNEL15 : 4;
ubin16 CHANNEL8 : 4;
ubin16 CHANNEL9 : 4;
ubin16 CHANNEL10 : 4;
ubin16 CHANNEL11 : 4;
ubin16 CHANNEL4 : 4;
ubin16 CHANNEL5 : 4;
ubin16 CHANNEL6 : 4;
ubin16 CHANNEL7 : 4;
ubin16 CHANNEL0 : 4;
ubin16 CHANNEL1 : 4;
ubin16 CHANNEL2 : 4;
ubin16 CHANNEL3 : 4;
} sCFSR;
 
_FAR sCFSR CFSR @0xFFE0C;
 
#define TPU_PPWA 0x0F;
#define TPU_OC 0x0E;
#define TPU_SM 0x0D;
#define TPU_PSP 0x0C;
#define TPU_PMAPMM 0x0B;
#define TPU_ITC 0x0A;
#define TPU_PWM 0x09;
#define TPU_DIO 0x08;
#define TPU_SPWM 0x07;
#define TPU_QDEC 0x06;
 
typedef struct
{
ubin16 PSC : 2;
ubin16 PAC : 3;
ubin16 TBS : 4;
ubin16 unused : 7;
} sCHANNEL_CONTROL;
 
typedef struct
{
sCHANNEL_CONTROL CHANNEL_CONTROL;
ubin16 OFFSET;
ubin8 RATIO;
ubin8 REF_ADDR1;
ubin8 REF_ADDR2;
ubin8 REF_ADDR3;
ubin16 REF_TIME;
ubin16 ACTUAL_TIME;
ubin16 TCR1;
ubin16 TCR2;
} sParameterRAM;
 
_FAR sParameterRAM ParameterRAM[16] @0xFFF00;
 
#endif
/**********************************************************************
* *
* Program: MUXDEMO *
* *
* Author: Anadigm - LRS *
* *
* Description: This program demonstrates controlling the input cell *
* MUX through C Code. *
* *
* Copyright (C) 2002 Anadigm Ltd. All rights reserved. *
* *
**********************************************************************/
 
#include <stdio.h>
#include <string.h>
#include "916y3.h"
#include "an20e30.h"
#include "apicode.h"
#include "camcode.h"
 
static const ubin16 ChipReset[] = { 0x00D5, 0xFF48 };
 
/**********************************************************************
* *
* Procedure Name : sync_pulse *
* *
* Purpose : This function initiates the transfer to the AN20 *
* by setting up the QSPI transfer, and sending the *
* initial clocks to set up the chip. *
* *
* Inputs : None *
* *
* Outputs : None *
* *
* Revision History : *
* 10/30/01 - LRS - Initial creation *
* *
**********************************************************************/
 
static void sync_pulse(void)
{
// Set up the QSPI Command RAM for the transfers
memset((ubin8 *)CR, 0xC0, 16);
 
// Initialize the QSPI Transmit RAM to zeros
memset((ubin8 *)TR_16, 0x00, 32);
 
// Set up and send 16 clocks to initialize the AN20 configuration
// logic.
SPCR2.b.NEWQP = 0;
SPCR2.b.ENDQP = 2;
 
// Force the port to zeros to hold the selection between transfers.
PORTQS.w = 0x00;
 
SPCR1.b.SPE = 1;
 
while (SPCR1.b.SPE);
}
 
/**********************************************************************
* *
* Procedure Name : close_transfer *
* *
* Purpose : This function closes out the transfer to the AN20 *
* by sending a final set of clocks to allow the *
* configuration logic to complete its job. *
* *
* Inputs : None *
* *
* Outputs : None *
* *
* Revision History : *
* 10/30/01 - LRS - Initial creation *
* 04 Mar 2002 - LRS - Removed error in updating QSPI Command RAM. *
* *
**********************************************************************/
 
static void close_transfer(void)
{
// Make sure the last transfer was completed.
while (SPCR1.b.SPE);
 
// Set zero in the transmit RAM, since it doesn't matter what we
// send.
TR_16[0] = 0;
 
// Send 16-bits of data. Could be 8-bits, depending on
// circumstances.
SPCR2.b.NEWQP = 0;
SPCR2.b.ENDQP = 0;
 
SPCR1.b.SPE = 1;
 
// Wait for the transfer to complete...
while (SPCR1.b.SPE);
}
 
/**********************************************************************
* *
* Procedure Name : configure_chip_from_memory *
* *
* Purpose : This function sends a data stream out to the chip.*
* *
* Inputs : ubin16* SourceStream - Where the data is coming *
* from. *
* ubin16 StreamSize - How much data to send. *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Removed unecessary chip number reference. *
* *
**********************************************************************/
void configure_chip_from_memory(ubin16* SourceStream,
ubin16 StreamSize)
{
ubin8 blocksize;
 
sync_pulse();
 
qspi_send_buffer(SourceStream, StreamSize);
 
close_transfer();
}
 
void reset_chip(void)
{
configure_chip_from_memory(ChipReset, 4);
 
delay(25);
}
 
/**********************************************************************
* *
* Procedure Name : delay *
* *
* Purpose : This routine delays a specific amount of time. *
* The timing is not exact, however. *
* *
* Inputs : ubin16 ms - The time to delay. *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial documentation. *
* *
**********************************************************************/
void delay(ubin16 ms)
{
ubin16 delayloop;
 
while (ms)
{
for (delayloop = 0; delayloop < 100; delayloop++);
ms--;
}
}
#ifndef AN20E30_H
#define AN20E30_H
 
#include "gentypes.h"
 
void reset_chip(void);
void configure_chip_from_serial(void);
void configure_chip_from_flash(ubin8);
void configure_chip_from_memory(ubin16*, ubin16);
 
#endif
#include "ApiCode.h"
 
/********************************************************************\
* AnadigmDesigner C Code *
*--------------------------------------------------------------------*
* *
* File: ApiCode.c *
* Circuit: Untitled *
* Generated: March 13, 2002: 04:11 PM *
* *
\********************************************************************/
 
/*##################################################################*\
# #
# Data and Definitions #
# #
\*##################################################################*/
 
/* This is the initial full configuration stream for chip1. */
const an_Byte an_chip1_PrimaryConfigInfo[] =
{
/* The header for the primary configuration stream */
0xD5, /* Synch */
0xB7, /* JTAG1 */
0x22, /* JTAG2 */
0x0 , /* JTAG3 */
0x10, /* JTAG4 */
0x1 , /* Device ID */
0x5 , /* Control */
 
/* Start of update block */
0xCC, /* Byte Number: 12 */
0x0 , /* Bank: 0 */
0xC , /* Byte count: 12 */
 
/* Data for upate block */
0xA , 0x0 , 0x8 , 0x4 , 0x0 , 0x1 , 0x0 , 0x7F,
0x0 , 0x8 , 0xFF, 0x1 ,
 
/* Error Byte: Inverse Synch */
0x2A,
 
/* Start of update block */
0xDE, /* Byte Number: 30 */
0x0 , /* Bank: 0 */
0x1 , /* Byte count: 1 */
 
/* Data for upate block */
0xF ,
 
/* Error Byte: Inverse Synch */
0x2A,
 
/* Start of update block */
0xCE, /* Byte Number: 14 */
0x1 , /* Bank: 1 */
0x12, /* Byte count: 18 */
 
/* Data for upate block */
0x1 , 0x48, 0x7F, 0x48, 0x7F, 0x1 , 0x20, 0x2 ,
0x3F, 0x20, 0x40, 0x3F, 0x0 , 0x0 , 0x48, 0x7F,
0x48, 0x7F,
 
/* Error Byte: Inverse Synch */
0x2A,
 
/* Start of update block */
0xDE, /* Byte Number: 30 */
0x3 , /* Bank: 3 */
0xE , /* Byte count: 14 */
 
/* Data for upate block */
0x1A, 0x11, 0xFF, 0x0 , 0x10, 0xFF, 0x1 , 0x81,
0xFF, 0x0 , 0x10, 0xFF, 0x1 , 0x81,
 
/* Error Byte: Inverse Synch */
0x2A,
 
/* Start of update block */
0xD1, /* Byte Number: 17 */
0x4 , /* Bank: 4 */
0x1 , /* Byte count: 1 */
 
/* Data for upate block */
0x7 ,
 
/* Error Byte: Inverse Synch */
0x2A,
 
/* Start of update block */
0xC2, /* Byte Number: 2 */
0x5 , /* Bank: 5 */
0x3 , /* Byte count: 3 */
 
/* Data for upate block */
0xD8, 0xC1, 0xAE,
 
/* Error Byte: Inverse Synch */
0x2A,
 
/* Start of update block */
0xCB, /* Byte Number: 11 */
0x5 , /* Bank: 5 */
0x4 , /* Byte count: 4 */
 
/* Data for upate block */
0x98, 0x0 , 0xC1, 0xAC,
 
/* Error Byte: Inverse Synch */
0x2A,
 
/* Start of update block */
0xDE, /* Byte Number: 30 */
0x5 , /* Bank: 5 */
0x2 , /* Byte count: 2 */
 
/* Data for upate block */
0x1A, 0x11,
 
/* Error Byte: Inverse Synch */
0x2A,
 
/* Start of update block */
0xDE, /* Byte Number: 30 */
0x7 , /* Bank: 7 */
0x2 , /* Byte count: 2 */
 
/* Data for upate block */
0x1A, 0x11,
 
/* Error Byte: Inverse Synch */
0x2A,
 
/* Start of update block */
0x9E, /* Byte Number: 30 */
0x9 , /* Bank: 9 */
0x2 , /* Byte count: 2 */
 
/* Data for upate block */
0x1A, 0x11,
 
/* Error Byte: Inverse Synch */
0x2A
};
 
/* This table maps an nChipID to its primary configuration data. */
const an_apiPrimaryConfigInfo an_apiPrimaryConfigData[an_apiChipCount] =
{
/* chip1 */
{
an_chip1_PrimaryConfigInfo, /* pStream */
106 /* nLength */
}
};
 
/* This is the constant synchronizing header byte. */
const an_Byte an_apiSynchByte = 0xD5; /* 11010101 */
 
/* This array maps the #define'd nChipID to the chip's device ID. */
const an_Byte an_apiDeviceID[an_apiChipCount] =
{
0x1 /* an_chip1: 00000001 */
};
 
/* apiReconfigInfo for chip1 */
an_apiReconfigInfo an_chip1_ReconfigInfo =
{
NULL, /* pStream */
0, /* nLength */
64, /* nCapacity */
0, /* nLastUpdateIndex */
0 /* nFlags */
};
 
/* This table maps an nChipID to the apiReconfigInfo struct of that
chip. */
an_apiReconfigInfo* an_apiReconfigData[an_apiChipCount] =
{
&an_chip1_ReconfigInfo /* chip1 */
};
 
/* This array maps the #define'd nCamID to the nChipID of the chip
which the CAM is in. */
const an_Byte an_apiChipFromCAM[an_apiCAMCount] =
{
an_chip1, /* "an_chip1_GainInv" in chip "chip1" */
an_chip1 /* "an_chip1_InputCell4" in chip "chip1" */
};
 
/* Component data table for the apiCapacitor's of GainInv. */
extern const an_apiCapacitor an_chip1_GainInv_Capacitor[4] =
{
/* Cin */
{
/* nByteNum: 3 */
0x3 ,
 
/* nBank: 4 */
0x4 ,
},
 
/* Cout */
{
/* nByteNum: 9 */
0x9 ,
 
/* nBank: 4 */
0x4 ,
},
 
/* aCin */
{
/* nByteNum: 0 */
0x0 ,
 
/* nBank: 4 */
0x4 ,
},
 
/* aCout */
{
/* nByteNum: 6 */
0x6 ,
 
/* nBank: 4 */
0x4
}
};
 
/* Component map for GainInv */
void* an_chip1_GainInv_Components[4] =
{
(void*) &an_chip1_GainInv_Capacitor[0], /* Cin */
(void*) &an_chip1_GainInv_Capacitor[1], /* Cout */
(void*) &an_chip1_GainInv_Capacitor[2], /* aCin */
(void*) &an_chip1_GainInv_Capacitor[3] /* aCout */
};
 
/* This array maps the #define'd ModuleID to its component map */
void** an_apiCAMComponentData[an_apiCAMCount] =
{
an_chip1_GainInv_Components, /* an_chip1_GainInv */
(void**) an_apiInvalid /* an_chip1_InputCell4 */
};
 
/* This array maps the #define'd nChipID to the chip's pad select byte
value */
const an_IOMuxPad an_apiActiveIOMuxPad[an_apiChipCount] =
{
0x1
};
 
/*##################################################################*\
# #
# Functions #
# #
\*##################################################################*/
 
/********************************************************************\
* Primary Configuration *
\********************************************************************/
 
/*--------------------------------------------------------------*\
| GetPrimaryConfigData |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Retrieves the primary configuration data for the chip. The |
| returned data begins with the synch byte and ends with the |
| last error byte. There are no pad bytes included. The number |
| of bytes in the configuration data is set in pCount. |
| |
\*--------------------------------------------------------------*/
 
const an_Byte* an_GetPrimaryConfigData(an_Chip nChip, int* pCount)
{
/* Set how long it is */
*pCount = an_apiPrimaryConfigData[nChip].nLength;
 
/* Return the pointer to the configuration data */
return an_apiPrimaryConfigData[nChip].pStream;
}
 
/********************************************************************\
* Reconfiguration *
\********************************************************************/
 
/*--------------------------------------------------------------*\
| InitializeReconfigData |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Allocates memory for the reconfiguration data and does |
| initial setup of the header. Must be called prior to using |
| any other reconfiguration functions for the chip. The memory |
| can be freed by calling an_ShutdownReconfigData. |
| |
\*--------------------------------------------------------------*/
 
void an_InitializeReconfigData(an_Chip nChip)
{
/* Get a pointer to the info struct */
an_apiReconfigInfo* pInfo = an_apiReconfigData[nChip];
 
/* Create the data buffer and update the info */
pInfo->pStream = (an_Byte*) calloc(pInfo->nCapacity,
sizeof(an_Byte));
 
/* Now do everything that needs to be done in a reset
situation */
an_ClearReconfigData(nChip);
}
 
/*--------------------------------------------------------------*\
| ShutdownReconfigData |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Frees memory allocated by an_InitializeReconfigData. |
| an_InitializeReconfigData must be called again prior to using |
| any other reconfiguration functions for the chip. |
| |
\*--------------------------------------------------------------*/
 
void an_ShutdownReconfigData(an_Chip nChip)
{
/* Get a pointer to the info struct */
an_apiReconfigInfo* pInfo = an_apiReconfigData[nChip];
 
/* Free the memory from the data buffer */
free(pInfo->pStream);
 
/* Update the stream info */
pInfo->pStream = NULL;
pInfo->nLength = 0;
pInfo->nFlags = 0;
}
 
/*--------------------------------------------------------------*\
| GetReconfigData |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Retrieves the current reconfiguration data for the chip. The |
| returned data begins with the synch byte and ends with the |
| last error byte. There are no pad bytes included. The number |
| of bytes in the reconfiguration is set in pCount. The data |
| returned from this function is invalidated if another |
| reconfiguration funcion is called for this chip. The data |
| returned from this function should not be modified. |
| |
\*--------------------------------------------------------------*/
 
const an_Byte* an_GetReconfigData(an_Chip nChip, int* pCount)
{
/* Get a pointer to the info struct */
an_apiReconfigInfo* pInfo = an_apiReconfigData[nChip];
 
/* Set how big it is. If it is 3, then really there is no
real data. */
*pCount = (pInfo->nLength == 3) ? 0 : pInfo->nLength;
 
/* Return the pointer to the data */
return pInfo->pStream;
}
 
/*--------------------------------------------------------------*\
| ClearReconfigData |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Resets the reconfiguration data for the chip back to what it |
| was when ApiCall:InitializeReconfigData was first called. |
| This does not free any memory. |
| |
\*--------------------------------------------------------------*/
 
void an_ClearReconfigData(an_Chip nChip)
{
/* Get a pointer to the info struct */
an_apiReconfigInfo* pInfo = an_apiReconfigData[nChip];
 
/* We don't have to remove any data, just adjust the info */
an_apiReconfigData[nChip]->nLength = 3;
an_apiReconfigData[nChip]->nLastUpdateIndex = 0;
 
/* Reset the stream info flags */
pInfo->nFlags = an_ApiReconfigState_Initialized;
 
/* Configure the data header for a reconfiguration */
pInfo->pStream[0] = an_apiSynchByte; /* Synch Byte */
pInfo->pStream[1] = an_apiDeviceID[nChip]; /* Device ID */
/* Control Byte */
pInfo->pStream[2] = an_ControlByte_EndExecute;
}
 
/********************************************************************\
* Utility Functions *
\********************************************************************/
 
/*--------------------------------------------------------------*\
| SetReconfigControlFlags |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Sets flags in the control byte of the reconfiguration data |
| for the chip. |
| |
\*--------------------------------------------------------------*/
 
void an_SetReconfigControlFlags(an_Chip nChip,
an_ControlByte nFlags)
{
an_apiReconfigInfo* pInfo = an_apiReconfigData[nChip];
 
/* Control byte is index 2 */
pInfo->pStream[2] = nFlags;
}
 
/*--------------------------------------------------------------*\
| GetReconfigControlFlags |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Retrieves the flags in the control byte of the |
| reconfiguration data for the chip. |
| |
\*--------------------------------------------------------------*/
 
an_ControlByte an_GetReconfigControlFlags(an_Chip nChip)
{
an_apiReconfigInfo* pInfo = an_apiReconfigData[nChip];
 
/* Control byte is index 2 */
return pInfo->pStream[2];
}
 
/********************************************************************\
* CAM Functions *
\********************************************************************/
 
/*--------------------------------------------------------------*\
| SetCapValue |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Set a capacitor to a given value. The new 8-bit value is |
| nValue. nCapID is the name given to represent the capacitor |
| in the CAM net list. This should only be called from within |
| CAM functions, and is not intended for use otherwise. |
| |
\*--------------------------------------------------------------*/
 
void an_SetCapValue(an_CAM nCAM,
an_Component nCapID,
an_Byte nValue)
{
/* First figure out what cap this is for */
const an_apiCapacitor* pCap =
an_apiCAMComponentData[nCAM][nCapID];
 
/* And then just do a regular one-byte update */
an_BuildReconfigDataBlock(an_apiChipFromCAM[nCAM],
pCap->nBank,
pCap->nByteNum,
&nValue,
1);
}
 
/*--------------------------------------------------------------*\
| SetActiveIOMuxPad |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Sets the current pad to use for the MUX iocell input. |
| |
\*--------------------------------------------------------------*/
 
void an_SetActiveIOMuxPad(an_CAM nCAM, an_IOMuxPad nPad)
{
an_Chip nChip = an_apiChipFromCAM[nCAM];
 
/* Start with the current value so bits that are not set get
maintained */
an_IOMuxPad nNewSelect = an_apiActiveIOMuxPad[nChip];
 
/* If we are setting the input channel */
if (an_IOMuxPad_InputA <= nPad && nPad <= an_IOMuxPad_InputD)
{
/* Maintain the swap bit */
nNewSelect = nPad | (nNewSelect & 0x10);
}
 
/* Add it to the reconfig data */
an_BuildReconfigDataBlock(nChip,
1,
19,
(an_Byte*) &nNewSelect,
1);
}
 
/*--------------------------------------------------------------*\
| ChooseCapRatio |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Given a desired gain, this function will calculate the ideal |
| capacitor values. The realized capacitor values will be |
| returned in the pointers that are passed in. |
| |
\*--------------------------------------------------------------*/
 
void an_ChooseCapRatio(double dGain,
an_Byte* pCap1,
an_Byte* pCap2)
{
double realizedGain;
double realizedError;
double currentError = 99999;
 
an_Byte capTry1;
an_Byte capTry2;
 
/* Start off with some default values */
an_Byte currentCap1 = 1;
an_Byte currentCap2 = 1;
 
/* Run all the way down the scale looking for the best ratio. */
for (capTry2 = 255; capTry2 > 0; capTry2--)
{
capTry1 = an_AdjustCap(dGain * capTry2);
 
/* See how good it came out */
realizedGain = (double) capTry1 / (double) capTry2;
realizedError = fabs( ( dGain - realizedGain) / dGain);
 
/* If its the best so far, then store the results */
if( realizedError < currentError )
{
currentError = realizedError;
 
currentCap1 = capTry1;
currentCap2 = capTry2;
}
}
 
*pCap1 = currentCap1;
*pCap2 = currentCap2;
}
 
/*--------------------------------------------------------------*\
| AdjustCap |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Returns the 8-bit capacitor value most closely representing |
| the passed in value. |
| |
\*--------------------------------------------------------------*/
 
an_Byte an_AdjustCap(double dValue)
{
/* Start by just rounding.
We will handle special cases later */
an_Byte capValue = (an_Byte) (dValue + 0.5);
 
/* Constrain to 1 - 255 */
if (dValue < 1.0)
{
capValue = 1;
}
else if (dValue > 255.0)
{
capValue = 255;
}
 
return capValue;
}
 
/*--------------------------------------------------------------*\
| FixedChooseCapRatio |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Given a desired gain, this function will calculate the ideal |
| capacitor values. The realized capacitor values will be |
| returned in the pointers that are passed in. |
| |
\*--------------------------------------------------------------*/
 
void an_FixedChooseCapRatio(double dGain,
an_Byte* pCap1,
an_Byte* pCap2)
{
an_Fixed realizedGain;
an_Fixed workGain = an_FloatToFixed(dGain);
an_Fixed realizedError;
an_Fixed currentError = 0x7FFFFFFF;
 
an_Byte capTry1;
an_Byte capTry2;
 
/* Start off with some default values */
an_Byte currentCap1 = 1;
an_Byte currentCap2 = 1;
 
/* Run all the way down the scale looking for the best ratio. */
for (capTry2 = 255; capTry2 > 0; capTry2--)
{
capTry1 = an_FixedAdjustCap(workGain * capTry2);
 
/* See how good it came out */
realizedGain = an_FixedDivide(an_IntToFixed(capTry1),
an_IntToFixed(capTry2));
realizedError = an_FixedDivide(an_FixedAbs(workGain -
realizedGain),
workGain);
 
/* If it's the best so far, then store the results */
if (realizedError < currentError)
{
currentError = realizedError;
 
currentCap1 = capTry1;
currentCap2 = capTry2;
}
}
 
*pCap1 = currentCap1;
*pCap2 = currentCap2;
}
 
/*--------------------------------------------------------------*\
| FixedAdjustCap |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Returns the 8-bit capacitor value most closely representing |
| the passed in value. |
| |
\*--------------------------------------------------------------*/
 
an_Byte an_FixedAdjustCap(an_Fixed fValue)
{
an_Byte capValue = (an_Byte) an_FixedToInt(fValue);
 
if (fValue < 0x00010000)
{
capValue = 1;
}
else if (fValue > 0x00FF0000)
{
capValue = 255;
}
 
return capValue;
}
 
/********************************************************************\
* Fixed-Point Math *
\********************************************************************/
 
/*--------------------------------------------------------------*\
| FloatToFixed |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Convert from float to ApiName::fixed |
| |
\*--------------------------------------------------------------*/
 
an_Fixed an_FloatToFixed(float fValue)
{
return (an_Fixed) (fValue * 65536.0);
}
 
/*--------------------------------------------------------------*\
| IntToFixed |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Convert from int to ApiName::fixed |
| |
\*--------------------------------------------------------------*/
 
an_Fixed an_IntToFixed(int nValue)
{
return ((an_Fixed) (nValue)) << 16;
}
 
/*--------------------------------------------------------------*\
| FixedToInt |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Convert from ApiName::fixed to int |
| |
\*--------------------------------------------------------------*/
 
int an_FixedToInt(an_Fixed fValue)
{
return (int) ((fValue + 0x8000) >> 16);
}
 
/*--------------------------------------------------------------*\
| FixedToFloat |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Convert from ApiName::fixed to float |
| |
\*--------------------------------------------------------------*/
 
float an_FixedToFloat(an_Fixed fValue)
{
return (float) ((fValue + 0x8000) / 65536.0);
}
 
/*--------------------------------------------------------------*\
| FixedAbs |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| This function returns the absolute value of a fixed-point |
| number. |
| |
\*--------------------------------------------------------------*/
 
an_Fixed an_FixedAbs(an_Fixed fValue)
{
/* Sign is indicated by the MSB of the value. If set, number
is negative. */
if ((fValue & 0x80000000) != 0)
{
return -fValue;
}
else
{
return fValue;
}
}
 
/*--------------------------------------------------------------*\
| FixedDivide |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| This function returns the result of dividing two fixed-point |
| numbers. Input fLeft is the left-side of the implied division |
| sign. It is the first value to divide. Input fRight is the |
| right-side of the implied division sign. It is the value to |
| divide the first value by. The fixed-point numbers are |
| assumed to be in 16:16 form, although the routine might work |
| for any other fixed-point setup, as long as the two values |
| are identical in their fixed-point setup. But this has not |
| been tested. Division of fixed-point numbers is defined as |
| dividing the mantissas, and subtracting the exponents. Since |
| we are implying 16:16 numbers, the subtraction of exponents |
| would leave us with no fractional part. To solve this |
| problem, we try to shift the numerator up by 16 bits. |
| However, many compilers do not support 64-bit numbers, so we |
| have to improvise a way to do the division without resorting |
| to assembly language or unsupported types. |
| |
\*--------------------------------------------------------------*/
 
an_Fixed an_FixedDivide(an_Fixed fLeft, an_Fixed fRight)
{
unsigned int left_neg = (fLeft & 0x80000000) != 0;
unsigned int right_neg = (fRight & 0x80000000) != 0;
 
/* Make sure we're using positive numbers for the division.
We'll handle sign later. */
unsigned long lefttemp = (left_neg ? -fLeft : fLeft);
unsigned long righttemp = (right_neg ? -fRight : fRight);
 
an_Fixed result = 0;
unsigned char shiftbits = 16;
 
/* We'll check the simple cases. */
/* First, no integer component in the numerator (i.e. left < 1).
* If this is the case, then we chop off the upper word (turn
* the number into a 0:32 number), and perform the division. */
if ((lefttemp >> 16) == 0)
result = (lefttemp << 16) / righttemp;
else
/* Second, no fractional portion in the denominator (i.e.
* it's a whole number). If this is the case, then we chop
* off the lower word (turn the number into a 32:0 number),
* and perform the division. */
if ((righttemp << 16) == 0)
result = lefttemp / (righttemp >> 16);
else
{
/* Check to see if the numerator is less than the
* denominator. If so, we'll shift up the numerator as far
* as we can of the 16 bits we want to shift by, do the
* divison, then shift the result by the remaining bits of
* the 16 bits. */
if (lefttemp < righttemp)
{
while ((shiftbits) && ((lefttemp & 0x80000000) == 0))
{
lefttemp <<= 1;
shiftbits--;
}
result = (lefttemp / righttemp) << shiftbits;
}
else
{
/* Finally, if all else fails, we will do this the long
* way. Like elementary math, we will do this by
* repeatedly dividing, and using the remainder as part
* of the next division, until we have no remainder, or
* we run out of the 16-bits we need to do the 16:32
* effect. */
while (((lefttemp & 0x80000000) == 0) &&
((righttemp & 0x80000000) == 0) &&
((righttemp & 0x0000FFFF) != 0))
{
lefttemp <<= 1;
righttemp <<= 1;
}
result = lefttemp / righttemp;
lefttemp = lefttemp % righttemp;
 
while ((lefttemp > 0) &&
(shiftbits > 0 ))
{
while (((lefttemp & 0x80000000) == 0) &&
(shiftbits != 0))
{
lefttemp <<= 1;
result <<= 1;
shiftbits--;
}
 
result += lefttemp / righttemp;
lefttemp = lefttemp % righttemp;
}
}
}
 
/* Lastly, we check to see whether one, but not both, of the
* operators was negative. If so, negate the result. */
if (left_neg ^ right_neg)
result = -result;
 
return result;
}
 
/********************************************************************\
* Internal API *
\********************************************************************/
 
/*--------------------------------------------------------------*\
| BuildReconfigDataBlock |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| Called by other API functions and should not be directly |
| called by the user. The heart of the reconfiguration API, |
| this function packages an address and a list of values into |
| the proper reconfiguration format, adhering to current |
| auto-grow and CRC16 policies. |
| |
\*--------------------------------------------------------------*/
 
void an_BuildReconfigDataBlock(an_Chip nChip,
an_Byte nBank,
an_Byte nByteNum,
an_Byte* pValues,
an_Byte nCount)
{
an_apiReconfigInfo* pInfo = an_apiReconfigData[nChip];
an_Byte nIndex = 0;
 
/* The size we expect this update to be. This may change,
depending on update mode and CRC setting */
an_Byte nUpdateSize = 4 + nCount;
 
/* If there was a previous update, we need to set its
update to follow bit*/
if (pInfo->nLastUpdateIndex)
{
/* Set the update to follow bit */
pInfo->pStream[pInfo->nLastUpdateIndex] =
pInfo->pStream[pInfo->nLastUpdateIndex] | 0x40;
}
 
/* The address */
pInfo->pStream[pInfo->nLength] = nByteNum;
pInfo->pStream[pInfo->nLength + 1] = nBank;
 
/* Number of bytes to write */
pInfo->pStream[pInfo->nLength + 2] = nCount;
 
/* The data */
for (nIndex = 0; nIndex < nCount; nIndex++)
{
pInfo->pStream[pInfo->nLength + (3 + nIndex)] =
pValues[nIndex];
}
 
/* Error checking byte */
pInfo->pStream[pInfo->nLength + (3 + nCount)] =
~an_apiSynchByte;
 
/* Need to store where the address of this update is so we know
* for the next one */
pInfo->nLastUpdateIndex = pInfo->nLength;
 
/* Update how much stuff is in this stream */
pInfo->nLength = pInfo->nLength + nUpdateSize;
}
#ifndef APICODE_H
#define APICODE_H
 
/********************************************************************\
* AnadigmDesigner C Code *
*--------------------------------------------------------------------*
* *
* File: ApiCode.h *
* Circuit: Untitled *
* Generated: March 13, 2002: 04:11 PM *
* *
\********************************************************************/
 
#include <stdlib.h>
#include <math.h>
 
#ifdef __cplusplus
extern "C" {
#endif
 
/*##################################################################*\
# #
# Data and Definitions #
# #
\*##################################################################*/
 
/* All basic data types required by the C code. */
typedef unsigned char an_Byte;
typedef long an_Fixed;
typedef short an_Component;
typedef an_Byte an_Chip;
typedef an_Byte an_CAM;
 
/* Enumerated type representing IOMuxPad */
typedef enum an_IOMuxPad
{
an_IOMuxPad_InputA = 0x01, /* InputA */
an_IOMuxPad_InputB = 0x02, /* InputB */
an_IOMuxPad_InputC = 0x04, /* InputC */
an_IOMuxPad_InputD = 0x08 /* InputD */
} an_IOMuxPad;
 
/* Enumerated type representing ControlByte */
typedef enum an_ControlByte
{
an_ControlByte_Pullups = 0x01, /* Pullups */
an_ControlByte_EndExecute = 0x04, /* EndExecute */
an_ControlByte_SReset = 0x08, /* SReset */
an_ControlByte_Read = 0x10, /* Read */
an_ControlByte_InhibitRdbck = 0x20, /* InhibitRdbck */
an_ControlByte_ResetAll = 0x40 /* ResetAll */
} an_ControlByte;
 
/* Enumerated type representing ApiReconfigState */
typedef enum an_ApiReconfigState
{
an_ApiReconfigState_Initialized = 0x01, /* Initialized */
an_ApiReconfigState_CRCEnabled = 0x02 /* CRCEnabled */
} an_ApiReconfigState;
 
/* If NULL has not yet been defined, do it now. */
#ifndef NULL
#define NULL 0
#endif
 
/* Just a definition for ease of code reading. */
#define an_apiInvalid 0xFF
 
/* Each chip that has at least one programmable CAM is #define'd by a
name that is the ANSI C equivalent of the chip name */
#define an_chip1 0 /* "chip1" */
 
/* How many chips with programmable Chips there are. */
#define an_apiChipCount 1
 
/* This structure contains all the information about the primary
configuration of a chip */
typedef struct an_apiPrimaryConfigInfo
{
/* Complete primary configuration stream. */
const an_Byte* pStream;
 
/* Size of the primary configuration stream. */
short nLength;
} an_apiPrimaryConfigInfo;
 
/* These hold the initial configuration streams for the chips. */
extern const an_Byte an_chip1_PrimaryConfigInfo[];
 
/* This table maps an nChipID to its primary configuration data. */
extern const an_apiPrimaryConfigInfo
an_apiPrimaryConfigData[an_apiChipCount];
 
/* This is the constant synchronizing header byte. */
extern const an_Byte an_apiSynchByte;
 
/* This array maps the #define'd nChipID to the chip's device ID. */
extern const an_Byte an_apiDeviceID[an_apiChipCount];
 
/* This structure contains all the information about the current state
of an update stream. */
typedef struct an_apiReconfigInfo
{
/* Pointer to the actual update stream. */
an_Byte* pStream;
 
/* Number of bytes actually used in the update stream. */
short nLength;
 
/* Number of bytes currently allocated for the update stream. */
short nCapacity;
 
/* Position in the stream array of address1 of the last update. */
short nLastUpdateIndex;
 
/* Internal state of the update stream. */
an_ApiReconfigState nFlags;
} an_apiReconfigInfo;
 
/* There is one of these structures for each programmable chip. */
extern an_apiReconfigInfo an_chip1_ReconfigInfo; /* chip1 */
 
/* This table maps an nChipID to the apiReconfigInfo struct of that
chip. */
extern an_apiReconfigInfo* an_apiReconfigData[an_apiChipCount];
 
/* Each CAM that is programmable is #define'd by a name that is the
ANSI C equivalent of the CAM name */
#define an_chip1_GainInv 0 /* "GainInv" */
#define an_chip1_InputCell4 1 /* "InputCell4" */
 
/* How many programmable CAMs there are. */
#define an_apiCAMCount 2
 
/* This array maps the #define'd nCamID to the nChipID of the chip
which the CAM is in. */
extern const an_Byte an_apiChipFromCAM[an_apiCAMCount];
 
/* Component ID's for ANx20 Standard\GainInv */
#define an_ANx20_Standard_GainInv_Cin 0 /* Cin */
#define an_ANx20_Standard_GainInv_Cout 1 /* Cout */
#define an_ANx20_Standard_GainInv_aCin 2 /* aCin */
#define an_ANx20_Standard_GainInv_aCout 3 /* aCout */
 
/* This is the data structure for a capacitor. */
typedef struct an_apiCapacitor
{
/* The actual byte number within the memory bank */
an_Byte nByteNum;
 
/* Which memory bank this is located in. */
an_Byte nBank;
 
} an_apiCapacitor;
 
 
/* Component tables for GainInv */
extern const an_apiCapacitor an_chip1_GainInv_Capacitor[4];
 
/* There is one of these tables for each programmable CAM. Each table
maps the ID of a component to its ComponentFinder. */
extern void* an_chip1_GainInv_Components[4];
 
/* This array maps the #define'd ModuleID to its component map */
extern void** an_apiCAMComponentData[an_apiCAMCount];
 
/* This array maps the #define'd nChipID to the chip's pad select byte
value */
extern const an_IOMuxPad an_apiActiveIOMuxPad[an_apiChipCount];
 
/*##################################################################*\
# #
# Functions #
# #
\*##################################################################*/
 
/********************************************************************\
* Primary Configuration *
\********************************************************************/
 
/*--------------------------------------------------------------*\
| GetPrimaryConfigData |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
const an_Byte* an_GetPrimaryConfigData(an_Chip nChip,
int* pCount);
/* *\
| |
| Description |
| ------------------------------ |
| Retrieves the primary configuration data for the chip. The |
| returned data begins with the synch byte and ends with the |
| last error byte. There are no pad bytes included. The number |
| of bytes in the configuration data is set in pCount. |
| |
\*--------------------------------------------------------------*/
 
/********************************************************************\
* Reconfiguration *
\********************************************************************/
 
/*--------------------------------------------------------------*\
| InitializeReconfigData |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
void an_InitializeReconfigData(an_Chip nChip);
/* *\
| |
| Description |
| ------------------------------ |
| Allocates memory for the reconfiguration data and does |
| initial setup of the header. Must be called prior to using |
| any other reconfiguration functions for the chip. The memory |
| can be freed by calling an_ShutdownReconfigData. |
| |
\*--------------------------------------------------------------*/
 
/*--------------------------------------------------------------*\
| ShutdownReconfigData |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
void an_ShutdownReconfigData(an_Chip nChip);
/* *\
| |
| Description |
| ------------------------------ |
| Frees memory allocated by an_InitializeReconfigData. |
| an_InitializeReconfigData must be called again prior to using |
| any other reconfiguration functions for the chip. |
| |
\*--------------------------------------------------------------*/
 
/*--------------------------------------------------------------*\
| GetReconfigData |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
const an_Byte* an_GetReconfigData(an_Chip nChip, int* pCount);
/* *\
| |
| Description |
| ------------------------------ |
| Retrieves the current reconfiguration data for the chip. The |
| returned data begins with the synch byte and ends with the |
| last error byte. There are no pad bytes included. The number |
| of bytes in the reconfiguration is set in pCount. The data |
| returned from this function is invalidated if another |
| reconfiguration funcion is called for this chip. The data |
| returned from this function should not be modified. |
| |
\*--------------------------------------------------------------*/
 
/*--------------------------------------------------------------*\
| ClearReconfigData |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
void an_ClearReconfigData(an_Chip nChip);
/* *\
| |
| Description |
| ------------------------------ |
| Resets the reconfiguration data for the chip back to what it |
| was when ApiCall:InitializeReconfigData was first called. |
| This does not free any memory. |
| |
\*--------------------------------------------------------------*/
 
/********************************************************************\
* Utility Functions *
\********************************************************************/
 
/*--------------------------------------------------------------*\
| SetReconfigControlFlags |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
void an_SetReconfigControlFlags(an_Chip nChip,
an_ControlByte nFlags);
/* *\
| |
| Description |
| ------------------------------ |
| Sets flags in the control byte of the reconfiguration data |
| for the chip. |
| |
\*--------------------------------------------------------------*/
 
/*--------------------------------------------------------------*\
| GetReconfigControlFlags |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
an_ControlByte an_GetReconfigControlFlags(an_Chip nChip);
/* *\
| |
| Description |
| ------------------------------ |
| Retrieves the flags in the control byte of the |
| reconfiguration data for the chip. |
| |
\*--------------------------------------------------------------*/
 
/********************************************************************\
* CAM Functions *
\********************************************************************/
 
/*--------------------------------------------------------------*\
| SetCapValue |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
void an_SetCapValue(an_CAM nCAM,
an_Component nCapID,
an_Byte nValue);
/* *\
| |
| Description |
| ------------------------------ |
| Set a capacitor to a given value. The new 8-bit value is |
| nValue. nCapID is the name given to represent the capacitor |
| in the CAM net list. This should only be called from within |
| CAM functions, and is not intended for use otherwise. |
| |
\*--------------------------------------------------------------*/
 
/*--------------------------------------------------------------*\
| SetActiveIOMuxPad |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
void an_SetActiveIOMuxPad(an_CAM nCAM, an_IOMuxPad nPad);
/* *\
| |
| Description |
| ------------------------------ |
| Sets the current pad to use for the MUX iocell input. |
| |
\*--------------------------------------------------------------*/
 
/*--------------------------------------------------------------*\
| ChooseCapRatio |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
void an_ChooseCapRatio(double dGain,
an_Byte* pCap1,
an_Byte* pCap2);
/* *\
| |
| Description |
| ------------------------------ |
| Given a desired gain, this function will calculate the ideal |
| capacitor values. The realized capacitor values will be |
| returned in the pointers that are passed in. |
| |
\*--------------------------------------------------------------*/
 
/*--------------------------------------------------------------*\
| AdjustCap |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
an_Byte an_AdjustCap(double dValue);
/* *\
| |
| Description |
| ------------------------------ |
| Returns the 8-bit capacitor value most closely representing |
| the passed in value. |
| |
\*--------------------------------------------------------------*/
 
/*--------------------------------------------------------------*\
| FixedChooseCapRatio |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
void an_FixedChooseCapRatio(double dGain,
an_Byte* pCap1,
an_Byte* pCap2);
/* *\
| |
| Description |
| ------------------------------ |
| Given a desired gain, this function will calculate the ideal |
| capacitor values. The realized capacitor values will be |
| returned in the pointers that are passed in. |
| |
\*--------------------------------------------------------------*/
 
/*--------------------------------------------------------------*\
| FixedAdjustCap |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
an_Byte an_FixedAdjustCap(an_Fixed fValue);
/* *\
| |
| Description |
| ------------------------------ |
| Returns the 8-bit capacitor value most closely representing |
| the passed in value. |
| |
\*--------------------------------------------------------------*/
 
/********************************************************************\
* Fixed-Point Math *
\********************************************************************/
 
/*--------------------------------------------------------------*\
| FloatToFixed |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
an_Fixed an_FloatToFixed(float fValue);
/* *\
| |
| Description |
| ------------------------------ |
| Convert from float to ApiName::fixed |
| |
\*--------------------------------------------------------------*/
 
/*--------------------------------------------------------------*\
| IntToFixed |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
an_Fixed an_IntToFixed(int nValue);
/* *\
| |
| Description |
| ------------------------------ |
| Convert from int to ApiName::fixed |
| |
\*--------------------------------------------------------------*/
 
/*--------------------------------------------------------------*\
| FixedToInt |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
int an_FixedToInt(an_Fixed fValue);
/* *\
| |
| Description |
| ------------------------------ |
| Convert from ApiName::fixed to int |
| |
\*--------------------------------------------------------------*/
 
/*--------------------------------------------------------------*\
| FixedToFloat |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
float an_FixedToFloat(an_Fixed fValue);
/* *\
| |
| Description |
| ------------------------------ |
| Convert from ApiName::fixed to float |
| |
\*--------------------------------------------------------------*/
 
/*--------------------------------------------------------------*\
| FixedAbs |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
an_Fixed an_FixedAbs(an_Fixed fValue);
/* *\
| |
| Description |
| ------------------------------ |
| This function returns the absolute value of a fixed-point |
| number. |
| |
\*--------------------------------------------------------------*/
 
/*--------------------------------------------------------------*\
| FixedDivide |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
an_Fixed an_FixedDivide(an_Fixed fLeft, an_Fixed fRight);
/* *\
| |
| Description |
| ------------------------------ |
| This function returns the result of dividing two fixed-point |
| numbers. Input fLeft is the left-side of the implied division |
| sign. It is the first value to divide. Input fRight is the |
| right-side of the implied division sign. It is the value to |
| divide the first value by. The fixed-point numbers are |
| assumed to be in 16:16 form, although the routine might work |
| for any other fixed-point setup, as long as the two values |
| are identical in their fixed-point setup. But this has not |
| been tested. Division of fixed-point numbers is defined as |
| dividing the mantissas, and subtracting the exponents. Since |
| we are implying 16:16 numbers, the subtraction of exponents |
| would leave us with no fractional part. To solve this |
| problem, we try to shift the numerator up by 16 bits. |
| However, many compilers do not support 64-bit numbers, so we |
| have to improvise a way to do the division without resorting |
| to assembly language or unsupported types. |
| |
\*--------------------------------------------------------------*/
 
/********************************************************************\
* Internal API *
\********************************************************************/
 
/*--------------------------------------------------------------*\
| BuildReconfigDataBlock |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
void an_BuildReconfigDataBlock(an_Chip nChip,
an_Byte nBank,
an_Byte nByteNum,
an_Byte* pValues,
an_Byte nCount);
/* *\
| |
| Description |
| ------------------------------ |
| Called by other API functions and should not be directly |
| called by the user. The heart of the reconfiguration API, |
| this function packages an address and a list of values into |
| the proper reconfiguration format, adhering to current |
| auto-grow and CRC16 policies. |
| |
\*--------------------------------------------------------------*/
 
#ifdef __cplusplus
}
#endif
 
#endif /* APICODE_H */
#include <stdio.h>
#include "apicode.h"
#include "ipmodulecode.h"
#include "916y3.h"
#include "lcddisp.h"
 
// This is where we will store the gain setting for each analog MUX input
double GainSetArray[4] =
{
10.0, 10.0, 10.0, 10.0
};
 
/******************************************************************************
* *
* Procedure Name : putchar *
* *
* Purpose : This function implements the standard putchar library *
* function, but directs the output to the LCD display. *
* *
* Inputs : char c - The character to display on the panel. *
* *
* Outputs : int - The character as an integer value. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial Version. *
* *
******************************************************************************/
int putchar(char c)
{
if ((c == '\n') || (c == '\r'))
LCD_clear();
else
LCD_data(c);
 
return (int) c;
}
 
/******************************************************************************
* *
* Procedure Name : init_keys *
* *
* Purpose : This function waits until the external switches go to a *
* predefined state that indicates that all switches are *
* released. *
* *
* Inputs : None *
* *
* Outputs : None *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial Version. *
* *
******************************************************************************/
void init_keys(void)
{
while ((PORTF0.w & 0x3F) != 0x3F);
}
 
/******************************************************************************
* *
* Procedure Name : get_key *
* *
* Purpose : This function tells the program which switch, if any, has *
* pressed. *
* *
* Inputs : None. *
* *
* Outputs : 0 - if no key was pressed, or 1 through 6 to indicate *
* which switch was pressed. It will not detect multiple key *
* presses, nor hold-downs. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial Version. *
* *
******************************************************************************/
int get_key(void)
{
unsigned char workPortF;
int keypressed = 0;
 
// Detect if a key has been pressed.
if ((workPortF = (PORTF0.w & 0x3F)) != 0x3F)
{
// Debounce the switch press, and see if we're still pressed.
delay(10);
if (workPortF == (PORTF0.w & 0x3F))
{
// Determine which key was pressed.
keypressed = 1;
while (workPortF & 0x01)
{
workPortF >>= 1;
keypressed++;
}
}
// Wait until the key is released.
while ((PORTF0.w & 0x3F) != 0x3F);
}
 
return (keypressed);
}
 
/******************************************************************************
* *
* Procedure Name : MuxBit *
* *
* Purpose : This function is basically a 2^byvalue function, giving *
* us a value that would be a 1 value in the desired bit *
* position. (i.e. MuxBit(0) = 1, MuxBit(1) = 2, *
* MuxBit(2) = 4, MuxBit(3) = 8, etc.) *
* *
* Inputs : unsigned char byvalue - The position we need the 1 bit. *
* *
* Outputs : unsigned char - The 2^byvalue result. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial Version. *
* *
******************************************************************************/
unsigned char MuxBit(unsigned char byvalue)
{
unsigned char result = 1;
 
while (byvalue--)
result <<= 1;
 
return result;
}
 
/******************************************************************************
* *
* Procedure Name : PrimaryConfigChip *
* *
* Purpose : This function calls the necessary C Code API functions to *
* retrieve and send off the primary configuration for this *
* application. *
* *
* Inputs : unsigned char chip_id - Which chip to configure. *
* *
* Outputs : None, but the AN220 will be configured according to the *
* Primary Configuration data stream. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial Version. *
* *
******************************************************************************/
void PrimaryConfigChip(an_byte chip_id)
{
unsigned short int *PrimaryConfigPtr;
int ConfigSize;
 
PrimaryConfigPtr = (unsigned short int *)an_GetPrimaryConfigData(chip_id, &ConfigSize);
configure_chip_from_memory(PrimaryConfigPtr,ConfigSize);
}
 
/******************************************************************************
* *
* Procedure Name : UpdateChip *
* *
* Purpose : This function handles the update of an AN220 chip after *
* any IPModule C Code calls. *
* *
* Inputs : unsigned char chip_id - The chip to update. *
* *
* Outputs : None, but the AN220 with the appropriate chip_id will be *
* updated according to the update configuration stream. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial Version. *
* *
******************************************************************************/
void UpdateChip(an_byte chip_id)
{
unsigned short int *ConfigPtr;
int ConfigSize;
 
ConfigPtr = (unsigned short int *)an_GetReconfigData(chip_id, &ConfigSize);
configure_chip_from_memory(ConfigPtr,ConfigSize);
an_ClearReconfigData(chip_id);
}
 
/******************************************************************************
* *
* Procedure Name : init_gpt *
* *
* Purpose : This function initialized the HC16's GPT to run an over- *
* flow flag on the free-running counter. *
* *
* Inputs : None. *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial Version. *
* *
******************************************************************************/
void init_gpt(void)
{
DDRGP.w = 0xFF;
 
// This function initializes the GPT to overflow about every 1 second
TMSK.b.CPR = 0x06;
TMSK.b.CPROUT = 1;
TMSK.b.TOI = 0;
}
 
/******************************************************************************
* *
* Procedure Name : A2DInit *
* *
* Purpose : This function initialized the A/D converter on the HC16, *
* setting it up to capture analog inputs on the pins. *
* *
* Inputs : None. *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial Version. *
* *
******************************************************************************/
void A2DInit(void)
{
// Enable the A/D module
ADMCR.b.STOP = 0;
 
// Set the module for 10-bit conversion, 16-ADC clock period sample time,
// and System Clock / 8 Prescaler output
ADCTL0.b.RES10 = 1;
ADCTL0.b.STS = 3;
ADCTL0.b.PRS = 3;
 
// Set the module for Single-channel conversion, eight-conversion sequence.
ADCTL1.b.MULT = 0;
ADCTL1.b.S8CM = 0;
ADCTL1.b.C = 0;
}
 
/******************************************************************************
* *
* Procedure Name : A2DRead *
* *
* Purpose : This functions runs a conversion on one A/D channel and *
* reports back the reading. *
* *
* Inputs : unsigned char Channel - The A/D channel to read. *
* *
* Outputs : ubin16 - The right-justified, unsigned result of the *
* conversion. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial Version. *
* *
******************************************************************************/
ubin16 A2DRead(unsigned char Channel)
{
// Set the channel to read and start the scan.
ADCTL1.b.C = Channel;
ADCTL1.b.SCAN = 1;
 
// Wait until the scan is complete.
while (!ADCSTAT.b.SCF);
 
// Return the result.
return RJURR[Channel];
}
 
/******************************************************************************
* *
* Procedure Name : calibrate *
* *
* Purpose : This function performs a calibration of the gain module *
* for each channel of the Analog MUX of Input Cell 4 on the *
* AN220. After the user selects the desired Calibration- *
* Point, the routine uses a binary search to select the *
* best gain setting to achieve the desired target. *
* *
* Inputs : None. *
* *
* Outputs : None, but the gain table at the top of the file will be *
* updated as the calibration sequence progresses.
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial Version. *
* *
******************************************************************************/
void calibrate(void)
{
static double CalibrationPoint = -1.0;
unsigned char ChannelLoop;
double GainMax;
double GainMin;
double GainMid;
double OutPos;
double OutNeg;
double DiffVoltage;
int keypressed;
 
// Initialize the A2D converter.
A2DInit();
 
// Get the desired CalibrationPoint from the user. Since we are using an
// inverting gain module, we will be looking for a negative differential
// voltage on the output.
do
{
printf("\nCalib to: %0.1f",CalibrationPoint);
while ((keypressed = get_key()) == 0);
switch (keypressed)
{
case 3 : {
CalibrationPoint += 1.0;
}
break;
case 4 : {
CalibrationPoint += 0.1;
}
break;
case 5 : {
CalibrationPoint -= 0.1;
}
break;
case 6 : {
CalibrationPoint -= 1.0;
}
break;
default: break;
}
// Limit our calibration point to the -4.0 to 0.0 range.
if (CalibrationPoint > 0.0) CalibrationPoint = 0.0;
if (CalibrationPoint < -4.0) CalibrationPoint = -4.0;
}
while (keypressed != 2);
 
// Now do the calibration sequence on each channel
for (ChannelLoop = 0; ChannelLoop < 4; ChannelLoop++)
{
// Set our limits for the binary search.
GainMax = 100.0;
GainMin = 0.01;
GainMid = 50.0;
 
// Update the module for the channel and the initial gain try.
an_setPadSelect(an_chip1_InputCell4, MuxBit(ChannelLoop));
an_setGain(an_chip1_GainInv, GainMid);
 
UpdateChip(an_chip1);
 
// Allow the chip a little time to settle.
delay(50);
 
// Read the A/D channels for the Output Positive and Negative pads.
// Note that the VRH voltage on the Anadigm Digital Board appears to go to
// 3.577 Volts when the A/D is turned on. This gives us our maximum voltage
// that we can read on each pin.
OutPos = A2DRead(0) * (3.577 / 1024.0);
OutNeg = A2DRead(2) * (3.577 / 1024.0);
 
// Subtract the positive from the negative to give us our actual voltage.
DiffVoltage = OutPos - OutNeg;
 
// While there is a > 0.01 Volt difference between actual and target, keep iterating.
while (fabs(DiffVoltage - CalibrationPoint) > 0.01)
{
// Show a little status of what's going on.
printf("\nG:%0.2f V:%0.2f",GainMid,DiffVoltage);
 
// Determine if we need to adjust GainMax or GainMin.
if (CalibrationPoint < 0.0)
{
if (DiffVoltage < CalibrationPoint)
GainMax = GainMid;
else
GainMin = GainMid;
}
else
{
if (DiffVoltage > CalibrationPoint)
GainMax = GainMid;
else
GainMin = GainMid;
}
 
// Recalculate our new target...
GainMid = GainMin + ((GainMax - GainMin) / 2);
 
// And update the chip.
an_setGain(an_chip1_GainInv, GainMid);
UpdateChip(an_chip1);
delay(50);
 
// Read the A/D converters again and see what we've got.
OutPos = A2DRead(0) * (3.577 / 1024.0);
OutNeg = A2DRead(2) * (3.577 / 1024.0);
DiffVoltage = OutPos - OutNeg;
}
 
// When we reach this point, we've calculated a value for the gain module that works.
// We'll now update the table.
GainSetArray[ChannelLoop] = GainMid;
 
}
 
// After everything is finished, tell the user that we're done...
printf("\nCal done!");
 
// ...and wait for them to press a key to exit.
while (!get_key());
}
 
/******************************************************************************
* *
* Procedure Name : main *
* *
* Purpose : This is our main function for the program. After initial- *
* izing the AN220, it gets keypresses from the user, and *
* acts according to the switch pressed. *
* *
* Inputs : None. *
* *
* Outputs : None. The function never returns. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial Version. *
* *
******************************************************************************/
void main(void)
{
int keypressed;
unsigned short int update = 0;
int currentAnalogChannel = 0;
int RotateMode = 0;
int SecondCount = 0;
 
// Initialize the Keyboard
init_keys();
 
// Initialize the reconfiguration buffer for the chip
an_InitializeReconfigData(an_chip1);
 
// Do the primary configuration for the chip.
PrimaryConfigChip(an_chip1);
 
// Show where things stand right now...
printf("\nCh: %c Gain: %0.2f",(char)currentAnalogChannel + 'A',
GainSetArray[currentAnalogChannel]);
 
while (1)
{
// Check switches to see if any change has taken place
if (keypressed = get_key())
{
// Determine which switch was pressed...
switch (keypressed)
{
case 1 : {
// Enter/Exit Rotate Mode
RotateMode = !RotateMode;
}
break;
case 2 : {
// Calibrate the gain module
calibrate();
update = 1;
}
break;
// The next two control the level of the gain module for the particular channel we're on.
case 3 : if (!RotateMode)
{
if (GainSetArray[currentAnalogChannel] <= 99.5)
{
GainSetArray[currentAnalogChannel] += 0.5;
update = 1;
}
}
break;
case 4 : if (!RotateMode)
{
if (GainSetArray[currentAnalogChannel] > 0.51)
{
GainSetArray[currentAnalogChannel] -= 0.5;
update = 1;
}
}
break;
// The last two control the Analog MUX pad on Input Cell 4.
case 5 : if (!RotateMode)
{
currentAnalogChannel++;
if (currentAnalogChannel == 4)
currentAnalogChannel = 0;
update = 1;
}
break;
case 6 : if (!RotateMode)
{
currentAnalogChannel--;
if (currentAnalogChannel < 0)
currentAnalogChannel = 3;
update = 1;
}
break;
default : break;

}
 
 
}
 
// If we're in rotate mode, switch if the flag has changed, and we've counted enough.
if (RotateMode && TFLG1.b.TOF)
{
TFLG1.b.TOF = 0;
SecondCount++;
if (SecondCount == 100)
{
SecondCount = 0;
currentAnalogChannel++;
if (currentAnalogChannel == 4)
currentAnalogChannel = 0;
update = 1;
}
}
 
// If we have an update for the AN220...
if (update)
{
// ...Change the Analog MUX if necessary...
if ((RotateMode) || (keypressed == 5) || (keypressed == 6) || (keypressed == 2))
an_setPadSelect(an_chip1_InputCell4, MuxBit(currentAnalogChannel));
 
// ...Update the gain...
an_setGain(an_chip1_GainInv, GainSetArray[currentAnalogChannel]);
 
// ...And update the chip.
UpdateChip(an_chip1);
 
// Finally, update the user.
printf("\nCh: %c Gain: %0.2f",(char)currentAnalogChannel + 'A', GainSetArray[currentAnalogChannel]);
}
update = 0;
}
}
#ifndef ubin32
#define ubin32 unsigned long int
#endif
 
#ifndef ubin16
#define ubin16 unsigned short int
#endif
 
#ifndef ubin8
#define ubin8 unsigned char
#endif
 
#ifndef sbin32
#define sbin32 signed long int
#endif
 
#ifndef sbin16
#define sbin16 signed short int
#endif
 
#ifndef sbin8
#define sbin8 signed char
#endif
#include "IPmoduleCode.h"
 
/********************************************************************\
* AnadigmDesigner C Code *
*--------------------------------------------------------------------*
* *
* File: IPmoduleCode.c *
* Circuit: Untitled *
* Generated: March 05, 2002: 04:48 PM *
* *
\********************************************************************/
 
/*##################################################################*\
# #
# INPUT_IO_CELL.ipm #
# #
\*##################################################################*/
 
/*================================================================*\
) Input (
\*================================================================*/
 
/*--------------------------------------------------------------*\
| setPadSelect |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| This function sets the input channel of the analog mux on |
| input cell 4. |
| |
| |
| Instance Name nModuleID nChipID |
| ------------------------------------------------------------ |
| InputCell4 an_chip1_InputCell4 an_chip1 |
| |
\*--------------------------------------------------------------*/
 
void an_setPadSelect(an_byte nModuleID, an_PadSelect nSelect)
{
an_ChangePadSelect(nModuleID, nSelect);
}
 
 
/*##################################################################*\
# #
# GainInv.ipm #
# #
\*##################################################################*/
 
/*================================================================*\
) Gain (
\*================================================================*/
 
/*--------------------------------------------------------------*\
| setGain |
+----------------------------------------------------------------+
| |
| Description |
| ------------------------------ |
| A full floating point method for setting the gain of this |
| module. |
| |
| |
| Instance Name nModuleID nChipID |
| ------------------------------------------------------------ |
| GainInv an_chip1_GainInv an_chip1 |
| |
\*--------------------------------------------------------------*/
 
double an_setGain(an_byte nModuleID, double G)
{
double aG;
int C1 = 1, C2 = 1;
int dC1, dC2=255;
double err =99999;
double bestErr = 999;
 
while ( dC2 >0 )
{
dC1 = an_adjustCap(nModuleID, G*dC2);
aG = 1.0 * dC1/dC2 ;
bestErr = fabs( ( G - aG) / G);
if( bestErr < err )
{
err = bestErr;
C1 = dC1;
C2 = dC2;
}
dC2 --;
}
aG = 1.0* C1/C2;
an_SetCapValue(nModuleID, an_AN20_StandardGainInv_Cin,C1);
an_SetCapValue(nModuleID, an_AN20_StandardGainInv_aCin,C1);
an_SetCapValue(nModuleID, an_AN20_StandardGainInv_Cout,C2);
an_SetCapValue(nModuleID, an_AN20_StandardGainInv_aCout,C2);
return aG;
}
 
/*////////////////////////////////////////////////////////////////*\
| Required Functions For GainInv.ipm |
\*////////////////////////////////////////////////////////////////*/
 
/*------------------------------------------------------------*\
Returns the 8-bit integer cap value.
\*------------------------------------------------------------*/
int an_adjustCap(an_byte nModuleID, double Cap)
{
int fixedCap;
if ( Cap < 1.0 ) fixedCap = 1;
else if ( Cap > 255.0 ) fixedCap = 255;
else fixedCap = (int)(Cap+0.5);
return fixedCap;
}
 
#ifndef IPMODULECODE_H
#define IPMODULECODE_H
 
#include "ApiCode.h"
 
/********************************************************************\
* AnadigmDesigner C Code *
*--------------------------------------------------------------------*
* *
* File: IPmoduleCode.h *
* Circuit: Untitled *
* Generated: March 05, 2002: 04:48 PM *
* *
\********************************************************************/
 
#ifdef __cplusplus
extern "C" {
#endif
 
/*##################################################################*\
# #
# INPUT_IO_CELL.ipm #
# #
\*##################################################################*/
 
/*================================================================*\
) Input (
\*================================================================*/
 
/*--------------------------------------------------------------*\
| setPadSelect |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
void an_setPadSelect(an_byte nModuleID, an_PadSelect nSelect);
/* *\
| |
| Description |
| ------------------------------ |
| This function sets the input channel of the analog mux on |
| input cell 4. |
| |
| |
| Instance Name nModuleID nChipID |
| ------------------------------------------------------------ |
| InputCell4 an_chip1_InputCell4 an_chip1 |
| |
\*--------------------------------------------------------------*/
 
 
/*##################################################################*\
# #
# GainInv.ipm #
# #
\*##################################################################*/
 
/*================================================================*\
) Gain (
\*================================================================*/
 
/*--------------------------------------------------------------*\
| setGain |
+----------------------------------------------------------------+
| |
| Function Declaration |
\* ------------------------------ */
double an_setGain(an_byte nModuleID, double G);
/* *\
| |
| Description |
| ------------------------------ |
| A full floating point method for setting the gain of this |
| module. |
| |
| |
| Instance Name nModuleID nChipID |
| ------------------------------------------------------------ |
| GainInv an_chip1_GainInv an_chip1 |
| |
\*--------------------------------------------------------------*/
 
/*////////////////////////////////////////////////////////////////*\
| Required Functions For GainInv.ipm |
\*////////////////////////////////////////////////////////////////*/
 
/*------------------------------------------------------------*\
Returns the 8-bit integer cap value.
\*------------------------------------------------------------*/
int an_adjustCap(an_byte nModuleID, double Cap);
 
 
#ifdef __cplusplus
}
#endif
 
#endif /* IPMODULECODE_H */
#include "916y3.h"
#include "lcddisp.h"
 
#define LCD_clock(); {LCDDISPLAY.b.E = 1; PORTG = LCDDISPLAY.w; \
PORTG &= 0xF7; LCDDISPLAY.b.E = 0; }
 
/**********************************************************************
*
* This module controls a 1-line by 16-character LCD display attached
* to the Anadigm Development System Digital Board.
*
**********************************************************************/
 
// This structure will allow us to control, if needed, the individual
// control lines going to the LCD display.
typedef struct
{
unsigned char unused : 1;
unsigned char RS : 1;
unsigned char RW : 1;
unsigned char E : 1;
unsigned char DB : 4;
} sLCDDisplay;
 
typedef union
{
unsigned char w;
sLCDDisplay b;
} uLCDDisplay;
 
uLCDDisplay LCDDISPLAY;
 
_FAR unsigned char PORTG @0xFFA0C;
 
// Let's us remember where the cursor is on the display
static unsigned char cursor_pos;
 
/**********************************************************************
* *
* Procedure Name : usec40delay *
* *
* Purpose : This is a timed, 40 usec delay loop. *
* *
* Inputs : None. *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 MAR 2002 - LRS - Initial check-in *
* *
**********************************************************************/
void usec40delay(void)
{
_asm("\tpshb\n\tldab #150\nloop:\tdecb\n\tbne loop\n\tpulb\n");
}
 
/**********************************************************************
* *
* Procedure Name : msecdelay *
* *
* Purpose : This function acts as a pseudo-timer delay. The *
* timing of the loops has not been accurately *
* measured. *
* *
* Inputs : unsigned char msec - The number of milliseconds *
* to delay. *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 MAR 2002 - LRS - Initial check-in *
* *
**********************************************************************/
void msecdelay(unsigned char msec)
{
unsigned long loop = 25 * msec;
 
while (loop--)
{
usec40delay();
}
}
 
/**********************************************************************
* *
* Procedure Name : LCD_init *
* *
* Purpose : This function initializes the LCD display, to *
* allow it to operate when we need it. *
* *
* Inputs : None. *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial check-in *
* *
**********************************************************************/
void LCD_init(void)
{
delay(15);
LCD_8control(0x30);
delay(5);
LCD_8control(0x30);
delay(1);
LCD_8control(0x30);
LCD_8control(0x20);
 
LCD_control(0x28);
LCD_control(0x06);
LCD_clear();
LCD_control(0x0C);
}
 
/**********************************************************************
* *
* Procedure Name : LCD_control *
* *
* Purpose : This function sends a control byte to the LCD *
* Display. *
* *
* Inputs : unsigned char data - The control byte to send. *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial check-in *
* *
**********************************************************************/
void LCD_control(unsigned char data)
{
LCDDISPLAY.b.RS = 0;
LCDDISPLAY.b.RW = 0;
LCDDISPLAY.b.DB = data >> 4; /* upper nibble first */
 
LCD_clock();
 
usec40delay();
 
LCDDISPLAY.b.DB = data;
LCD_clock();
 
usec40delay();
}
 
/**********************************************************************
* *
* Procedure Name : LCD_8control *
* *
* Purpose : This routine handles sending a control byte when *
* the LCD display is only handling 8-bit transfers. *
* *
* Inputs : unsigned char data - The control byte to send. *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial check-in *
* *
**********************************************************************/
void LCD_8control(unsigned char data)
{
LCDDISPLAY.b.RS = 0;
LCDDISPLAY.b.RW = 0;
 
LCDDISPLAY.b.DB = data >> 4;
 
LCD_clock();
 
usec40delay();
}
 
/**********************************************************************
* *
* Procedure Name : LCD_display *
* *
* Purpose : This function sets certain characteristics about *
* the LCD Display. Specifically, it sets how many *
* lines are in the Display, whether the Cursor is *
* visible, and whether the Cursor Blinks. *
* *
* Inputs : unsigned char Display - Turn the Display on? *
* unsigned char Cursor - Is the cursor visible? *
* unsigned char Blink - Does the cursor blink? *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial check-in *
* *
**********************************************************************/
void LCD_display(unsigned char Display,
unsigned char Cursor,
unsigned char Blink)
{
LCD_control(0x08 + (Display << 2) + (Cursor << 1) + Blink);
}
 
/**********************************************************************
* *
* Procedure Name : LCD_functionset *
* *
* Purpose : This function controls the initial *
* characteristics of the LCD display, including *
* 8/4-bit interface, and the number of lines in the *
* display. *
* *
* Inputs : unsigned char interface - 1 = 8-bit, 0 = 4-bit *
* unsigned char lines - 1 = Dual line, 0 = Single *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial check-in *
* *
**********************************************************************/
void LCD_functionset(unsigned char interface, unsigned char lines)
{
LCD_control(0x20 + (interface << 4) + ((lines - 1) << 3));
}
 
/**********************************************************************
* *
* Procedure Name : LCD_data *
* *
* Purpose : This function displays a character on the LCD *
* display. *
* *
* Inputs : unsigned char data - The data to show on the *
* display. *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial check-in *
* *
**********************************************************************/
void LCD_data(unsigned char data)
{
if (cursor_pos == 8)
LCD_control(0xC0);
 
LCDDISPLAY.b.RS = 1;
LCDDISPLAY.b.RW = 0;
LCDDISPLAY.b.DB = data >> 4;
 
LCD_clock();
LCDDISPLAY.b.DB = data;
 
LCD_clock();
 
usec40delay();
usec40delay();
 
LCDDISPLAY.b.RS = 0;
 
PORTG = LCDDISPLAY.w;
 
usec40delay();
usec40delay();
 
cursor_pos++;
}
 
/**********************************************************************
* *
* Procedure Name : LCD_clear *
* *
* Purpose : This function clears the LCD Display, and resets *
* the cursor to the home position. *
* *
* Inputs : None. *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial check-in *
* *
**********************************************************************/
void LCD_clear(void)
{
LCD_control(0x01);
msecdelay(3);
LCD_control(0x80);
cursor_pos = 0;
}
 
/**********************************************************************
* *
* Procedure Name : LCD_home *
* *
* Purpose : This function sets the cursor to the home *
* position without clearing the display contents. *
* *
* Inputs : None. *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial check-in *
* *
**********************************************************************/
void LCD_home(void)
{
LCD_control(0x02);
msecdelay(3);
LCD_control(0x80);
cursor_pos = 0;
}
 
/**********************************************************************
* *
* Procedure Name : LCD_prints *
* *
* Purpose : This function acts like the prints standard *
* library function, but outputs the string to the *
* LCD display. *
* *
* Inputs : unsigned char *string - The string to display. *
* *
* Outputs : None. *
* *
* Revision History : *
* 04 Mar 2002 - LRS - Initial check-in *
* *
**********************************************************************/
void LCD_prints(unsigned char *string)
{
while (*string != '\0')
LCD_data(*string++);
}
#ifndef LCDDISP_H
#define LCDDISP_H
 
void LCD_init(void);
void LCD_clear(void);
void LCD_home(void);
void LCD_display(unsigned char, unsigned char, unsigned char);
void LCD_functionset(unsigned char, unsigned char);
void LCD_data(unsigned char);
void LCD_control(unsigned char);
void LCD_8control(unsigned char);
void LCD_prints(unsigned char *);
 
 
 
#endif
/**********************************************************************
* *
* Program: MUXDEMO *
* *
* Author: Anadigm - LRS *
* *
* Description: This program demonstrates controlling the input cell *
* MUX through C Code. *
* *
* Copyright (C) 2002 Anadigm Ltd. All rights reserved. *
* *
**********************************************************************/
 
#include <stdlib.h>
#include "916y3.h"
#include "qspi.h"
 
/**********************************************************************
* *
* Procedure Name : init_QSPI *
* *
* Purpose : This function initializes the QSPI and gets it *
* set up for Master Mode. *
* *
* Inputs : None *
* *
* Outputs : None *
* *
* Revision History : *
* 11/01/01 - LRS - Initial Creation *
* *
**********************************************************************/
 
void init_QSPI(void)
{
QSMCR.b.IARB = 15;
QILR.b.ILQSPI = 7;
QIVR = 0x1C;
 
DDRQS.b.DDQS0 = 0;
DDRQS.b.DDQS1 = 1;
DDRQS.b.DDQS2 = 1;
DDRQS.b.DDQS3 = 1;
DDRQS.b.DDQS4 = 1;
DDRQS.b.DDQS5 = 1;
DDRQS.b.DDQS6 = 1;
 
PORTQS.w = 0xF8;
 
PQSPAR.b.PQSPA0 = 1;
PQSPAR.b.PQSPA1 = 1;
PQSPAR.b.PQSPA3 = 1;
PQSPAR.b.PQSPA4 = 1;
PQSPAR.b.PQSPA5 = 1;
PQSPAR.b.PQSPA6 = 1;
 
SPCR0.b.SPBR = 2;
SPCR0.b.MSTR = 1;
SPCR0.b.CPHA = 0;
 
SPCR1.b.SPE = 0;
 
SPCR2.b.WREN = 0;
SPCR2.b.SPIFIE = 0;
 
memset(CR, 0xC0, 16);
}
 
void qspi_send_byte(unsigned char c)
{
qspi_wait();
 
CR[0].w = 0x80;
 
TR_16[0] = (ubin16) c;
 
SPCR2.b.NEWQP = 0;
SPCR2.b.ENDQP = 0;
 
SPCR1.b.SPE = 1;
 
// CR[0].w = 0xC0;
}
 
int qspi_send_buffer(unsigned short *buffer, unsigned int num_bytes)
{
unsigned char blocksize;
 
memset(CR, 0xC0, 16);
 
SPCR2.b.NEWQP = 0;
SPCR2.b.ENDQP = 15;
 
while (num_bytes)
{
blocksize = (num_bytes >= 32 ? 32 : num_bytes);
 
qspi_wait();
 
memcpy(TR_16, buffer, blocksize);
 
if (blocksize < 32)
{
if (blocksize & 0x01)
{
CR[blocksize >> 1].b.BITSE = 0;
TR_16[blocksize >> 1] >>= 8;
}
 
CR[(blocksize-1) >> 1].b.CONT = 0;
// TR_16[(blocksize-1) >> 1] >>= 8;
SPCR2.b.ENDQP = (blocksize - 1) >> 1;
}
 
SPCR1.b.SPE = 1;
 
num_bytes -= blocksize;
buffer += (blocksize >> 1);
}
}
#ifndef qspi_h
#define qspi_h
 
#define qspi_wait() while (SPCR1.b.SPE)
 
void init_QSPI(void);
void qspi_send_byte(unsigned char);
int qspi_send_buffer(unsigned short *, unsigned int);
 
#endif
インタープリット可能なコード化アルゴリズムを含むモジュールからのコンパイル可能なコードの抽出と形成とを示す機能ブロック図である。 図1の機能を実行した後で行う、実行時の比較/選択装置の機能を示す機能ブロック図である。 ある特定の実施形態で図2の合成選択装置エンジンが使用するロジックの流れを示すフローチャートであり、図3A、図3B、図3Cより構成される。 ある特定の実施形態で図2の条件付き選択装置エンジンが使用するロジックの流れを示すフローチャートである。 事前コンパイル型コード、またはインタープリタ型コードを使用するかどうかを決定するための、ある実施形態で選択装置エンジンが実行するステップのフローチャートである。 参照テーブル(LUT)を形成するために実行するステップのフローチャートである。 ある実施形態によるプロセス制御CADツールでの、本発明による方法および装置の使用を示す機能ブロック図である。 フィールド・プログラマブル・アナログ・アレイを設計するための設計およびシミュレーション・ツールと一緒に使用する構成可能なアナログ・モジュールを示す機能ブロック図である。 図8のタイプの構成可能なアナログ・モジュールからのコンパイル可能なコードの抽出および形成を示す機能ブロック図である。 図9の機能を実行した後で行う、実行時の比較および選択装置の機能を示す機能ブロック図である。 どのコードをインタープリットしたか、またどのコードをコンパイルしたかを示すダイアログ・ボックスを示す回路設計ツール・スクリーンの一例である。

Claims (40)

  1.  複数のインタープリット可能なコード化アルゴリズムを含む少なくとも1つのモジュールを供給するステップと、
     前記インタープリット可能なコード化アルゴリズムからコンパイル可能なコード化アルゴリズムを生成するステップと、
     前記インタープリット可能なコード化アルゴリズムから、コンパイル可能なコード化アルゴリズムをインタープリット可能なコード化アルゴリズムと比較するための比較準備完了アルゴリズム・コードを生成するステップと、
     インタープリット可能なコード化アルゴリズムをコンパイル可能なコード化アルゴリズムと機能的に比較するように構成された選択装置エンジンを生成するステップと、
     前記機能的な比較の結果をコンパイラ型コード化アルゴリズムに関連付けるために、前記コンパイル可能なコード化アルゴリズムと前記比較準備完了アルゴリズム・コードとの間にリンケージを形成するステップと、
     前記コンパイル可能なコード化アルゴリズムから、コンパイラ型コード化アルゴリズムを生成するステップとを含む方法。
  2.  前記比較準備完了アルゴリズム・コードから実行可能なコードを生成するステップをさらに含む、請求項1に記載の方法。
  3.  前記コンパイル可能なコード化アルゴリズムと前記比較準備完了アルゴリズム・コードとの間のリンケージから実行可能なコードを生成するステップをさらに含む、請求項1に記載の方法。
  4.  実行可能な形の前記選択装置エンジンを定義するために、前記選択装置エンジンから実行可能なコードを生成するステップをさらに含む、請求項1に記載の方法。
  5.  インタープリット可能なコード化アルゴリズムを供給するステップと、
     実行可能なコード化アルゴリズムを供給するステップと、
     前記インタープリット可能なコード化アルゴリズムが、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断するステップと、
     前記インタープリット可能なコード化アルゴリズムのインタープリットと、前記実行可能なコード化アルゴリズムの実行のうちの一方を選択的に実行するステップとを含む方法。
  6.  前記インタープリット可能なコード化アルゴリズムが、すべての状況下で、前記実行可能なコード化アルゴリズムと機能的に等価である場合に、無条件に前記実行可能なコード化アルゴリズムを使用するステップをさらに含む、請求項5に記載の方法。
  7.  前記インタープリット可能なコード化アルゴリズムが、どのような状況下でも、前記実行可能なコード化アルゴリズムに機能的に等価でない場合、前記インタープリット可能なコード化アルゴリズムを無条件にインタープリットするステップをさらに含む、請求項5に記載の方法。
  8.  前記インタープリット可能なコード化アルゴリズムが、どのような状況下でも、前記実行可能なコード化アルゴリズムと機能的に等価でない場合、前記インタープリット可能なコード化アルゴリズムを無条件にインタープリットするステップをさらに含む、請求項6に記載の方法。
  9.  どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムに機能的に等価でない場合、前記インタープリット可能なコードをインタープリットするステップをさらに含む、請求項5に記載の方法。
  10.  どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムに機能的に等価である場合、前記実行可能なコードを使用するステップをさらに含む、請求項5に記載の方法。
  11.  どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムに機能的に等価でない場合、前記インタープリット可能なコードをインタープリットするステップをさらに含む、請求項8に記載の方法。
  12.  どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムに機能的に等価である場合、前記実行可能なコードを使用するためのステップさらにを含む、請求項8に記載の方法。
  13.  複数の実行可能なコード化アルゴリズムを供給するステップと、
     前記インタープリット可能なコード化アルゴリズムが、前記実行可能なコード化アルゴリズムのどれかと機能的に等価であるかどうかを判断するためのステップとを含む、請求項5に記載の方法。
  14.  インタープリット可能なコード化アルゴリズムを供給するステップと、
     複数の実行可能なコード化アルゴリズムを供給するステップと、
     産業用制御プロセスを設計するためのコンピュータ援用設計ツールで、前記インタープリット可能なコード化アルゴリズムが、前記実行可能なコード化アルゴリズムと機能的に等価であるかどうかを判断するステップと、
     すべての状況下において、前記インタープリット可能なコード化アルゴリズムが、前記実行可能なコード化アルゴリズムと機能的に等価である場合、前記実行可能なコード化アルゴリズムを無条件で使用するステップと、
     前記インタープリット可能なコード化アルゴリズムが、どのような状況下でも、前記実行可能なコード化アルゴリズムに機能的に等価でない場合、前記インタープリット可能なコード化アルゴリズムを無条件でインタープリットするステップとを含む方法。
  15.  どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムに機能的に等価でない場合、前記インタープリット可能なコードをインタープリットするステップをさらに含む、請求項14に記載の方法。
  16.  どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムの中の1つに機能的に等価である場合、前記実行可能なコードを使用するステップをさらに含む、請求項15に記載の方法。
  17.  インタープリット可能なコード化アルゴリズムを供給するステップと、
     複数の実行可能なコード化アルゴリズムを供給するステップと、
     電気回路を設計するためのコンピュータ援用設計ツールで、前記インタープリット可能なコード化アルゴリズムが、前記実行可能なコード化アルゴリズムと機能的に等価であるかどうかを判断するステップと、
     すべての状況下において、前記インタープリット可能なコード化アルゴリズムが、前記実行可能なコード化アルゴリズムと機能的に等価である場合には、前記実行可能なコード化アルゴリズムを無条件で使用するステップと、
     前記インタープリット可能なコード化アルゴリズムが、どのような状況下でも、前記実行可能なコード化アルゴリズムに機能的に等価でない場合、前記インタープリット可能なコード化アルゴリズムを無条件でインタープリットするステップとを含む方法。
  18.  どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムに機能的に等価でない場合、前記インタープリット可能なコードをインタープリットするステップをさらに含む、請求項17に記載の方法。
  19.  どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムの中のどれかと機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムの中の1つに機能的に等価である場合、前記実行可能なコードを使用するステップをさらに含む、請求項18に記載の方法。
  20.  前記コンピュータ援用設計ツールからフィールド・プログラマブル・アナログ・アレイに回路設計をアップロードするステップをさらに含む、請求項19に記載の方法。
  21.  複数のインタープリット可能なコード化アルゴリズムを含む少なくとも1つのモジュールと、
     前記インタープリット可能なコード化アルゴリズムからコンパイル可能なコード化アルゴリズムを生成するための手段と、
     前記インタープリット可能なコード化アルゴリズムから、コンパイル可能なコード化アルゴリズムをインタープリット可能なコード化アルゴリズムと比較するための比較準備完了アルゴリズム・コードを生成するための手段と、
     インタープリット可能なコード化アルゴリズムをコンパイル可能なコード化アルゴリズムと機能的に比較するように構成された選択装置エンジンと、
     前記機能的な比較の結果をコンパイラ型コード化アルゴリズムに関連付けるために、前記コンパイル可能なコード化アルゴリズムと前記比較準備完了アルゴリズム・コードとの間にリンケージを形成するための手段と、
     前記コンパイル可能なコード化アルゴリズムから、コンパイラ型コード化アルゴリズムを生成するための手段とを備えるシステム。
  22.  さらに、前記比較準備完了アルゴリズム・コードから実行可能なコードを生成するための手段を備える、請求項21に記載のシステム。
  23.  さらに、前記コンパイル可能なコード化アルゴリズムと前記比較準備完了アルゴリズム・コードとの間のリンケージから実行可能なコードを生成するための手段を備える、請求項21に記載のシステム。
  24.  さらに、実行可能な形の前記選択装置エンジンを定義するために、前記選択装置エンジンから実行可能なコードを生成するための手段を備える、請求項21に記載の方法。
  25.  インタープリット可能なコード化アルゴリズムを備え、
     実行可能なコード化アルゴリズムを供給し、
     前記インタープリット可能なコード化アルゴリズムが、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、
     前記インタープリット可能なコード化アルゴリズムのインタープリットと、前記実行可能なコード化アルゴリズムの実行のうちの一方を選択的に実行するシステム。
  26.  さらに、前記インタープリット可能なコード化アルゴリズムが、すべての状況下で、前記実行可能なコード化アルゴリズムと機能的に等価である場合に、無条件に前記実行可能なコード化アルゴリズムを使用するための手段を備える、請求項25に記載のシステム。
  27.  さらに、前記インタープリット可能なコード化アルゴリズムが、どのような状況下でも、前記実行可能なコード化アルゴリズムに機能的に等価でない場合、前記インタープリット可能なコード化アルゴリズムを無条件にインタープリットするための手段を備える、請求項25に記載のシステム。
  28.  さらに、前記インタープリット可能なコード化アルゴリズムが、どのような状況下でも、前記実行可能なコード化アルゴリズムと機能的に等価でない場合、前記インタープリット可能なコード化アルゴリズムを無条件にインタープリットするための手段を備える、請求項26に記載のシステム。
  29.  さらに、どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムに機能的に等価でない場合、前記インタープリット可能なコードをインタープリットするための手段を備える、請求項25に記載のシステム。
  30.  さらに、どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムに機能的に等価である場合、前記実行可能なコードを使用するための手段を備える、請求項25に記載のシステム。
  31.  さらに、どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムに機能的に等価でない場合、前記インタープリット可能なコードをインタープリットするための手段を備える、請求項28に記載のシステム。
  32.  さらに、どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムに機能的に等価である場合、前記実行可能なコードを使用するための手段を備える、請求項28に記載のシステム。
  33.  複数の実行可能なコード化アルゴリズムを供給するための手段と、
     前記インタープリット可能なコード化アルゴリズムが、前記実行可能なコード化アルゴリズムのどれかと機能的に等価であるかどうかを判断するための手段とを備える、請求項25に記載のシステム。
  34.  インタープリット可能なコード化アルゴリズムと、
     複数の実行可能なコード化アルゴリズムと、
     産業用制御プロセスを設計するためのコンピュータ援用設計ツールとを備え、
     前記インタープリット可能なコード化アルゴリズムが、前記実行可能なコード化アルゴリズムと機能的に等価であるかどうかを判断し、
     すべての状況下において、前記インタープリット可能なコード化アルゴリズムが、前記実行可能なコード化アルゴリズムと機能的に等価である場合には、前記実行可能なコード化アルゴリズムを無条件で使用し、
     前記インタープリット可能なコード化アルゴリズムが、どのような状況下でも、前記実行可能なコード化アルゴリズムに機能的に等価でない場合、前記インタープリット可能なコード化アルゴリズムを無条件でインタープリットするように構成されているシステム。
  35.  前記コンピュータ援用設計ツールが、さらに、どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムに機能的に等価でない場合、前記インタープリット可能なコードをインタープリットするように構成されている、請求項34に記載のシステム。
  36.  前記コンピュータ援用設計ツールが、さらに、どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムの中の1つに機能的に等価である場合、前記実行可能なコードを使用するように構成されている、請求項35に記載のシステム。
  37.  インタープリット可能なコード化アルゴリズムと、
     複数の実行可能なコード化アルゴリズムと、
     電気回路を設計するためのコンピュータ援用設計ツールとを備え、
     前記インタープリット可能なコード化アルゴリズムが、前記実行可能なコード化アルゴリズムと機能的に等価であるかどうかを判断し、
     すべての状況下において、前記インタープリット可能なコード化アルゴリズムが、前記実行可能なコード化アルゴリズムと機能的に等価である場合には、前記実行可能なコード化アルゴリズムを無条件で使用し、
     前記インタープリット可能なコード化アルゴリズムが、どのような状況下でも、前記実行可能なコード化アルゴリズムに機能的に等価でない場合、前記インタープリット可能なコード化アルゴリズムを無条件でインタープリットするように構成されているシステム。
  38.  前記コンピュータ援用設計ツールが、さらに、どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムに機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムに機能的に等価でない場合、前記インタープリット可能なコードをインタープリットするように構成されている、請求項37に記載のシステム。
  39.  前記コンピュータ援用設計ツールが、さらに、どのコード経路および変数がアクセスされたかにより、前記インタープリット可能なコード化アルゴリズムが、ある場合に、前記実行可能なコード化アルゴリズムの中のどれかと機能的に等価であるかどうかを判断し、機能的に等価である場合であって、前記インタープリット可能なコード化アルゴリズムが、特定の実行のためにアクセスした特定のコード経路および変数に対する前記実行可能なコード化アルゴリズムの中の1つに機能的に等価である場合、前記実行可能なコードを使用するように構成されている、請求項38に記載のシステム。
  40.  前記コンピュータ援用設計ツールが、さらに、前記コンピュータ援用設計ツールからフィールド・プログラマブル・アナログ・アレイに回路設計をアップロードするように構成されている、請求項39に記載の方法。
JP2003300902A 2002-08-29 2003-08-26 シミュレータをスピードアップするためのコンパイラ型コードの生成 Withdrawn JP2004094951A (ja)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
US40704002P 2002-08-29 2002-08-29
US10/359,329 US20040044988A1 (en) 2002-08-29 2003-02-05 Generation of compiled code for simulator speed up

Publications (1)

Publication Number Publication Date
JP2004094951A true JP2004094951A (ja) 2004-03-25

Family

ID=31498259

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003300902A Withdrawn JP2004094951A (ja) 2002-08-29 2003-08-26 シミュレータをスピードアップするためのコンパイラ型コードの生成

Country Status (3)

Country Link
US (1) US20040044988A1 (ja)
EP (1) EP1394677A3 (ja)
JP (1) JP2004094951A (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008070368A (ja) * 2006-09-11 2008-03-27 Dspace Digital Signal Processing & Control Engineering Gmbh 電子制御システムをテストする方法

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7340717B2 (en) * 2002-09-24 2008-03-04 Agilent Technologies, Inc. Method for providing enhanced dynamic system simulation capability outside the original modeling environment
US6936598B2 (en) * 2003-11-21 2005-08-30 Hill's Pet Nutrition, Inc. Composition and method
US8131612B1 (en) * 2005-05-09 2012-03-06 Genesis Financial Products, Inc. Program generator for hedging the guaranteed benefits of a set of variable annuity contracts
US8843884B1 (en) * 2009-11-23 2014-09-23 Jason Adam Koerner Interactive graphical construction of parametric components of typical cross section frameworks
US20130024836A1 (en) * 2010-11-22 2013-01-24 Jason Adam Koerner Interactive Graphical Construction of Parametric Components of Typical Cross Section Frameworks
US9262566B2 (en) * 2012-03-09 2016-02-16 The Mathworks, Inc. Fast simulation of a radio frequency circuit
US8918771B2 (en) * 2012-09-25 2014-12-23 Facebook, Inc. Decision tree ensemble compilation
US9459986B2 (en) * 2013-08-28 2016-10-04 International Business Machines Corporation Automatic generation of analysis-equivalent application constructs
RU2634171C1 (ru) 2016-12-12 2017-10-24 Акционерное общество "Лаборатория Касперского" Способ выполнения кода интерпретатором
EP3333746B1 (en) * 2016-12-12 2019-05-29 AO Kaspersky Lab System and method of execution of code by an interpreter
US11526772B2 (en) * 2019-02-11 2022-12-13 Cotiviti, Inc. Accelerated reasoning graph evaluation

Family Cites Families (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4903199A (en) * 1988-04-19 1990-02-20 Texas Instruments Incorporated Method of increasing the speed of test program execution for testing electrical characteristics of integrated circuits
US5987181A (en) * 1995-10-12 1999-11-16 Sharp Kabushiki Kaisha Coding and decoding apparatus which transmits and receives tool information for constructing decoding scheme
US5887165A (en) * 1996-06-21 1999-03-23 Mirage Technologies, Inc. Dynamically reconfigurable hardware system for real-time control of processes
US5838165A (en) * 1996-08-21 1998-11-17 Chatter; Mukesh High performance self modifying on-the-fly alterable logic FPGA, architecture and method
US5931959A (en) * 1997-05-21 1999-08-03 The United States Of America As Represented By The Secretary Of The Air Force Dynamically reconfigurable FPGA apparatus and method for multiprocessing and fault tolerance
US6311149B1 (en) * 1997-08-18 2001-10-30 National Instruments Corporation Reconfigurable test system
US6078736A (en) * 1997-08-28 2000-06-20 Xilinx, Inc. Method of designing FPGAs for dynamically reconfigurable computing
US6272669B1 (en) * 1997-12-15 2001-08-07 Motorola, Inc. Method for configuring a programmable semiconductor device
US6230307B1 (en) * 1998-01-26 2001-05-08 Xilinx, Inc. System and method for programming the hardware of field programmable gate arrays (FPGAs) and related reconfiguration resources as if they were software by creating hardware objects
US6289506B1 (en) * 1998-06-30 2001-09-11 Intel Corporation Method for optimizing Java performance using precompiled code
US6298477B1 (en) * 1998-10-30 2001-10-02 Sun Microsystems, Inc. Method and apparatus for selecting ways to compile at runtime
GB9825102D0 (en) * 1998-11-16 1999-01-13 Insignia Solutions Plc Computer system
US6324687B1 (en) * 1998-12-03 2001-11-27 International Business Machines Corporation Method and apparatus to selectively control processing of a method in a java virtual machine
US6484313B1 (en) * 1999-06-30 2002-11-19 Microsoft Corporation Compiling and persisting of intermediate language code
US6560774B1 (en) * 1999-09-01 2003-05-06 Microsoft Corporation Verifier to check intermediate language
US6604210B1 (en) * 1999-09-09 2003-08-05 International Business Machines Corporation Method and system for detecting and recovering from in trace data
US20010042241A1 (en) * 2000-01-21 2001-11-15 Fujitsu Limited Apparatus and method for executing program using just-in time-compiler system
US6625797B1 (en) * 2000-02-10 2003-09-23 Xilinx, Inc. Means and method for compiling high level software languages into algorithmically equivalent hardware representations
JP3808755B2 (ja) * 2001-11-07 2006-08-16 富士通株式会社 Jitコンパイラを備えた仮想計算機
US6907598B2 (en) * 2002-06-05 2005-06-14 Microsoft Corporation Method and system for compressing program code and interpreting compressed program code

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008070368A (ja) * 2006-09-11 2008-03-27 Dspace Digital Signal Processing & Control Engineering Gmbh 電子制御システムをテストする方法

Also Published As

Publication number Publication date
US20040044988A1 (en) 2004-03-04
EP1394677A3 (en) 2006-01-04
EP1394677A2 (en) 2004-03-03

Similar Documents

Publication Publication Date Title
TW539965B (en) Automated processor generation system for designing a configurable processor and method for the same
EP1766544B1 (en) Execution of hardware description language (hdl) programs
Kim et al. Macsim: A cpu-gpu heterogeneous simulation framework user guide
JP2003323463A5 (ja)
KR20050001472A (ko) 소프트웨어 개발 툴 생성 방법
JP2004094951A (ja) シミュレータをスピードアップするためのコンパイラ型コードの生成
US8429394B1 (en) Reconfigurable computing system that shares processing between a host processor and one or more reconfigurable hardware modules
Schoeberl JOP reference handbook: building embedded systems with a java processor
Silvano et al. The ANTAREX tool flow for monitoring and autotuning energy efficient HPC systems
Tanaka et al. mruby--Rapid Software Development for Embedded Systems
Matthews et al. MosaicSim: A lightweight, modular simulator for heterogeneous systems
Dorta et al. Basic skeletons in llc
US9558305B1 (en) Automatic modeling, mapping, and code generation for homogeneous and heterogeneous platforms
Stripf et al. A compilation-and simulation-oriented architecture description language for multicore systems
Logaras et al. Python to accelerate embedded SoC design: A case study for systems biology
Payvar et al. Instruction extension of a risc-v processor modeled with ip-xact
Goudarzi et al. Object-Oriented ASIP Design and Synthesis.
Mück et al. Seamless integration of HW/SW components in a HLS-based SoC design environment
Araujo et al. Platform designer: An approach for modeling multiprocessor platforms based on SystemC
August et al. A disciplined approach to the development of platform architectures
Currie et al. PSoC Creator
Ferrandi et al. A Survey on Design Methodologies for Accelerating Deep Learning on Heterogeneous Architectures
Cao et al. Compiler backend generation for application specific instruction set processors
Tsoeunyane et al. An IP core integration tool-flow for prototyping software-defined radios using static dataflow with access patterns
Attarzadeh-Niaki et al. A composable and predictable MPSoC design flow for multiple real-time applications

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20061107