JP2004302827A - Microcontroller - Google Patents
Microcontroller Download PDFInfo
- Publication number
- JP2004302827A JP2004302827A JP2003094686A JP2003094686A JP2004302827A JP 2004302827 A JP2004302827 A JP 2004302827A JP 2003094686 A JP2003094686 A JP 2003094686A JP 2003094686 A JP2003094686 A JP 2003094686A JP 2004302827 A JP2004302827 A JP 2004302827A
- Authority
- JP
- Japan
- Prior art keywords
- frequency
- instruction
- code
- division ratio
- clock
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F1/00—Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
- G06F1/04—Generating or distributing clock signals or signals derived directly therefrom
- G06F1/06—Clock generators producing several clock signals
Abstract
Description
【0001】
【発明の属する技術分野】
本発明は、システムクロックに同期して動作し、ROM等のメモリ上の命令プログラムに対し、パイプライン処理によりフェッチ、解読および実行するマイクロコントローラに関する。
【0002】
【従来の技術】
低消費電力化の観点でマイクロコントローラを用いたシステムを見直した場合、すべてのタスクにおいてマイクロコントローラの最高周波数での動作が必要とされるわけではない。要は、システムのパフォーマンスを落とさない最低限の動作周波数であればよい。
【0003】
一般的なマイクロコントローラにおいてはこのような場合を想定し、原発振からシステムクロックを生成する過程で分周比を変更できる構成としている。
【0004】
従来のマイクロコントローラでは、分周比の制御はアドレスマッピングされたレジスタへの任意データの設定によって行われることが多いが、このような構成の場合、消費電力、動作周波数を細やかな制御を試みても書き込みのための命令実行サイクル分の時間的ロスが発生してしまうことが障害になり、意図した周波数制御および電力制御の効果が得られない場合がある。これら課題の対策として、一方ではアクセスしたメモリ空間に応じて周波数を変更しているものもある(例えば特許文献1参照)。しかしながら、変更すべき周波数に割り当てられたメモリ空間へのジャンプ命令の実行が必要になるためいずれにしても完全な課題解決には至っていない。
【0005】
以上のような従来のマイクロコントローラについて、以下に説明する。図10、図11は、従来のマイクロコントローラの概略構成を示すブロック図であり、図10はその内部のクロックジェネレータの構成を詳細に示し、図11はその内部のCPUの構成を詳細に示したものである。
【0006】
図10において、1000はマイクロコントローラであり、100はCPUである。ROM700とはバスを介して接続され、クロックジェネレータ800とはバスを介した接続以外にクロックジェネレータ800からシステムクロックsysclkが入力されマイクロコントローラ1000はこのsysclkに同期して動作する。クロックジェネレータ800は原発振oscinを入力とし、クロック分周回路801、セレクタ802、クロック分周制御回路803、クロック分周制御レジスタ804から構成される。クロック分周回路801はoscinを分周し、1分周信号の他複数の分周信号を生成する。クロック分周制御レジスタ804はCPU100の処理する命令によってリード/ライト可能なレジスタで設定されるデータによってクロック分周回路801で生成される分周信号のうちひとつを選択する情報を保持する。クロック分周制御回路803はクロック分周制御レジスタ804に設定されたデータをもとにクロック切り替えのタイミングを調整し、セレクタ802の制御信号oscselを出力する。セレクタ802はoscselに従いクロック分周回路801から出力される分周信号の中からひとつを選択し、sysclkとしてCPU100に伝達する。
【0007】
図11において、CPU100は、命令デコーダ400、データパス300、データレジスタ500、アドレスレジスタ600、バスインターフェイス200から構成され、CPU内部でのデータのやり取りはバスインターフェイス200を介して行い、CPUの動作はマイクロコード(MIR)によって制御される。次に、上記のように構成されたマイクロコントローラについて、8ビットマイクロコントローラを例にその一般的な動作を以下に説明する。
【0008】
まず、ROM700から入力されたデータは、バスインターフェイス200を経由して、命令デコーダ400内のインストラクションフェッチバッファ(IFB)401に取り込まれ、インストラクションバッファ(IB)402を経由し、その後、オペレーションコードとオペランドに分割される。
【0009】
IB402から出力されたオペレーションコードは、インストラクションレジスタ(IR)403に入力された後、プログラマブルロジックアレイ(PLA)404に解読され、MIRとしてバスインターフェイス200、データパス300、命令デコーダ400の各構成ブロックへ供給され、各構成ブロックは、入力されたMIRに従った処理動作を実行する。
【0010】
またIB402から出力されたオペランドは、MIRに従って、データパス300あるいはデータレジスタ600やアドレスレジスタ700などへ伝達される。
【0011】
システムクロックsysclkの分周比を変更するにはアドレスマッピングされたクロック分周制御レジスタ804に対して各分周比に相当する設定値を書き込むことでクロック分周制御回路803で切り替えタイミングを調整し、選択信号oscselをセレクタ802に出力し、それに応じてセレクタ802では分周信号を選択し、sysclkとしてCPU100に伝達する。
【0012】
以上のような従来のマイクロコントローラの動作をプログラム例、タイミングチャートを用いて説明する。
【0013】
図12の(a)、(b)、(c)は、従来のマイクロコントローラの命令フォーマット、プログラム例、動作タイミングチャートである。
【0014】
命令フォーマットは、命令マップのページ数を示す4ビットの拡張コードと、8ビットのオペコード(オペレーションコード)と、4×nビット(n=1,2・・・)のオペランドとで構成される。
【0015】
プログラム例は▲1▼から▲7▼の命令を実行するものとし、sysclkをoscinの1分周で命令▲1▼を実行した後、命令▲2▼により分周比を1分周から2分周に切り替える。命令▲3▼および▲4▼を実行した後、命令▲5▼により再度1分周に戻し命令▲6▼および命令▲7▼を実行する。タイミングチャート中に示される記号で▲1▼−1はプログラム例の命令▲1▼の1ニブル目のマシンコードを示し、▲1▼μ−1は命令▲1▼の実行サイクル1サイクル目を表すものとする。T1、T2は各々sysclkの立下りエッジ、立ち上がりエッジのタイミングを示す。タイミングAにおいてoscselが‘L’であるためsysclkは1/1oscinの周期で動作する。IFB401、IB402はT1で命令▲1▼−1と▲1▼−2をROM700からフェッチする。命令▲1▼−1は拡張コード、▲1▼−2はオペコードの1ニブル目でありオペランドではないためいずれのデータもIR403に対して出力する。タイミングBにおいてIR403はT2で▲1▼−1,2をラッチし、PLA404に出力しPLA404はデコードを開始する。▲1▼−1は拡張コードであり、▲1▼−2はオペコードの2ニブル目がフェッチされるまで処理されないため、タイミングCにおいて次のT1では▲1▼−1に相当するMIR(▲1▼μ−1)のみを拡張コードの認識サイクルとして出力する。また同時にIFB401は命令▲1▼−3と▲2▼−1をフェッチする。タイミングDにおいてIR403は命令▲1▼の残り1ニブルのオペコード▲1▼−3を取り込み、処理待ちの▲1▼−2とともにPLA404にてデコードする。タイミングEにおいては▲1▼−2,3のMIR(▲1▼μ−2)を出力するとともに▲2▼−2,3をIFB401がフェッチする。また、タイミングDでIR403に取り込まれなかった▲2▼−1はタイミングEでIB402にシフトする。なお、▲3▼−1のように拡張コードがIFB401、IB402を経由した場合にはその間に認識されるためタイミングFではIR403には取り込まれず、オペコードである▲3▼−2,3がIR403に取り込まれる。
【0016】
命令▲2▼では実行サイクル▲2▼μ−3でのクロック分周制御レジスタ804への書き込みによってタイミングGでoscselが‘H’になり、sysclkの周期を1/1oscinから1/2oscinに変更する。同様に命令▲5▼によってsysclkの周期を1/2oscinから1/1oscinに戻す。
【0017】
以上のように従来のマイクロコントローラはクロック分周制御レジスタ804への書き込み命令によって周波数を制御することができる。
【0018】
【特許文献1】
特開平02−118811号公報
【0019】
【発明が解決しようとする課題】
しかしながら上記のような従来のマイクロコントローラにおいては、周波数の変更のためにレジスタへの書き込み命令実行のために数サイクル分が必要となる。これによって、周波数制御による消費電力の調整をシステムのパフォーマンスを維持したままきめ細かく行うことができないという問題点を有していた。
【0020】
本発明は、上記従来の問題点を解決するもので、周波数変更に要するタイムラグを解消することができ、タスクに応じた周波数制御を的確かつ迅速に実行することにより、消費電力を低減化することができるマイクロコントローラを提供する。
【0021】
【課題を解決するための手段】
本発明の請求項1記載のマイクロコントローラは、発振周波数の1/n(nは分周比で1以上の整数)の周波数であって異なる周波数の複数のクロック信号の中から周波数情報に応じたクロック信号をシステムクロックとして入力し、システムクロックに同期して動作し、メモリに格納されたオペレーションコードとオペランドからなる命令プログラムに対して、パイプライン処理によりオペレーションコードとオペランドをフェッチして解読し、その解読結果に基づいて命令プログラムを実行するプロセッサを備え、オペレーションコードはシステムクロックの分周比を決定する周波数制御信号が付加されてメモリに格納されており、プロセッサは、周波数制御信号をオペレーションコードとともにパイプライン処理によりフェッチ、解読することにより周波数制御信号に応じた周波数情報を出力することを特徴とする。
【0022】
この構成によれば、周波数を制御する情報はパイプラインの中でオペレーションコードと同様に処理されるため、従来のように周波数制御レジスタへ設定データを書き込む必要がなく、システムのパフォーマンスを落とさず周波数制御をきめ細かく行い、マイクロコントローラの低消費電力化を効果的に実現することができる。
【0023】
また、本発明の請求項2記載のマイクロコントローラは、発振周波数の1/n(nは分周比で1以上の整数)の周波数であって異なる周波数の複数のクロック信号の中から周波数情報に応じたクロック信号をシステムクロックとして入力し、システムクロックに同期して動作し、メモリに格納された拡張コードとオペレーションコードとオペランドからなる命令プログラムに対して、パイプライン処理により拡張コードとオペレーションコードとオペランドをフェッチして解読し、その解読結果に基づいて命令プログラムを実行するプロセッサを備え、マシンコードによってオペレーションコードを各分周比に対応してページに分類された複数ページからなる命令マップとして構成し、オペレーションコードとともにパイプライン処理される拡張コードが命令マップのページを示し、プロセッサは、拡張コードをパイプライン処理によりフェッチ、解読することにより拡張コードが示す命令マップのページに対応する分周比に応じた周波数情報を出力することを特徴とする。
【0024】
この構成によれば、既存の拡張コードエリアが周波数制御情報をもつため、回路規模の増加はなく、オペレーションコードより先にデコードされることにより周波数変更すべき命令の実行サイクルと周波数変更タイミングを合わせやすく、より的確にプログラム開発者の意図に応じた低消費電力化が可能となる。
【0025】
また、請求項3記載のマイクロコントローラのように、請求項1または2記載のマイクロコントローラにおいて、発振周波数の1/n(nは分周比で1以上の整数)の周波数であって異なる周波数の複数のクロック信号を生成し、その中からプロセッサから出力される周波数情報に応じたクロック信号を選択してプロセッサへシステムクロックとして出力するクロックジェネレータを設けてあってもよい。
【0026】
また、このクロックジェネレータは、請求項4のように、発振周波数の1/n(nは分周比で1以上の整数)の周波数であって異なる周波数の複数のクロック信号を出力する分周手段と、分周手段の出力する複数のクロック信号の中から選択信号に基づいて1つのクロック信号を選択しシステムクロックとして出力する選択手段と、プロセッサから出力される周波数情報に対応する選択信号を選択手段に出力する制御手段とを有した構成とすることができる。
【0027】
また、請求項5記載のマイクロコントローラは、請求項1記載のマイクロコントローラにおいて、ソースプログラムに記述されたシステムクロックの分周比を決定する分周比設定記述に従って周波数制御信号を生成し、分周比設定記述の後段の命令から生成されるオペレーションコードに付加しROMコード化する手段を設けている。
【0028】
これにより、周波数制御信号のオペレーションコードへの付加はプログラム開発者の負担なくコンパイラによって自動でマシンコード化が可能となる。
【0029】
また、請求項6記載のマイクロコントローラは、請求項1記載のマイクロコントローラにおいて、ソースプログラムに記述されたシステムクロックの分周比を決定する分周比設定記述に従って周波数制御信号を生成し、分周比設定記述の前段の命令の実行サイクル数が基準未満であれば周波数制御信号を分周比設定記述の前段の命令から生成されるオペレーションコードに付加し、基準以上であれば周波数制御信号を分周比設定記述の後段の命令から生成されるオペレーションコードに付加しROMコード化する手段を設けている。
【0030】
これにより、周波数制御信号がオペレーションコードとともにデコードされ実行されるまでの処理時間による周波数変更すべき命令の実行サイクルと周波数変更タイミングの誤差を削減することが可能となる。
【0031】
また、請求項7記載のマイクロコントローラは、請求項2記載のマイクロコントローラにおいて、ソースプログラムに記述されたシステムクロックの分周比を決定する分周比設定記述に従って分周比に対応する拡張コードを選択し、拡張コードが示す命令マップのページから分周比設定記述の後段の命令に相当するオペレーションコードを選択しROMコード化する手段を設けている。
【0032】
これにより、システムクロックの分周比の設定、その分周比に相当する命令コードの選択は固有の分周比設定記述によりプログラム開発者の負担なくコンパイラによって自動でマシンコード化が可能となる。
【0033】
【発明の実施の形態】
以下、本発明の実施の形態について、図面を参照しながら具体的に説明する。
【0034】
(実施の形態1)
本発明の実施の形態1のマイクロコントローラについて説明する。図1、図2は、本実施の形態1のマイクロコントローラの概略構成を示すブロック図であり、図1はその内部のクロックジェネレータの構成を詳細に示し、図2はその内部のCPUの構成を詳細に示したものである。
【0035】
図1において、1000はマイクロコントローラであり、100はCPUである。CPU100とROM700とはバスを介して接続され、クロックジェネレータ800は原発振oscinを入力とし、クロック分周回路801、セレクタ802、クロック分周制御回路803から構成され、CPU100から出力されるマイクロコードMIRからシステムクロックsysclkの分周比を決定し、CPU100に伝達する。マイクロコントローラ1000はこのsysclkに同期して動作する。クロック分周回路801は原発振oscinを分周し、1分周信号の他複数の分周信号を生成する。クロック分周制御回路803はCPU100から出力されたMIRをもとにクロック切り替えのタイミングを調整し、セレクタ802の制御信号oscselを出力する。セレクタ802はoscselに従いクロック分周回路801から出力される分周信号の中からひとつを選択し、sysclkとしてCPU100に伝達する。
【0036】
図2において、CPU100は、命令デコーダ400、データパス300、データレジスタ500、アドレスレジスタ600、バスインターフェイス200から構成され、CPU内部でのデータのやり取りはバスインターフェイス200を介して行い、CPUの動作はマイクロコード(MIR)によって制御される。
【0037】
次に、上記のように構成された実施の形態1のマイクロコントローラの動作を説明する。
【0038】
まず、ROM700から入力されたデータは、バスインターフェイス200を介して命令デコーダ400内のインストラクションフェッチバッファ(IFB)401に取り込まれ、インストラクションバッファ(IB)402を経由し、その後オペレーションコードとオペランドに分割される。
【0039】
IB402から出力されたオペレーションコードは、インストラクションレジスタ(IR)403に入力された後、プログラマブルロジックアレイ(PLA)404に解読され、MIRとしてバスインターフェイス200、データパス300、命令デコーダ400の各構成ブロックへ供給され、各構成ブロックは、入力されたMIRに従った処理動作を実行する。
【0040】
また、IB402から出力されたオペランドは、MIRに従って、データパス300あるいはデータレジスタ600やアドレスレジスタ700などへ伝達される。
【0041】
システムクロックsysclkの分周比を変更するメカニズムは、オペレーションコードに付加された周波数制御信号をオペレーションコードとともに解読し、MIRとしてクロック分周制御回路803に伝達される。クロック分周制御回路803においては伝達されたMIRをもとに切り替えタイミングを調整し、選択信号oscselをセレクタ802に出力し、セレクタ802で分周信号を選択し、sysclkとしてCPU100に伝達する。
【0042】
以上のような本実施の形態1のマイクロコントローラの動作をプログラム例、タイミングチャートを用いて説明する。
【0043】
図3の(a)、(b)、(c)は、本実施の形態1のマイクロコントローラの命令フォーマット、プログラム例、動作タイミングチャートである。ここでは8ビットマイクロコントローラを例にsysclkの分周比をoscinの1分周から2分周そして再度1分周に切り替える動作を示している。
【0044】
命令フォーマットは、命令マップのページ数を示す4ビットの拡張コードと、8ビットのオペコード(オペレーションコード)と、オペコードに付加した1ビットの周波数制御信号と、4×nビット(n=1,2・・・)のオペランドとで構成される。
【0045】
プログラム例は▲1▼から▲7▼の命令を実行するものとし、命令▲3▼からsysclkの分周比をoscinの1分周から2分周に切り替え、命令▲6▼以降再度1分周に切り替える。オペコードに付加された周波数制御信号は*0または*1で表し、*0のとき1分周を、*1のとき2分周を選択するものとする。タイミングチャート中に示される記号で▲1▼−1はプログラム例の命令▲1▼の1ニブル目のマシンコードを示し、▲1▼μ−1は命令▲1▼の実行サイクルの1サイクル目を表すものとする。T1、T2は各々sysclkの立下りエッジ、立ち上がりエッジのタイミングを示す。
【0046】
タイミングAにおいてoscselが‘L’であるためsysclkは1/1oscinの周期で動作する。IFB401、IB402はT1で命令▲1▼−1と▲1▼−2をROM700からフェッチする。命令▲1▼−1は拡張コード、▲1▼−2はオペコードの1ニブル目でありオペランドではないためいずれのデータもIR403に対して出力する。タイミングBにおいてIR403はT2で▲1▼−1,2をラッチし、PLA404に出力しPLA404はデコードを開始する。▲1▼−1は拡張コードであり、▲1▼−2はオペコードの2ニブル目がフェッチされるまで処理されないため、タイミングCにおいて次のT1では▲1▼−1に相当するMIR(▲1▼μ−1)のみを拡張コードの認識サイクルとして出力する。また同時にIFB401は命令▲1▼−3と▲3▼−1をフェッチする。タイミングDにおいてIR403は命令▲1▼の残り1ニブルのオペコード▲1▼−3を取り込み、処理待ちの▲1▼−2とともにPLA404にてデコードする。タイミングEにおいては▲1▼−2,3のMIR(▲1▼μ−2)を出力するとともに▲3▼−2,3をIFB401がフェッチする。また、タイミングDでIR403に取り込まれなかった▲3▼−1はタイミングEでIB402にシフトする。なお、▲3▼−1のように拡張コードがIFB401、IB402を経由した場合にはその間に認識されるためタイミングFではIR403には取り込まれず、オペコードである▲3▼−2,3がIR403に取り込まれる。
【0047】
▲3▼−3は付加された周波数制御信号に2分周制御の情報(*1)を保有しているため▲3▼μ−1のサイクル中にMIRとしてクロックジェネレータ800に出力される。クロック分周制御回路803は切り替えタイミングを調整しタイミングGでoscselを‘H’としsysclkを1/2oscinに切り替える。同様に命令▲6▼に付加された周波数制御信号によって1/1oscinに戻す。
【0048】
なお、付加される周波数制御信号は1ビットに限らずマイクロコントローラの仕様によって数ビットになる場合もある。
【0049】
以上のように本実施の形態1によれば、オペレーションコードにシステムクロックの分周比を決定する周波数制御信号を付加することにより、オペレーションコードと同様にパイプラインの中で処理されるため、従来のように周波数制御レジスタ(804)へ設定データを書き込む時間を必要とせず、システムのパフォーマンスを落とさずマイクロコントローラの低消費電力化を効果的に実現することができる。また、本実施の形態では8ビットマイクロコントローラを例に説明しているが、ビット数が多くなれば付加するビットの回路規模への影響は極めて小さなものになり、本発明の効果はさらに大きくなる。
【0050】
(実施の形態2)
本発明の実施の形態2のマイクロコントローラについて説明する。
【0051】
図4は、本実施の形態2のマイクロコントローラの概略構成を示すブロック図である。実施の形態1との違いはIFB401、IB402、IR403、PLA404と伝達されるオペレーションコードに周波数制御信号を付加しないため8ビットで構成される点のみで、その他は実施の形態1のマイクロコントローラと同様である。したがって、クロックジェネレータ800の内部構成は図1と同じである。
【0052】
次に、上記のように構成された実施の形態2のマイクロコントローラの動作を説明する。
【0053】
図5の(a)、(b)は、本実施の形態2のマイクロコントローラの命令マップ例である。命令マップは複数ページで構成され、分周比ごとに各ページに分類されている。したがって、命令マップのページ数を示す拡張コードによって同じオペレーションコードであっても異なる周波数で実行されることになる。例えば命令マップAと命令マップBはそれぞれ1分周と2分周に対応しており拡張コード‘0011’および‘0101’で分類している。マップ中のMC1とMC2はともに同じ実行内容の命令で拡張コード以外のマシンコードも同一である。これらのコードをCPUで処理した場合、同じ動作をMC1は1分周で行い、MC2は2分周で行うことになる。このように分周比に対応した拡張コードはパイプライン処理の中でオペコードと同様に解読され、MIRとしてクロック分周制御回路803に伝達される。クロック分周制御回路803においては伝達されたMIRをもとに切り替えタイミングを調整し、選択信号oscselをセレクタ802に出力し、それに応じてセレクタ802では分周信号を選択し、sysclkとしてCPU100に伝達する。
【0054】
以上のような本実施の形態2のマイクロコントローラの動作をプログラム例、タイミングチャートを用いて説明する。
【0055】
図6の(a)、(b)、(c)は、本実施の形態2のマイクロコントローラの命令フォーマット、プログラム例、動作タイミングチャートである。ここでは実施の形態1のマイクロコントローラにおける動作説明と同様に8ビットマイクロコントローラを例にsysclkの分周比をoscinの1分周から2分周そして再度1分周に切り替える動作を示している。
【0056】
命令フォーマットは、命令マップのページ数を示す4ビットの拡張コードと、8ビットのオペコード(オペレーションコード)と、4×nビット(n=1,2・・・)のオペランドとで構成される。実施の形態1のマイクロコントローラとの違いは周波数制御信号を付加していない点のみである。
【0057】
プログラム例は▲1▼から▲7▼の命令を実行するものとし、命令▲3▼からsysclkの分周比をoscinの1分周から2分周に切り替え、命令▲6▼以降再度1分周に切り替える。拡張コードの‘0011’はsysclkをoscinの1分周に設定する命令であることを示し、‘0101’2分周であることを示す。
【0058】
タイミングAにおいてoscselが‘L’であるためsysclkは1/1oscinの周期で動作する。IFB401、IB402はT1で命令▲1▼−1と▲1▼−2をROM700からフェッチする。命令▲1▼−1は拡張コード、▲1▼−2はオペコードの1ニブル目でありオペランドではないためいずれのデータもIR403に対して出力する。タイミングBにおいてIR403はT2で▲1▼−1,2をラッチし、PLA404に出力しPLA404はデコードを開始する。▲1▼−1は拡張コードであり、▲1▼−2はオペコードの2ニブル目がフェッチされるまで処理されないため、タイミングCにおいて次のT1では▲1▼−1に相当するMIR(▲1▼μ−1)のみを拡張コードの認識サイクルとして出力する。また同時にIFB401は命令▲1▼−3と▲3▼−1をフェッチする。タイミングDにおいてIR403は命令▲1▼の残り1ニブルのオペコード▲1▼−3を取り込み、処理待ちの▲1▼−2とともにPLA404にてデコードする。タイミングEにおいては▲1▼−2,3のMIR(▲1▼μ−2)を出力するとともに▲3▼−2,3をIFB401がフェッチする。また、タイミングDでIR403に取り込まれなかった▲3▼−1はタイミングEでIB402にシフトする。なお、▲3▼−1のように拡張コードがIFB401、IB402を経由した場合にはその間に認識されるためタイミングFではIR403には取り込まれず、オペコードである▲3▼−2,3がIR403に取り込まれる。
【0059】
▲3▼−1は拡張コードであり2分周制御の情報‘0101’を保有しており、IFB401、IB402を経由する間に解読されMIRとしてクロックジェネレータ800に出力される。クロック分周制御回路803は切り替えタイミングを調整しタイミングGでoscselを‘H’としsysclkを1/2oscinに切り替える。同様に命令▲6▼の拡張コードによって1/1oscinに戻す。拡張コードはオペコードより先にフェッチ、デコードされるため本来2分周で動作させたい▲3▼μ−1、▲3▼μ−2、▲4▼μ−1、▲4▼μ−2、1分周で動作させたい▲6▼μ−1、▲7▼μ−1、▲7▼μ−2が想定どおりに実行することが可能である。
【0060】
以上のように本実施の形態2によれば、拡張コードにシステムクロックの分周比を決定する情報を持たせることにより、オペレーションコードより早いサイクルでデコードすることが可能となるため、周波数を変更するためのタイムラグを最小に抑えることが可能となり、プログラム開発者は周波数制御をより簡単に正確に実行することが可能となる。したがって、周波数変更に要するタイムラグを解消しタスクに応じた周波数制御を的確かつ迅速に実行することによりマイクロコントローラの消費電力を低減することができる。
【0061】
なお、命令は1分周と2分周の2種類に限らずマイクロコントローラの仕様によって数種類になる場合もある。また、命令数は分周比ごとに同数存在する必要はなく、例えばデフォルトの分周比に相当する命令に対してその他の分周比に相当する命令数は数個に限定することも可能である。
【0062】
上記の実施の形態1と実施の形態2におけるマイクロコントローラ1000では、一般的なほとんどのマイクロコントローラと同様に、システムクロックを生成するクロックジェネレータ800を内蔵している構成としたが、クロックジェネレータ800は外付けであっても構わない。
【0063】
(実施の形態3)
本発明の実施の形態3のマイクロコントローラについて説明する。
【0064】
図7(a)は本実施の形態3のマイクロコントローラにおけるマシンコードの生成およびROMへの配置手順を示すフローチャート、図7(b)は本実施の形態3においてプログラムソースからコンパイラによってマシンコードを生成する方法を示す図である。図7(a)に示すように、プログラム開発によって作成されたプログラムソースは、通常コンパイラ等により発生されたデータファイルをもとに、ROMコードに変換された後、レイアウトパターンとして生成されROM配置される。しかし、従来のマシンコード生成フローでは、実施の形態1におけるマイクロコントローラのようにマシンコードに周波数制御信号を付加することはできない。
【0065】
本実施の形態3のマシンコード生成フローでは、プログラムソース内に分周比設定記述を挿入することでマシンコードに周波数制御信号を付加することができる。例えば、図7(b)のプログラム例のように命令▲1▼、▲3▼、▲4▼、▲6▼、▲7▼の順にプログラミングし、命令▲1▼、▲6▼、▲7▼は1分周で実行し、命令▲3▼、▲4▼は2分周で実行させたい場合、命令▲1▼の前段に‘set fast’と記述し、命令▲3▼の前段に‘set slow’、命令▲6▼の前段に‘set fast’と記述する。コンパイラは命令とその前段の‘set fast’あるいは‘set slow’の情報を入力として、命令をマシンコードに変換し、さらに前段の分周設定記述が‘set fast’であれば‘0’をオペコードに付加し、‘set slow’であれば‘1’を付加する。また、命令の前段に何も記述がなければ前のマシンコードの付加信号を継続する。
【0066】
すなわち本実施の形態3のマイクロコントローラは、前述した実施の形態1の構成において、上述のコンパイラと、コンパイラで生成したマシンコードをROMコードに変換する手段と、ROM配置する手段とを備えたものである。
【0067】
以上のように本実施の形態3によれば、周波数制御信号のオペレーションコードへの付加は、プログラム開発者の負担なくコンパイラによって自動でマシンコード化が可能となり、実施の形態1のマイクロコントローラの特徴を活かすことができる。
【0068】
(実施の形態4)
本発明の実施の形態4のマイクロコントローラについて説明する。
【0069】
図8(a)は本実施の形態4のマイクロコントローラにおけるマシンコードの生成およびROMへの配置手順を示すフローチャート、図8(b)は本実施の形態4においてプログラムソースからコンパイラによってマシンコードを生成する方法を示す図、図8(c)は本実施の形態4のマイクロコントローラの動作タイミングチャートである。ROMへの配置手順に関しては実施の形態3と同様であるが、プログラムソースからコンパイラによってマシンコードを生成する過程において生成ルールが異なる。
【0070】
実施の形態3では‘set fast’、‘set slow’によってオペコードに付加する周波数制御信号を決定するが、実施の形態1のマイクロコントローラでは分周比を変更する場合、オペコードに周波数制御信号を付加しているため、フェッチからデコード、実行し、oscselが切り替わるまでにやや時間を必要とする。そのため本来分周比を切り替えたい命令の実行タイミングに間に合わなくなる場合があり、プログラム開発者による周波数制御の詳細検討が必要となる。
【0071】
本実施の形態のマシンコード生成フローでは、実施の形態3と同様に命令▲1▼から▲7▼までのマシンコードを生成した場合、分周比設定記述とその前段の命令の実行サイクルをもとに周波数制御信号を決定する。
【0072】
例えば命令▲3▼の前段の‘set slow’は本来命令▲3▼を2分周で動作させる目的で挿入されているが、実施の形態1においては図3のようにオペコードに付加されているためoscselの切り替わりが遅れ、実際には命令▲4▼の実行サイクル(▲4▼μ−1)から切り替わることになる。この場合の対策として、命令▲3▼を2分周で実行するためにはその前の命令▲1▼に2分周制御の付加信号をもたせることによってちょうど▲3▼μ−1の実行タイミングGで2分周に切り替わる。ただし、命令▲1▼の実行サイクルが長い場合には命令▲1▼の処理周波数が2分周となってしまう。本実施の形態4においては、‘set fast’、‘set slow’の前段の命令の実行サイクルが基準サイクル未満であれば前段の命令のマシンコードに付加し、基準サイクル以上であれば後段の命令のマシンコードに付加する。図8の例では、基準サイクルを3サイクルとし、‘set fast’、‘set slow’の前段の命令の実行サイクルが3サイクル未満(すなわち2サイクル以下)であれば前段の命令のマシンコードに付加し、3サイクル以上であれば後段の命令のマシンコードに付加するようにしている。
【0073】
すなわち本実施の形態4のマイクロコントローラは、前述した実施の形態1の構成において、上述のコンパイラと、コンパイラで生成したマシンコードをROMコードに変換する手段と、ROM配置する手段とを備えたものである。
【0074】
以上のように本実施の形態4によれば、周波数制御信号のオペレーションコードへの付加は、命令の実行サイクル数に応じて決定するため、より正確に意図するタイミングで周波数の制御が可能となり、プログラム開発者が実行サイクル数を考慮してプログラミングする必要がないためプログラム開発効率の向上が可能となる。
【0075】
(実施の形態5)
本発明の実施の形態5のマイクロコントローラについて説明する。
【0076】
図9(a)は本実施の形態5のマイクロコントローラにおけるマシンコードの生成およびROMへの配置手順を示すフローチャート、図9(b)は本実施の形態5においてプログラムソースからコンパイラによってマシンコードを生成する方法を示す図である。ROMへの配置手順に関しては実施の形態3と同様であるが、プログラムソースからコンパイラによってマシンコードを生成する過程において生成ルールが異なる。
【0077】
本実施の形態のマシンコード生成フローでは、プログラムソース内に分周比設定記述を挿入することで設定した分周比に対応する拡張コードを選択し、分周比設定記述の後段の命令はその拡張コードによって分類された命令マップの中から相当するマシンコードに変換される。例えば、図9(b)のプログラム例のように命令▲1▼、▲3▼、▲4▼、▲6▼、▲7▼の順にプログラミングし、命令▲1▼、▲6▼、▲7▼は1分周で実行し、命令▲3▼、▲4▼は2分周で実行させたい場合、命令▲1▼の前段に‘set fast’と記述し、命令▲3▼の前段に‘set slow’、命令▲6▼の前段に‘set fast’と記述する。命令マップは1分周で実行する命令群は拡張コードなし、拡張コード‘0010’、拡張コード‘0011’で、2分周で実行する命令群は拡張コード‘0100’、拡張コード‘0101’、拡張コード‘0110’で分類されるとする。本実施の形態5のマイクロコントローラで扱われる命令は実施の形態2で説明した図5の例のように1分周の命令群と2分周の命令群は拡張コード以外は同一のオペコードを持ち、同一の動作をするものとする。コンパイラは命令とその前段の‘set fast’あるいは‘set slow’の情報を入力として、前段が‘set fast’であれば1分周で実行する命令群のマップのマシンコードに変換し、‘set slow’であれば2分周で実行する命令群のマップのマシンコードに変換する。また、命令の前段に何も記述がなければ分周比の変更はないものとし、前段の命令と同じ分周比の命令群のマシンコードに変換する。
【0078】
すなわち本実施の形態5のマイクロコントローラは、前述した実施の形態2の構成において、上述のコンパイラと、コンパイラで生成したマシンコードをROMコードに変換する手段と、ROM配置する手段とを備えたものである。
【0079】
以上のように本実施の形態5によれば、分周比の設定は分周比設定記述の挿入のみでマシンコードに反映することが可能となり、実施の形態2のマイクロコントローラの特徴を最大限活かすプログラム開発環境を提供できる。
【0080】
【発明の効果】
以上のように、本発明によれば、周波数を制御するための情報をオペレーションコードに付加あるいは拡張コードに保有させることで、実行命令のパイプライン処理の中で周波数制御が可能となるため、周波数変更に要するタイムラグを解消しタスクに応じた周波数制御を的確かつ迅速に実行することによりマイクロコントローラの消費電力を低減することができる。
【図面の簡単な説明】
【図1】本発明の実施の形態1のマイクロコントローラの概略構成を示すブロック図
【図2】本発明の実施の形態1のマイクロコントローラの概略構成を示すブロック図
【図3】本発明の実施の形態1のマイクロコントローラの命令フォーマット、プログラム例および動作タイミングチャート
【図4】本発明の実施の形態2のマイクロコントローラの概略構成を示すブロック図
【図5】本発明の実施の形態2のマイクロコントローラの命令マップ説明図
【図6】本発明の実施の形態2のマイクロコントローラの命令フォーマット、プログラム例および動作タイミングチャート
【図7】本発明の実施の形態3のマイクロコントローラにおけるROMコード生成処理を示すフローチャートとその説明図
【図8】本発明の実施の形態4のマイクロコントローラにおけるROMコード生成処理を示すフローチャートとその説明図および動作タイミングチャート
【図9】本発明の実施の形態5のマイクロコントローラにおけるROMコード生成処理を示すフローチャートその説明図
【図10】従来のマイクロコントローラの一般的な概略構成を示すブロック図
【図11】従来のマイクロコントローラの一般的な概略構成を示すブロック図
【図12】従来のマイクロコントローラの命令フォーマット、プログラム例および動作タイミングチャート
【符号の説明】
100 CPU
200 バスインターフェイス
300 データパス
400 命令デコーダ
401 インストラクションフェッチバッファ(IFB)
402 インストラクションバッファ(IB)
403 インストラクションレジスタ(IR)
404 プログラマブルロジックアレイ(PLA)
500 データレジスタ
600 アドレスレジスタ
700 ROM
800 クロックジェネレータ
801 クロック分周回路
802 セレクタ
803 クロック分周制御回路
804 クロック分周制御レジスタ
1000 マイクロコントローラ[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a microcontroller that operates in synchronization with a system clock and fetches, decodes, and executes an instruction program on a memory such as a ROM by pipeline processing.
[0002]
[Prior art]
When a system using a microcontroller is reviewed from the viewpoint of low power consumption, not all tasks require the operation of the microcontroller at the highest frequency. The point is that the operating frequency should be the minimum operating frequency that does not degrade the performance of the system.
[0003]
Such a case is assumed in a general microcontroller, and the configuration is such that the frequency division ratio can be changed in the process of generating the system clock from the original oscillation.
[0004]
In a conventional microcontroller, the division ratio is often controlled by setting arbitrary data in an address-mapped register. In such a configuration, the power consumption and the operating frequency are controlled in a fine manner. Also, the occurrence of a time loss corresponding to the instruction execution cycle for writing becomes an obstacle, and the intended frequency control and power control effects may not be obtained. As a countermeasure against these problems, on the other hand, there is a method in which the frequency is changed according to the accessed memory space (for example, see Patent Document 1). However, since it is necessary to execute a jump instruction to the memory space allocated to the frequency to be changed, the problem has not been completely solved in any case.
[0005]
The conventional microcontroller as described above will be described below. FIGS. 10 and 11 are block diagrams showing a schematic configuration of a conventional microcontroller. FIG. 10 shows the configuration of a clock generator inside the microcontroller in detail, and FIG. 11 shows the configuration of a CPU inside the microcontroller in detail. Things.
[0006]
In FIG. 10,
[0007]
11, the
[0008]
First, data input from the
[0009]
The operation code output from the IB 402 is input to an instruction register (IR) 403 and then decoded by a programmable logic array (PLA) 404. The supplied constituent blocks execute processing operations according to the input MIR.
[0010]
The operand output from IB 402 is transmitted to
[0011]
In order to change the frequency division ratio of the system clock sysclk, the switching timing is adjusted by the clock frequency
[0012]
The operation of the above-described conventional microcontroller will be described with reference to a program example and a timing chart.
[0013]
(A), (b), and (c) of FIG. 12 are an instruction format, a program example, and an operation timing chart of a conventional microcontroller.
[0014]
The instruction format includes a 4-bit extension code indicating the number of pages of the instruction map, an 8-bit operation code (operation code), and 4 × n-bit (n = 1, 2,...) Operands.
[0015]
In the program example, the instructions of (1) to (7) are executed. After executing the instruction (1) by dividing sysclk by 1 for oscin, the dividing ratio is reduced from 1 to 2 by the instruction (2). Switch to Zhou. After executing the commands (3) and (4), the frequency is returned to 1 again by the command (5), and the commands (6) and (7) are executed. In the symbols shown in the timing chart, (1) -1 indicates the machine code of the first nibble of the instruction (1) of the program example, and (1) μ-1 indicates the first execution cycle of the instruction (1). Shall be. T1 and T2 indicate the timing of the falling edge and the rising edge of sysclk, respectively. At the timing A, since osscsel is “L”, sysclk operates at a period of 1/1 oscin. The IFB 401 and the IB 402 fetch the instructions (1) -1 and (1) -2 from the
[0016]
In the instruction (2), osscsel becomes 'H' at timing G by writing to the clock frequency division control register 804 in the execution cycle (2) μ-3, and the cycle of sysclk is changed from 1/1 oscin to 1/2 oscin. . Similarly, the cycle of sysclk is returned from 1/2 oscin to 1/1 oscin by the instruction (5).
[0017]
As described above, the conventional microcontroller can control the frequency by the write command to the clock frequency
[0018]
[Patent Document 1]
Japanese Patent Application Laid-Open No. H02-118811
[0019]
[Problems to be solved by the invention]
However, in the above-described conventional microcontroller, several cycles are required to execute a write instruction to a register in order to change a frequency. As a result, there is a problem that power consumption adjustment by frequency control cannot be finely performed while maintaining the performance of the system.
[0020]
SUMMARY OF THE INVENTION The present invention solves the above-mentioned conventional problems. It is possible to eliminate a time lag required for frequency change, and reduce power consumption by performing frequency control appropriately and quickly according to a task. To provide a microcontroller that can
[0021]
[Means for Solving the Problems]
A microcontroller according to a first aspect of the present invention responds to frequency information from a plurality of clock signals having a frequency of 1 / n (n is an integer of 1 or more in a dividing ratio) of an oscillation frequency and different frequencies. A clock signal is input as a system clock, operates in synchronization with the system clock, and fetches and decodes an operation code and an operand by pipeline processing for an instruction program including an operation code and an operand stored in a memory; A processor for executing an instruction program based on the decoding result is provided, and an operation code is stored in a memory with a frequency control signal for determining a frequency division ratio of a system clock added thereto. Fetch and decode by pipeline processing with And outputs a frequency information corresponding to the frequency control signal by Rukoto.
[0022]
According to this configuration, since the information for controlling the frequency is processed in the pipeline in the same manner as the operation code, it is not necessary to write the setting data to the frequency control register as in the related art, and the frequency is maintained without lowering the performance of the system. Control can be performed finely, and power consumption of the microcontroller can be effectively reduced.
[0023]
The microcontroller according to the second aspect of the present invention converts frequency information from a plurality of clock signals having a frequency of 1 / n (where n is an integer of 1 or more) of the oscillation frequency and different frequencies. A corresponding clock signal is input as a system clock, operates in synchronization with the system clock, and executes an expansion code, an operation code, and an operation code by pipeline processing on an instruction program including an extension code, an operation code, and an operand stored in a memory. Equipped with a processor that fetches and decodes operands and executes an instruction program based on the result of decoding, and configures the operation code as an instruction map consisting of multiple pages classified into pages corresponding to each division ratio by machine code And pipelined with the operation code The extension code indicates a page of the instruction map, and the processor fetches and decodes the extension code by pipeline processing to output frequency information corresponding to a division ratio corresponding to the instruction map page indicated by the extension code. Features.
[0024]
According to this configuration, since the existing extended code area has the frequency control information, there is no increase in the circuit size, and the execution cycle of the instruction to be changed in frequency and the frequency change timing are synchronized by being decoded before the operation code. It is possible to easily and more precisely reduce the power consumption according to the intention of the program developer.
[0025]
Further, like the microcontroller according to the third aspect, in the microcontroller according to the first or second aspect, the oscillation frequency is 1 / n (where n is an integer of 1 or more in the frequency division ratio) and is different from the A clock generator that generates a plurality of clock signals, selects a clock signal according to the frequency information output from the processor from among them, and outputs the selected clock signal to the processor as a system clock may be provided.
[0026]
In addition, the clock generator outputs a plurality of clock signals having frequencies different from 1 / n (n is an integer of 1 or more) of the oscillation frequency and different frequencies. Selecting means for selecting one clock signal based on a selection signal from a plurality of clock signals output from the frequency dividing means and outputting the selected signal as a system clock; and selecting a selection signal corresponding to frequency information output from the processor And a control means for outputting to the means.
[0027]
According to a fifth aspect of the present invention, in the microcontroller according to the first aspect, a frequency control signal is generated according to a frequency division ratio setting description for determining a frequency division ratio of a system clock described in a source program. There is provided a means for adding to an operation code generated from an instruction at a later stage of the ratio setting description and converting it into ROM code.
[0028]
Thus, the addition of the frequency control signal to the operation code can be automatically machine-coded by the compiler without the burden of the program developer.
[0029]
According to a sixth aspect of the present invention, in the microcontroller according to the first aspect, a frequency control signal is generated according to a frequency division ratio setting description for determining a frequency division ratio of a system clock described in a source program. If the number of execution cycles of the instruction preceding the ratio setting description is less than the reference, the frequency control signal is added to the operation code generated from the instruction preceding the division ratio setting description. There is provided a means for adding to an operation code generated from an instruction at a subsequent stage of the cycle ratio setting description and converting it into a ROM code.
[0030]
As a result, it is possible to reduce an error between the execution cycle of an instruction to change the frequency and the frequency change timing due to the processing time until the frequency control signal is decoded together with the operation code and executed.
[0031]
According to a seventh aspect of the present invention, there is provided the microcontroller according to the second aspect, wherein the extension code corresponding to the frequency division ratio is written in accordance with the frequency division ratio setting description for determining the frequency division ratio of the system clock described in the source program. There is provided means for selecting an operation code corresponding to the instruction at the latter stage of the division ratio setting description from the page of the instruction map indicated by the extension code and converting the operation code into ROM code.
[0032]
As a result, the setting of the frequency division ratio of the system clock and the selection of the instruction code corresponding to the frequency division ratio can be automatically machine-coded by the compiler without the burden on the program developer by the description of the specific frequency division ratio setting.
[0033]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be specifically described with reference to the drawings.
[0034]
(Embodiment 1)
The microcontroller according to the first embodiment of the present invention will be described. 1 and 2 are block diagrams showing a schematic configuration of a microcontroller according to the first embodiment. FIG. 1 shows a detailed configuration of a clock generator inside the microcontroller, and FIG. 2 shows a configuration of a CPU inside the microcontroller. This is shown in detail.
[0035]
In FIG. 1,
[0036]
2, the
[0037]
Next, the operation of the microcontroller according to the first embodiment configured as described above will be described.
[0038]
First, data input from the
[0039]
The operation code output from the
[0040]
The operand output from the
[0041]
The mechanism for changing the frequency division ratio of the system clock sysclk decodes the frequency control signal added to the operation code together with the operation code, and is transmitted to the clock frequency
[0042]
The operation of the microcontroller according to the first embodiment as described above will be described using a program example and a timing chart.
[0043]
3A, 3B, and 3C are an instruction format, a program example, and an operation timing chart of the microcontroller according to the first embodiment. Here, an operation of switching the frequency division ratio of sysclk from 1 frequency division of oscin to 2 frequency division and again to 1 frequency division is shown taking an 8-bit microcontroller as an example.
[0044]
The instruction format includes a 4-bit extension code indicating the number of pages of the instruction map, an 8-bit operation code (operation code), a 1-bit frequency control signal added to the operation code, and 4 × n bits (n = 1, 2). ...)).
[0045]
In the example of the program, the instructions of (1) to (7) are executed, and the dividing ratio of sysclk is switched from 1 to 2 of oscin from the instruction (3). Switch to The frequency control signal added to the operation code is represented by * 0 or * 1, and when * 0, frequency division by 1 is selected, and when * 1, frequency division by 2 is selected. In the symbols shown in the timing chart, (1) -1 indicates the machine code of the first nibble of the instruction (1) of the program example, and (1) μ-1 indicates the first cycle of the execution cycle of the instruction (1). Shall be represented. T1 and T2 indicate the timing of the falling edge and the rising edge of sysclk, respectively.
[0046]
At the timing A, since osscsel is “L”, sysclk operates at a period of 1/1 oscin. The
[0047]
Since (3) -3 holds information (* 1) of the frequency-divided-by-2 control in the added frequency control signal, it is output to the
[0048]
The frequency control signal to be added is not limited to one bit but may be several bits depending on the specifications of the microcontroller.
[0049]
As described above, according to the first embodiment, the operation code is processed in the pipeline similarly to the operation code by adding the frequency control signal for determining the frequency division ratio of the system clock. As described above, the time for writing the setting data to the frequency control register (804) is not required, and the power consumption of the microcontroller can be effectively reduced without lowering the performance of the system. Further, in this embodiment, an 8-bit microcontroller is described as an example. However, as the number of bits increases, the effect of the added bits on the circuit scale becomes extremely small, and the effect of the present invention further increases. .
[0050]
(Embodiment 2)
A microcontroller according to a second embodiment of the present invention will be described.
[0051]
FIG. 4 is a block diagram illustrating a schematic configuration of the microcontroller according to the second embodiment. The only difference from the first embodiment is that the operation code transmitted from
[0052]
Next, the operation of the microcontroller according to the second embodiment configured as described above will be described.
[0053]
FIGS. 5A and 5B are examples of an instruction map of the microcontroller according to the second embodiment. The instruction map is composed of a plurality of pages, and is classified into each page for each division ratio. Therefore, the same operation code is executed at different frequencies depending on the extension code indicating the number of pages of the instruction map. For example, the instruction map A and the instruction map B correspond to frequency division by 1 and frequency division by 2, respectively, and are classified by extension codes '0011' and '0101'. MC1 and MC2 in the map are both instructions having the same execution contents, and have the same machine code other than the extension code. When these codes are processed by the CPU, the same operation is performed by MC1 by dividing by 1 and MC2 is performed by dividing by 2. The extension code corresponding to the frequency division ratio is decoded in the pipeline processing in the same manner as the operation code, and transmitted to the clock frequency
[0054]
The operation of the microcontroller according to the second embodiment as described above will be described using a program example and a timing chart.
[0055]
FIGS. 6A, 6B, and 6C are an instruction format, a program example, and an operation timing chart of the microcontroller according to the second embodiment. Here, similarly to the description of the operation of the microcontroller according to the first embodiment, an operation of switching the frequency division ratio of sysclk from the frequency division of oscin to the frequency division of 1 to 2 and again to the frequency division of 1 by taking an 8-bit microcontroller as an example.
[0056]
The instruction format includes a 4-bit extension code indicating the number of pages of the instruction map, an 8-bit operation code (operation code), and 4 × n-bit (n = 1, 2,...) Operands. The only difference from the microcontroller of the first embodiment is that no frequency control signal is added.
[0057]
In the example of the program, the instructions of (1) to (7) are executed, and the dividing ratio of sysclk is switched from 1 to 2 of oscin from the instruction (3). Switch to The extension code “0011” indicates that the instruction is to set sysclk to oscin divided by 1, and indicates that it is “0101” divided by 2.
[0058]
At the timing A, since the osscsel is “L”, the sysclk operates at a period of 1/1 oscin. The
[0059]
{Circle around (3)}-1 is an extension code, which holds information “0101” of divide-by-2 control, and is decoded while passing through
[0060]
As described above, according to the second embodiment, by providing the extension code with information for determining the frequency division ratio of the system clock, decoding can be performed in a cycle earlier than the operation code. This makes it possible to minimize the time lag for performing the frequency control, thereby enabling the program developer to more easily and accurately execute the frequency control. Therefore, the power consumption of the microcontroller can be reduced by eliminating the time lag required for the frequency change and executing the frequency control appropriately and quickly according to the task.
[0061]
The number of instructions is not limited to two, ie, frequency division by one and frequency division by two. In addition, the number of instructions does not need to be the same for each division ratio.For example, the number of instructions corresponding to the default division ratio can be limited to several for the instruction corresponding to the default division ratio. is there.
[0062]
The
[0063]
(Embodiment 3)
A microcontroller according to a third embodiment of the present invention will be described.
[0064]
FIG. 7A is a flowchart showing a procedure for generating a machine code and arranging the same in a ROM in the microcontroller according to the third embodiment. FIG. FIG. 4 is a diagram showing a method for performing the operation. As shown in FIG. 7A, a program source created by program development is usually converted into ROM code based on a data file generated by a compiler or the like, and then generated as a layout pattern and stored in the ROM. You. However, in the conventional machine code generation flow, the frequency control signal cannot be added to the machine code unlike the microcontroller according to the first embodiment.
[0065]
In the machine code generation flow according to the third embodiment, the frequency control signal can be added to the machine code by inserting the frequency division ratio setting description into the program source. For example, as shown in the example of the program in FIG. Is executed by dividing by 1 and the instructions (3) and (4) are to be executed by dividing by 2. If the instruction (1) is to be executed, write 'set fast' before the instruction (1) and 'set fast' before the instruction (3). "set fast" is described before the instruction "6". The compiler receives the instruction and the information of 'set fast' or 'set slow' of the preceding stage as input, converts the instruction into machine code, and furthermore, if the preceding frequency division setting description is 'set fast', sets the operation code to '0'. , And if it is 'set slow', '1' is added. If there is no description before the instruction, the additional signal of the previous machine code is continued.
[0066]
That is, the microcontroller according to the third embodiment has the same configuration as that of the first embodiment except that the above-described compiler, the means for converting the machine code generated by the compiler into ROM code, and the means for arranging the ROM are provided. It is.
[0067]
As described above, according to the third embodiment, the addition of the frequency control signal to the operation code can be automatically machine-coded by the compiler without the burden on the program developer. Can be utilized.
[0068]
(Embodiment 4)
A microcontroller according to a fourth embodiment of the present invention will be described.
[0069]
FIG. 8A is a flowchart showing a procedure for generating a machine code and arranging the same in a ROM in the microcontroller according to the fourth embodiment. FIG. FIG. 8C is a timing chart showing the operation of the microcontroller according to the fourth embodiment. The procedure for arranging in the ROM is the same as that in the third embodiment, but the generation rules are different in the process of generating the machine code from the program source by the compiler.
[0070]
In the third embodiment, the frequency control signal to be added to the operation code is determined by 'set fast' and 'set slow'. However, when the frequency division ratio is changed in the microcontroller of the first embodiment, the frequency control signal is added to the operation code. Therefore, it takes a little time from fetching to decoding and execution to switching of the oscsel. For this reason, there is a case where the execution timing of an instruction which originally needs to switch the frequency division ratio cannot be met, and the program developer needs to study the frequency control in detail.
[0071]
In the machine code generation flow of the present embodiment, when the machine codes of the instructions (1) to (7) are generated as in the third embodiment, the division ratio setting description and the execution cycle of the preceding instruction are also changed. Then, the frequency control signal is determined.
[0072]
For example, 'set slow' at the preceding stage of the instruction (3) is originally inserted for the purpose of operating the instruction (3) by dividing by two, but is added to the operation code as shown in FIG. 3 in the first embodiment. Therefore, the switching of the oscsel is delayed, and the switching is actually performed from the execution cycle (4) μ-1 of the instruction (4). As a countermeasure in this case, in order to execute the instruction (3) by dividing by two, the preceding instruction (1) is provided with an additional signal of the control of dividing by two, so that the execution timing G of (3) μ−1 is just obtained. Switches to frequency division by 2. However, when the execution cycle of the instruction (1) is long, the processing frequency of the instruction (1) is divided by two. In the fourth embodiment, if the execution cycle of the preceding instruction of 'set fast' and 'set slow' is less than the reference cycle, it is added to the machine code of the preceding instruction. To the machine code. In the example of FIG. 8, the reference cycle is set to three cycles, and if the execution cycle of the instruction at the preceding stage of 'set fast' and 'set slow' is less than three cycles (that is, two cycles or less), it is added to the machine code of the preceding instruction. If the number of cycles is three or more, the instruction is added to the machine code of the subsequent instruction.
[0073]
That is, the microcontroller of the fourth embodiment has the same configuration as that of the first embodiment, except that the above-mentioned compiler, the means for converting the machine code generated by the compiler into the ROM code, and the means for arranging the ROM are provided. It is.
[0074]
As described above, according to the fourth embodiment, since the addition of the frequency control signal to the operation code is determined according to the number of execution cycles of the instruction, the frequency can be controlled more precisely at the intended timing. Since there is no need for the program developer to perform programming in consideration of the number of execution cycles, the program development efficiency can be improved.
[0075]
(Embodiment 5)
A microcontroller according to a fifth embodiment of the present invention will be described.
[0076]
FIG. 9A is a flowchart showing a procedure of generating a machine code and arranging the same in a ROM in the microcontroller according to the fifth embodiment. FIG. FIG. 4 is a diagram showing a method for performing the operation. The procedure for arranging in the ROM is the same as that in the third embodiment, but the generation rules are different in the process of generating the machine code from the program source by the compiler.
[0077]
In the machine code generation flow of the present embodiment, an extension code corresponding to the division ratio set by inserting the division ratio setting description into the program source is selected, and the instruction at the subsequent stage of the division ratio setting description is It is converted into the corresponding machine code from the instruction map classified by the extension code. For example, as in the example of the program shown in FIG. Is executed by dividing by 1 and the instructions (3) and (4) are to be executed by dividing by 2. If the instruction (1) is to be executed, write 'set fast' before the instruction (1) and 'set fast' before the instruction (3). "set fast" is described before the instruction "6". In the instruction map, an instruction group executed by one division has no extension code, an extension code '0010', an extension code '0011', and an instruction group executed by two divisions has an extension code '0100', extension code '0101', It is assumed that they are classified by the extension code '0110'. The instructions handled by the microcontroller according to the fifth embodiment have the same operation code except for the extension code in the instruction group of 1 and the instruction group of 2 as in the example of FIG. 5 described in the second embodiment. Perform the same operation. The compiler takes an instruction and information of 'set fast' or 'set slow' of the preceding stage as input, and if the preceding stage is' set fast ', converts it into a machine code of a map of an instruction group to be executed by dividing by one, and' set If it is slow ', it is converted into a machine code of a map of an instruction group to be executed by dividing by two. If there is no description in the preceding stage of the instruction, it is assumed that the division ratio is not changed, and the instruction is converted into a machine code of an instruction group having the same division ratio as the preceding stage instruction.
[0078]
That is, the microcontroller of the fifth embodiment has the same configuration as that of the second embodiment, except that the above-mentioned compiler, the means for converting the machine code generated by the compiler into the ROM code, and the means for arranging the ROM are provided. It is.
[0079]
As described above, according to the fifth embodiment, the setting of the division ratio can be reflected in the machine code only by inserting the division ratio setting description, and the characteristics of the microcontroller of the second embodiment can be maximized. Provide a program development environment that can be used effectively.
[0080]
【The invention's effect】
As described above, according to the present invention, by adding information for controlling the frequency to the operation code or retaining the information in the extension code, the frequency can be controlled in the pipeline processing of the execution instruction. The power consumption of the microcontroller can be reduced by eliminating the time lag required for the change and executing the frequency control appropriately and quickly according to the task.
[Brief description of the drawings]
FIG. 1 is a block diagram illustrating a schematic configuration of a microcontroller according to a first embodiment of the present invention;
FIG. 2 is a block diagram illustrating a schematic configuration of a microcontroller according to the first embodiment of the present invention.
FIG. 3 is an instruction format, a program example, and an operation timing chart of the microcontroller according to the first embodiment of the present invention.
FIG. 4 is a block diagram illustrating a schematic configuration of a microcontroller according to a second embodiment of the present invention;
FIG. 5 is an explanatory diagram of an instruction map of the microcontroller according to the second embodiment of the present invention.
FIG. 6 is an instruction format, a program example, and an operation timing chart of the microcontroller according to the second embodiment of the present invention.
FIG. 7 is a flowchart showing a ROM code generation process in a microcontroller according to a third embodiment of the present invention, and an explanatory diagram thereof;
FIG. 8 is a flowchart showing ROM code generation processing in a microcontroller according to a fourth embodiment of the present invention, an explanatory diagram thereof, and an operation timing chart
FIG. 9 is a flowchart illustrating a ROM code generation process in the microcontroller according to the fifth embodiment of the present invention;
FIG. 10 is a block diagram showing a general schematic configuration of a conventional microcontroller.
FIG. 11 is a block diagram showing a general schematic configuration of a conventional microcontroller.
FIG. 12 is an instruction format, a program example, and an operation timing chart of a conventional microcontroller.
[Explanation of symbols]
100 CPU
200 bus interface
300 data paths
400 instruction decoder
401 Instruction Fetch Buffer (IFB)
402 Instruction Buffer (IB)
403 Instruction register (IR)
404 Programmable Logic Array (PLA)
500 data register
600 address register
700 ROM
800 clock generator
801 clock divider circuit
802 selector
803 Clock frequency division control circuit
804 Clock frequency division control register
1000 microcontroller
Claims (7)
前記オペレーションコードは前記システムクロックの分周比を決定する周波数制御信号が付加されて前記メモリに格納されており、
前記プロセッサは、前記周波数制御信号を前記オペレーションコードとともにパイプライン処理によりフェッチ、解読することにより前記周波数制御信号に応じた前記周波数情報を出力することを特徴とするマイクロコントローラ。A clock signal corresponding to frequency information is input as a system clock from among a plurality of clock signals having a frequency of 1 / n (n is an integer greater than or equal to 1 in a division ratio) of an oscillation frequency and different frequencies, and The instruction code, which operates in synchronization with a clock and includes an operation code and an operand stored in a memory, fetches and decodes the operation code and the operand by pipeline processing and decodes the instruction based on a result of the decoding. A processor that executes the program,
The operation code is stored in the memory with a frequency control signal for determining a frequency division ratio of the system clock added thereto,
A microcontroller, wherein the processor outputs the frequency information according to the frequency control signal by fetching and decoding the frequency control signal together with the operation code by pipeline processing.
マシンコードによって前記オペレーションコードを各分周比に対応してページに分類された複数ページからなる命令マップとして構成し、前記オペレーションコードとともにパイプライン処理される前記拡張コードが前記命令マップのページを示し、
前記プロセッサは、前記拡張コードをパイプライン処理によりフェッチ、解読することにより前記拡張コードが示す前記命令マップのページに対応する分周比に応じた前記周波数情報を出力することを特徴とするマイクロコントローラ。A clock signal corresponding to frequency information is input as a system clock from among a plurality of clock signals having a frequency of 1 / n (n is an integer of 1 or more in a division ratio) of an oscillation frequency and different frequencies, and It operates in synchronization with a clock, and fetches and decodes the extension code, the operation code, and the operand by pipeline processing for an instruction program including an extension code, an operation code, and an operand stored in a memory. A processor that executes the instruction program based on the decoding result,
The operation code is constituted by a machine code as an instruction map composed of a plurality of pages classified into pages corresponding to respective division ratios, and the extension code pipelined together with the operation code indicates a page of the instruction map. ,
A microcontroller, wherein the processor outputs the frequency information according to a frequency division ratio corresponding to a page of the instruction map indicated by the extension code by fetching and decoding the extension code by pipeline processing. .
前記発振周波数の1/n(nは分周比で1以上の整数)の周波数であって異なる周波数の複数のクロック信号を出力する分周手段と、
前記分周手段の出力する前記複数のクロック信号の中から選択信号に基づいて1つのクロック信号を選択し前記システムクロックとして出力する選択手段と、
前記プロセッサから出力される前記周波数情報に対応する前記選択信号を前記選択手段に出力する制御手段とを有した請求項3記載のマイクロコントローラ。The clock generator includes:
Frequency dividing means for outputting a plurality of clock signals having a frequency of 1 / n (n is an integer of 1 or more in frequency division ratio) of the oscillation frequency and different frequencies;
Selecting means for selecting one clock signal from the plurality of clock signals output by the frequency dividing means based on a selection signal and outputting the selected signal as the system clock;
4. The microcontroller according to claim 3, further comprising control means for outputting the selection signal corresponding to the frequency information output from the processor to the selection means.
Priority Applications (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003094686A JP3958239B2 (en) | 2003-03-31 | 2003-03-31 | Microcontroller |
US10/804,143 US7197653B2 (en) | 2003-03-31 | 2004-03-19 | Microcontroller for fetching and decoding a frequency control signal together with an operation code |
CNB2004100342255A CN100365567C (en) | 2003-03-31 | 2004-03-31 | Microcontroller |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003094686A JP3958239B2 (en) | 2003-03-31 | 2003-03-31 | Microcontroller |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2004302827A true JP2004302827A (en) | 2004-10-28 |
JP3958239B2 JP3958239B2 (en) | 2007-08-15 |
Family
ID=32985436
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2003094686A Expired - Fee Related JP3958239B2 (en) | 2003-03-31 | 2003-03-31 | Microcontroller |
Country Status (3)
Country | Link |
---|---|
US (1) | US7197653B2 (en) |
JP (1) | JP3958239B2 (en) |
CN (1) | CN100365567C (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7911817B2 (en) * | 2008-09-18 | 2011-03-22 | Dell Products L.P. | Systems and methods for controlling energy consumption of AC-DC adapters |
US8417985B2 (en) * | 2010-05-18 | 2013-04-09 | Plx Technology, Inc. | Adjusting system clock to faster speed upon receiving mass storage command and back to lower speed upon completion of all commands |
CN103970252A (en) * | 2013-01-31 | 2014-08-06 | 腾讯科技(深圳)有限公司 | Method and system for saving power of terminal equipment through browser |
JP2022550158A (en) * | 2019-09-30 | 2022-11-30 | アルコン インコーポレイティド | Improved Ocular Aberration Analysis System and Method |
Family Cites Families (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS52109841A (en) | 1976-03-12 | 1977-09-14 | Hitachi Ltd | Clock control system |
JPS62249233A (en) | 1986-04-22 | 1987-10-30 | Nippon Denso Co Ltd | Microprocessor |
JPH01293440A (en) | 1988-05-20 | 1989-11-27 | Rohm Co Ltd | Microcomputer system |
JPH02118811A (en) | 1988-10-28 | 1990-05-07 | Nec Corp | Micro-computer |
US5745375A (en) * | 1995-09-29 | 1998-04-28 | Intel Corporation | Apparatus and method for controlling power usage |
JPH1091430A (en) | 1996-09-13 | 1998-04-10 | Matsushita Electric Ind Co Ltd | Instruction decoding device |
US5940602A (en) * | 1997-06-11 | 1999-08-17 | Advanced Micro Devices, Inc. | Method and apparatus for predecoding variable byte length instructions for scanning of a number of RISC operations |
JPH11184554A (en) | 1997-12-24 | 1999-07-09 | Mitsubishi Electric Corp | Clock control type information processor |
JP2001184208A (en) * | 1999-12-27 | 2001-07-06 | Matsushita Electric Ind Co Ltd | Low power microprocessor and program power reducing method |
US6625740B1 (en) * | 2000-01-13 | 2003-09-23 | Cirrus Logic, Inc. | Dynamically activating and deactivating selected circuit blocks of a data processing integrated circuit during execution of instructions according to power code bits appended to selected instructions |
JP3512707B2 (en) * | 2000-04-21 | 2004-03-31 | Necマイクロシステム株式会社 | Microcomputer |
JP2002108490A (en) * | 2000-07-26 | 2002-04-10 | Sony Corp | Clock supply circuit |
US20020108064A1 (en) * | 2001-02-07 | 2002-08-08 | Patrick Nunally | System and method for optimizing power/performance in network-centric microprocessor-controlled devices |
JP2003029965A (en) * | 2001-07-10 | 2003-01-31 | Sony Corp | Microprocessor |
-
2003
- 2003-03-31 JP JP2003094686A patent/JP3958239B2/en not_active Expired - Fee Related
-
2004
- 2004-03-19 US US10/804,143 patent/US7197653B2/en not_active Expired - Fee Related
- 2004-03-31 CN CNB2004100342255A patent/CN100365567C/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
US7197653B2 (en) | 2007-03-27 |
JP3958239B2 (en) | 2007-08-15 |
CN100365567C (en) | 2008-01-30 |
US20040193930A1 (en) | 2004-09-30 |
CN1542608A (en) | 2004-11-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP2006146953A (en) | Processor, system lsi, design method of system lsi, and recording medium with the same recorded thereon | |
JPH09231070A (en) | Information processing circuit, semiconductor integrated circuit device, microcomputer and electronic equipment | |
US7313671B2 (en) | Processing apparatus, processing method and compiler | |
JP5231800B2 (en) | Semiconductor integrated circuit device and clock control method for semiconductor integrated circuit device | |
US7493473B2 (en) | Method of executing instructions using first and second control units that share a state register | |
JP3805314B2 (en) | Processor | |
JP4753895B2 (en) | Array type processor having delay adjustment circuit | |
JP3958239B2 (en) | Microcontroller | |
JP2007058331A (en) | Processor system and multithread processor | |
US20200371808A1 (en) | Processing device with vector transformation execution | |
JP3459821B2 (en) | Microprocessor | |
JPH1091430A (en) | Instruction decoding device | |
JP2006018411A (en) | Processor | |
US8924689B2 (en) | Semiconductor device with instruction code and prefix code predecoders | |
US8255672B2 (en) | Single instruction decode circuit for decoding instruction from memory and instructions from an instruction generation circuit | |
US20110225395A1 (en) | Data processing system and control method thereof | |
WO2005036384A2 (en) | Instruction encoding for vliw processors | |
JP3716320B2 (en) | Computer control circuit | |
KR100345678B1 (en) | Control unit for being easy change of design | |
JP3512707B2 (en) | Microcomputer | |
JP2000298589A (en) | Microprocessor | |
JP2004234047A (en) | Electronic circuit and assembler | |
JP2003233496A (en) | Microprocessor | |
JP2004288203A (en) | Processor core and processor using the same | |
JPH02205925A (en) | Microprocessor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20060308 |
|
RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20060410 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20060829 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20061027 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20070417 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20070509 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110518 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110518 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120518 Year of fee payment: 5 |
|
LAPS | Cancellation because of no payment of annual fees |