LPC1114FN28/102 (11) -- IRQLATENCY レジスタ (4)

ARM 社発行の文書

Application Note 226
Using the Cortex-M0 on the
Microcontroller Prototyping
System

には、「HMALC-AS3」という「Microcontroller Prototyping System」についての説明が記述されています。
その実体は、「CPU FPGA」と「DUT FPGA」と称する 2 つの FPGA を持ち、CPU FPGA 側に ARM 社から供給される Cortex-M3 や Cortex-M0 の IP を書き込み、DUT FPGA 側に周辺モジュールをインプリメントして、マイクロコントローラとして動作させるものです。
FPGA 上に実装するなら、それは「Cortex-M1」じゃないの?という疑問が浮かびますが、Cortex-M0 チップを開発する半導体メーカーが使用するプロトタイピング・ツールであるならば Cortex-M0 で正しいことになります。
もし、そうであるなら、一般ユーザには関係ない文書ということになりますが、文書としては「オープン・アクセス」で配布に制限がないという位置づけになっています。
供給される Cortex-M0 コアは、あらかじめ特定のハードウェア・コンフィギュレーションで構成されており、その項目についての説明が記載されています。
ソフトウェアで動的に設定可能なコンフィギュレーションとして、「IRQLATENCY」レジスタの信号が IP コアから引き出されており、その説明も記載されています。
IRQLATENCY に関する記述部分を引用します。

4.4 Interrupts

The ARM Cortex-M0 processor can guarantee deterministic instruction execution and jitter free interrupt behavior for Zero-Wait-State memory systems when the IRQLATENCY input is correctly configured. If you are developing a system that requires deterministic execution or jitter free interrupt behavior, use the information in this chapter to remove or minimize wait states.

The Cortex-M0 processor includes an input bus IRQLATENCY to control the minimum number of clock cycles the processor will take to service an interrupt request. On the MPS platform, the SYS_CPUCFG register allows the user to program the value of IRQLATENCY.

The optimal value for IRQLATENCY is system dependant. For zero jitter interrupt behavior in a zero wait state system, IRQLATENCY should be tied to the decimal value 13. For non zero wait state systems, this value should be increased by the worst case number of wait states. For example, when the maximum wait state is N, the IRQLATENCY should be set to 13+N to get zero jitter behavior.

If you do not require zero-jitter interrupt behavior, IRQLATENCY should be tied to 0, and the Cortex-M0 processor will service interrupts as quickly as possible. By default the IRQLATENCY value is set to 0.

この中で重要なのは、

  • ゼロ・ウェイト・システムでは IRQLATENCY を「13」に設定すれば「ジッタ・フリー」となり、
  • N ウェイト・システムでは「13 + N」に設定すれば良い

という記述です。
前回の実測結果では、IRQLATENCY が 11 以上でジッタがなくなりましたが、系統的な誤差を考えると、上の記述と矛盾しないと言えます。
次回は Cortex-M3 プロセッサ (STM32F100RBT) について Cortex-M0 と同様の実測を行ってみた結果を示します。