JP2005259120A - Signal processing device - Google Patents
Signal processing device Download PDFInfo
- Publication number
- JP2005259120A JP2005259120A JP2005025899A JP2005025899A JP2005259120A JP 2005259120 A JP2005259120 A JP 2005259120A JP 2005025899 A JP2005025899 A JP 2005025899A JP 2005025899 A JP2005025899 A JP 2005025899A JP 2005259120 A JP2005259120 A JP 2005259120A
- Authority
- JP
- Japan
- Prior art keywords
- data
- memory
- cache memory
- signal processing
- cache
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Memory System Of A Hierarchy Structure (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
【課題】 キャッシュミスを少なくし、データ伝送時間及びデータの転送量を削減することが可能な信号処理装置を提供する。
【解決手段】
信号処理装置1は、主メモリ10の第1メモリ領域11及び第2メモリ領域12の第1テーブル13及び第2テーブル14を用いてデコード処理を行う。信号処理装置1は、第1テーブル13及び第2テーブル14のデータを一時格納するためのキャッシュメモリ34と、キャッシュメモリ34を介して第1メモリ領域11及び第2メモリ領域12の少なくとも1つにアクセスすることによってデータを読み出すプロセッサ20と、キャッシュメモリ34に一時格納する空き領域が不足した場合に、キャッシュメモリ34に空き領域を確保する制御部51とを備え、制御部51は、第1メモリ領域11のデータが第2メモリ領域12のデータよりも優先してキャッシュメモリ34に保持されるように、空き領域を確保する。
【選択図】 図1PROBLEM TO BE SOLVED: To provide a signal processing device capable of reducing a cache miss and reducing a data transmission time and a data transfer amount.
[Solution]
The signal processing device 1 performs a decoding process using the first table 13 and the second table 14 of the first memory area 11 and the second memory area 12 of the main memory 10. The signal processing apparatus 1 includes a cache memory 34 for temporarily storing data of the first table 13 and the second table 14, and at least one of the first memory area 11 and the second memory area 12 via the cache memory 34. A processor 20 that reads data by accessing and a control unit 51 that secures a free area in the cache memory 34 when a free area temporarily stored in the cache memory 34 is insufficient, the control unit 51 includes a first memory An empty area is secured so that the data in the area 11 is held in the cache memory 34 in preference to the data in the second memory area 12.
[Selection] Figure 1
Description
本発明は、第1及び第2メモリ領域のデータを用いて信号処理を行う信号処理装置に関し、特にキャッシュメモリを介して第1及び第2メモリ領域にアクセスし、第1及び第2メモリ領域のデータを読み出すことにより信号処理を行う信号処理装置に関する。 The present invention relates to a signal processing apparatus that performs signal processing using data in first and second memory areas, and in particular, accesses the first and second memory areas via a cache memory, and stores the first and second memory areas. The present invention relates to a signal processing device that performs signal processing by reading data.
例えば、音楽データについて例えばMPEG−AAC規格のハフマンコードブック(例えば、8)を用いてハフマン符号にエンコードし、再生の際にエンコードされた符号をデコードするような信号処理が行われる。 For example, signal processing is performed such that music data is encoded into a Huffman code using, for example, a Huffman codebook (for example, 8) of the MPEG-AAC standard, and the encoded code is decoded during reproduction.
図22は、MPEG−AAC規格のハフマンコードブック8を示している。
このコードブックを用いてどのようにハフマンデコードが行われるか以下説明する。
FIG. 22 shows the Huffman
How Huffman decoding is performed using this code book will be described below.
例えば、ハフマン符号化された入力のビット列が、「01110110000111111011010001111xxxx」と続いているとする。 For example, it is assumed that the Huffman-encoded input bit string continues as “01110110000111111011010001111xxxx”.
その場合、最初の5ビットが、当該テーブルの最初のエントリ「01110」に合致するので、デコード結果は「0」となり、当該符号長は5ビットであることがわかる。さらに、続くビットが、「110000111111011010001111xxxx」となっているので、最初の6ビットが、当該テーブルの4番目のエントリ「110000」に合致するので、デコード結果は「3」となり、当該符号長は6ビットであることがわかる。さらに、続くビットが、「111111011010001111xxxx」となっているので、最初の9ビットが、当該テーブルの最後から3番目のエントリ「111111011」に合致するので、デコード結果は「61」となり、当該符号長は9ビットであることがわかる。さらに、続くビットが、「010001111xxxx」となっているので、最初の4ビットが、当該テーブルの11番目のエントリ「0100」に合致するので、デコード結果は「10」となり、当該符号長は4ビットであることがわかる。さらに、続くビットが、「01111xxxx」となっているので、最初の5ビットが、当該テーブルの17番目のエントリ「01111」に合致するので、デコード結果は「16」となり、当該符号長は5ビットであることがわかる。 In this case, since the first 5 bits match the first entry “01110” of the table, the decoding result is “0”, which indicates that the code length is 5 bits. Furthermore, since the subsequent bits are “110000111111011010001111xxxx”, the first 6 bits match the fourth entry “110000” in the table, so the decoding result is “3”, and the code length is 6 bits. It can be seen that it is. Furthermore, since the following bits are “111111011010001111xxxx”, the first 9 bits match the third entry “111111011” from the end of the table, so the decoding result is “61” and the code length is It can be seen that it is 9 bits. Furthermore, since the subsequent bits are “010001111xxxx”, the first 4 bits match the 11th entry “0100” of the table, so the decoding result is “10” and the code length is 4 bits. It can be seen that it is. Furthermore, since the subsequent bits are “01111xxxx”, the first 5 bits match the 17th entry “01111” of the table, so the decoding result is “16” and the code length is 5 bits. It can be seen that it is.
このように、ハフマンコードブック8の各行を総当たり方式でサーチすることによりハフマンデコードが行われる。
In this way, Huffman decoding is performed by searching each line of the Huffman
しかしながら、このデコード方法は、一致するハフマン符号が見つかるまでハフマンコードブック8を何度もサーチする必要があるため、非常に多くの処理時間を必要とするという問題を有している。
However, this decoding method has a problem that it requires a very long processing time because it is necessary to search the Huffman
このため、本願に係る発明者らは、ハフマンデコード処理を高速に行うための装置を発明した(例えば、特許文献1参照)。 For this reason, the inventors of the present application have invented an apparatus for performing Huffman decoding at high speed (see, for example, Patent Document 1).
この発明を適用した従来の技術を、MPEG−AAC規格のハフマンコードブック8を用いてエンコードされた符号をデコードする過程を例にとり、以下説明する。
A conventional technique to which the present invention is applied will be described below by taking as an example a process of decoding a code encoded using the Huffman
図23は、ハフマンデコード処理を高速に行うための2つのテーブルを示す図である。特に図23(a)は第1テーブル5000を、図23(b)は第2テーブル6000を、それぞれ示している。 FIG. 23 is a diagram showing two tables for performing the Huffman decoding process at high speed. In particular, FIG. 23A shows the first table 5000, and FIG. 23B shows the second table 6000.
これらの第1及び第2テーブル5000,6000は、SRAM等のメモリの所定のアドレスに記憶され、デコーダがハフマンコードのビット列に基づいて第1及び第2テーブル5000,6000を引くことによりデコード処理が行われる。 These first and second tables 5000 and 6000 are stored at predetermined addresses of a memory such as SRAM, and the decoder subtracts the first and second tables 5000 and 6000 based on the bit string of the Huffman code, thereby performing the decoding process. Done.
この2つの第1及び第2テーブル5000,6000を用いる場合、入力のビット列は、以下のようにデコードされる。 When these two first and second tables 5000 and 6000 are used, the input bit string is decoded as follows.
例えば、入力のビット列が、先の例と同様「01110110000111111011010001111xxxx」と続いている場合、デコーダは、まず最初の6ビットを取り出し、当該6ビットをアドレスとして、第1テーブル5000を引く。この場合、「011101」をアドレスとして第1テーブル5000を引くので、デコーダは、図23(a)中に示される1回目のアクセスポイントα1をアクセスし、符号長が5ビットで、デコード結果が「0」であることがわかる。そして、デコーダは、符号長が5ビットであったので、上記ビット列を5ビット進めると、ビット列は「110000111111011010001111xxxx」となる。 For example, when the input bit string continues as “01110110000111111011010001111xxxx” as in the previous example, the decoder first extracts the first 6 bits, and draws the first table 5000 using the 6 bits as an address. In this case, since the first table 5000 is drawn with “011101” as the address, the decoder accesses the first access point α1 shown in FIG. 23A, the code length is 5 bits, and the decoding result is “ It turns out that it is "0". Since the code length of the decoder is 5 bits, when the bit string is advanced by 5 bits, the bit string becomes “110000111111011010001111xxxx”.
次に、デコーダは、先ほどと同様に当該ビット列の最初の6ビットを取り出し、取り出した6ビットをアドレスとして、第1テーブル5000を引く。この場合、「110000」をアドレスとして、第1テーブル5000を引くので、デコーダは、図23(a)中に示される2回目のアクセスポイントα2をアクセスし、符号長が6ビットで、デコード結果が「3」であることがわかる。そして、符号長が6ビットであったので、上記ビット列を6ビット進めると、ビット列は「111111011010001111xxxx」となる。 Next, the decoder extracts the first 6 bits of the bit string in the same manner as described above, and draws the first table 5000 using the extracted 6 bits as an address. In this case, since the first table 5000 is drawn with “110000” as the address, the decoder accesses the second access point α2 shown in FIG. 23A, the code length is 6 bits, and the decoding result is It turns out that it is "3". Since the code length is 6 bits, when the bit string is advanced by 6 bits, the bit string becomes “111111011010001111xxxx”.
さらに、デコーダは、先ほどと同様に当該ビット列の最初の6ビットを取り出し、取り出した6ビットをアドレスとして、第1テーブル5000を引く。この場合、「111111」をアドレスとして、第1テーブル5000を引くので、図23(a)中に示される3回目のアクセスポイントα3をアクセスし、未完了記号「15」、次のアドレスポインタ「1100010」、次に読み込むビット数4を得るので、図23(b)に示される第2テーブル6000のアドレス「1100010」にポインタを進め、上記ビット列を6ビット進めた後にさらに4ビットを取得し、当該4ビットをアドレス「1100010」からのインデックスとし第2テーブル6000を引く。この場合、当該4ビットの値が「0110」であるので、図23(b)中に示される4回目のアクセスポイントα4をアクセスすることになるので、デコーダは、符号長が3ビットで、デコード結果が「61」であることがわかる。そして、上記符号長が3ビットであったので上記ビット列を3ビット進めると、ビット列は「010001111xxxx」となる。
Further, the decoder extracts the first 6 bits of the bit string in the same manner as described above, and draws the first table 5000 using the extracted 6 bits as an address. In this case, since the first table 5000 is drawn with “111111” as the address, the third access point α3 shown in FIG. 23A is accessed, the incomplete symbol “15”, and the next address pointer “1100010”. In order to obtain the number of
次に、デコーダは、先ほどと同様に当該ビット列の最初の6ビットを取り出し、当該6ビットをアドレスとして、第1テーブル5000を引く。この場合、「010001」をアドレスとして第1テーブル5000を引くので、デコーダは、図23(a)中に示される5回目のアクセスポイントα5をアクセスし、符号長が4ビットで、デコード結果で「10」であることがわかる。上記符号長が4ビットであったので上記ビット列を4ビット進めると、ビット列は「01111xxxx」となる。 Next, the decoder takes out the first 6 bits of the bit string in the same manner as before, and draws the first table 5000 using the 6 bits as an address. In this case, since the first table 5000 is drawn with “010001” as the address, the decoder accesses the fifth access point α5 shown in FIG. 23A, the code length is 4 bits, and the decoding result is “ 10 ". Since the code length is 4 bits, if the bit string is advanced by 4 bits, the bit string becomes “01111xxxx”.
次に、デコーダは、先ほどと同様に当該ビット列の最初の6ビットを取り出し、当該6ビットをアドレスとして、第1テーブル5000を引く。この場合、「01111x」をアドレスとして、第1テーブル5000を引くので、図23(a)中に示す、6回目のアクセスポイントα6をアクセスし、符号長が5ビットで、デコード結果が「16」であることがわかる。 Next, the decoder takes out the first 6 bits of the bit string in the same manner as before, and draws the first table 5000 using the 6 bits as an address. In this case, since the first table 5000 is drawn using “01111x” as the address, the sixth access point α6 shown in FIG. 23A is accessed, the code length is 5 bits, and the decoding result is “16”. It can be seen that it is.
上記のような処理過程をみると明らかなように、符号長の短い符号(発生頻度の高い符号)に対しては、1回のテーブルアクセスでハフマンデコードが完了し、符号長の長い符号(発生頻度の低い符号)に対してのみ、2回のテーブルアクセスでハフマンデコードが完了するので、平均として高速な信号処理が実現できる。 As can be seen from the above process, Huffman decoding is completed with one table access for a code with a short code length (a code with a high frequency of occurrence). Since Huffman decoding is completed with only two table accesses only for a low frequency code), high-speed signal processing can be realized on average.
上記が、筆者らが発明した従来の技術である。
ところで、近年、携帯電話機などのようなコンピュータ装置においては、電話をしたりするだけでなく、オーディオの再生だけでなく、ビデオを再生したり、メールを送受信したりできるように、多機能化が図られている。
The above is the conventional technique invented by the authors.
By the way, in recent years, in a computer device such as a mobile phone, not only a phone call but also an audio playback, a video playback, and a mail transmission / reception can be performed. It is illustrated.
このような複数の機能を実現するために、各機能毎にその機能専用の回路を設けると、回路規模が膨大となる。このため、必要に応じてテーブル等のデータを外部メモリ等に格納し、信号処理に必要なときに外部メモリのデータをキャッシュメモリに格納することで、レスポンスを落とさずに、各機能を実現することが考えられている。 In order to realize such a plurality of functions, if a circuit dedicated to each function is provided for each function, the circuit scale becomes enormous. For this reason, each function is realized without dropping the response by storing data such as a table in an external memory as necessary, and storing data in the external memory in a cache memory when necessary for signal processing. It is considered.
このような、キャッシュメモリを搭載した演算装置(信号処理装置)で、上記のようなハフマンデコード処理を行う場合がある。この場合の従来の技術について述べるが、まず、キャッシュメモリの振る舞いについて、簡単に説明する。 Such an Huffman decoding process may be performed by an arithmetic unit (signal processing unit) equipped with a cache memory. The conventional technology in this case will be described. First, the behavior of the cache memory will be briefly described.
図24は、主メモリ1000と、プロセッサ2000と、キャッシュメモリ装置3000との関係を示した図である。
FIG. 24 is a diagram showing the relationship among the
キャッシュメモリ装置3000は、図24に示されるようにデータを格納するためのキャッシュメモリ3100と、リプレース制御するための制御部3200とを備える。
As shown in FIG. 24, the
キャッシュメモリ3100は、ラインと呼ばれる単位でデータが管理される。通常、ラインのサイズは、32バイトとか128バイトといった値であり、キャッシュメモリのサイズは、16kバイトとか32kバイトといった値であるので、キャッシュメモリ3100は、数百から数千のラインで区切られているが、ここでは、説明を簡明にするために、4つのラインで区切られているものとして説明する。
The
主メモリ1000の記憶領域も、当該ラインサイズ毎に区切られる。そして、主メモリ1000の何番目のラインがキャッシュメモリ3100のデータエリア3400のどこに格納されているかということは、キャッシュメモリ3100内のタグ情報のエリア(タグエリア)3300で管理される。
The storage area of the
この図24では、主メモリ1000のLine1,Line3,Line6,Line8のデータがキャッシュメモリ3100のデータエリア3400に格納され、当該ラインを識別するための情報がタグエリア3300に格納されている状態が示されている。
FIG. 24 shows a state in which data of
従って、プロセッサ2000は、主メモリ1000の当該ライン(Line1,Line3,Line6,Line8)のデータをアクセスする場合は、キャッシュメモリ3100をアクセスすることで行える。
Therefore, the
しかしながら、例えば主メモリ1000のLine9をアクセスする場合は、当該領域が今、キャッシュメモリ3100に格納されておらず、かつ、既にキャッシュメモリ3100内に空き領域がないので、キャッシュメモリ3100に今格納されているいずれかのラインのデータを一旦、主メモリ1000に書き戻すことによって、キャッシュメモリ3100に空き領域を確保し、当該空いた領域にLine9のデータを格納することになる。
However, for example, when accessing the
このようなキャッシュメモリ3100を搭載した信号処理装置で、先に説明したハフマンデコード処理を行う場合、例えば、MPEGオーディオのAAC方式の場合、大きなメモリ領域を必要とするので、主メモリ1000にハフマンデコードに必要なすべてのテーブルデータを格納しておいて、逐次、キャッシュメモリ3100にデータを移しながらハフマンデコード処理を行うことになる。
When the above-described Huffman decoding process is performed by a signal processing apparatus equipped with such a
なお、ここで、アクセスとは、アドレスを指定してデータを読み出したり、書き込んだりすることを意味する。
しかしながら、キャッシュメモリを用いた信号処理装置で上記に示したハフマンデコード処理を行うと、以下に示すような問題が生じる。 However, when the Huffman decoding process described above is performed by a signal processing apparatus using a cache memory, the following problems occur.
図25は、キャッシュメモリ3100を用いてハフマンデコードを行う場合の従来の信号処理装置の構成を示すブロック図である。なお、従来の信号処理装置と、本願発明に係る信号処理装置との相違をより明確にするために、ここでは第1及び第2テーブル5000,6000に代えて、後述する第1及び第2テーブル13,14を用いた場合について説明する。
FIG. 25 is a block diagram showing a configuration of a conventional signal processing apparatus when Huffman decoding is performed using the
信号処理装置は、図25に示されるように、主メモリ1000、アクセス手段としてのプロセッサ2000及びキャッシュメモリ3100とを備え、主メモリ1000の第1メモリ領域1001に第1テーブル13が格納され、主メモリ1000の第2メモリ領域1002に第2テーブル14が格納されることにより構成される。
As shown in FIG. 25, the signal processing apparatus includes a
第1テーブル13は、8つのライン(Line0〜Line7)から構成されており、第2テーブル14は7つのライン(Line8〜Line14)から構成されている。第1テーブル13及び第2テーブル14のそれぞれの具体的内容を、図2,図3にそれぞれ示す。第1テーブル13及び第2テーブル14は、従来の技術で先に示した図23(a),図23(b)と同様のデータを格納したテーブルであるが、キャッシュメモリの構成に併せてラインサイズ毎に区切られている点が異なる。
The first table 13 includes eight lines (
さて、今、入力のビット列が、先の例と同様に「01110110000111111011010001111xxxx」と続いている場合、プロセッサ2000は、まず、当該ビット列の最初の6ビットをアドレスとして、第1テーブル13を引く。この場合、「011101」をアドレスとして、第1テーブル13を引くが、当該アドレスが図2に示されるようにLine3にあたるので、当該Line3のデータが主メモリ1000からキャッシュメモリ3100に移された後(図26参照)、プロセッサ2000は、当該データをアクセスし、符号長が5ビットで、デコード結果が「0」であることがわかる。上記符号長が5ビットであったので、プロセッサ2000は、上記ビット列を5ビット進める。そうすると、次のビット列は、「110000111111011010001111xxxx」となる。
Now, when the input bit string continues as “01110110000111111011010001111xxxx” as in the previous example, the
次に、プロセッサ2000は、先ほどと同様に、当該ビット列の最初の6ビットをアドレスとして、第1テーブル13を引く。この場合、「110000」をアドレスとして、第1テーブル13を引くが、当該アドレスは、図2に示されるようにLine6にあたるので、当該Line6のデータが主メモリ1000からキャッシュメモリ3100に移された後(図27参照)、プロセッサ2000は、当該データをアクセスし、符号長が6ビットで、デコード結果が「3」であることがわかる。上記符号長が6ビットであったので上記ビット列を6ビット進めると、ビット列は「111111011010001111xxxx」となる。
Next, the
さらに、先ほどと同様に、プロセッサ2000は、当該ビット列の最初の6ビットをアドレスとして、第1テーブル13を引く。この場合、「111111」をアドレスとして、第1テーブル13を引くが、当該アドレスは、図2に示されるようにLine7にあたるので、プロセッサ2000は、当該Line7のデータが主メモリ1000からキャッシュメモリ3100に移された後(図28参照)、当該データにアクセスし、未完了記号「15」、次のアドレスポインタ「1100010」、次に読み込むビット数「4」を得る。
Further, as before, the
そこで、プロセッサ2000は、第2テーブル14のアドレス「1100010」にポインタを進め、上記ビット列を6ビット進めた後に、続く4ビットの値をアドレス「1100010」からのインデックスとし第2テーブル14を引く。この場合、当該4ビットの値は、「0110」であるので、アドレス「1100010」に「0110」を足して、次にアクセスするアドレスは「1101000」となる。つまり、プロセッサ2000は、次のアドレスポインタ「1100010」に「0110」を足して、次にアクセスするアドレス「1101000」を算出する。
Therefore, the
このアドレスは図3に示されるように、Line13にあたるので、プロセッサ2000は、当該Line13のデータが主メモリ1000からキャッシュメモリ3100に移された後(図29参照)、当該データをアクセスし、符号長が3ビットで、デコード結果が「61」であることがわかる。上記符号長が3ビットであったので上記ビット列を3ビット進めると、ビット列は「010001111xxxx」となる。
Since this address corresponds to Line 13, as shown in FIG. 3, the
次に、先ほどと同様に、プロセッサ2000は、当該ビット列の最初の6ビットをアドレスとして、第1テーブル13を引く。この場合、「010001」をアドレスとして、第1テーブル13を引くが、当該アドレスは、図2に示されるようにLine2にあたるので、当該Line2のデータが主メモリ1000からキャッシュメモリ3100に移された後、当該データにアクセスしようとする。
Next, as before, the
ところが今、キャッシュメモリに空き領域はない。このようにキャッシュメモリ3100を埋め尽くしたデータに必要なデータがない場合、すなわちキャッシュミスした場合、制御部3200は、キャッシュメモリ3100に格納されているいずれかのラインのデータを主メモリ10に書き戻し、それによって生じた空き領域に当該Line2のデータを移す必要がある。
However, there is no free space in the cache memory now. When there is no necessary data in the data in which the
このようなキャッシュミスが発生した場合、通常、一番過去にアクセスされたLineが書き戻されるので、この場合、制御部3200は、Line3を書き戻し(図30参照)、そこにLine2のデータを移す(図31参照)。その後、プロセッサ2000は、当該Line2のデータをアクセスし、符号長が4ビットで、デコード結果が「10」であることがわかる。上記符号長が4ビットであったので上記ビット列を4ビット進めると、ビット列は「01111xxxx」となる。
When such a cache miss occurs, the most recently accessed Line is usually written back. In this case, the
さて次に、先ほどと同様に、プロセッサ2000は当該ビット列の最初の6ビットをアドレスとして、第1テーブル13を引く。この場合、「01111x」をアドレスとして、第1テーブル13を引くが、当該アドレスは、図2に示されるようにLine3にあたるので、当該Line3のデータを主メモリ1000からキャッシュメモリ3100に移した後、当該データにアクセスしようとする。ところが今、キャッシュメモリに空き領域はないので、制御部3200は、キャッシュメモリ3100に格納されているいずれかのラインのデータを主メモリ1000に書き戻し、それによって生じた空き領域に当該Line3のデータを移す。
Next, as before, the
このようなキャッシュミスが発生した場合、通常、LRU方式により一番過去にアクセスされたLineが書き戻されるので、この場合、制御部3200は、Line6を書き戻し(図32参照)、そこにLine3のデータを移す(図33参照)。その後、プロセッサ2000は、当該Line3のデータをアクセスし、符号長が5ビットで、デコード結果16であることがわかる。
When such a cache miss occurs, the most recently accessed Line is normally written back by the LRU method. In this case, the
なお、上記過程において、上記説明では、Line3のデータや、Line6のデータがキャッシュメモリ3100から主メモリ1000に書き戻されるとしたが、本一連の動作の過程では、Line3のデータや、Line6のデータは、キャッシュメモリに格納されている間に値が変化していないので、つまりキャッシュメモリ上での値と主メモリ1000上での値が同一であるので、従来の多くのキャッシュメモリの制御方法では、書き戻すという動作はなく、Line2のデータをLine3のデータが格納されていたキャッシュメモリ3100上に上書きしたり、Line3のデータをLine6のデータが格納されていたキャッシュメモリ上に上書きする、という処理が行われることになる。
In the above process, in the above description, the
しかしながら、上記過程から明らかなように、LRU方式でリプレース対象を決定しているので、キャッシュミスが多発するという問題がある。このようなキャッシュミスの多発は、短い時間の間に、主メモリ1000とキャッシュメモリ3100の間でLine3等のデータ転送が複数回(2回)発生し、データの転送に多大の時間を要し、消費電力も増加するという問題を招く。
However, as is clear from the above process, since the replacement target is determined by the LRU method, there is a problem of frequent cache misses. Such frequent cache misses cause multiple transfers (two times) of data such as
このような問題は、デコード処理の場合に限られず、キャッシュメモリを介して第1及び第2メモリ領域にアクセスし、第1及び第2メモリ領域のデータを読み出すことにより信号処理を行う信号処理装置一般にいえることである。 Such a problem is not limited to the decoding process, and the signal processing apparatus performs signal processing by accessing the first and second memory areas via the cache memory and reading the data in the first and second memory areas. This is generally true.
本発明は、このような従来の問題点に鑑みてなされたものであって、キャッシュメモリを用いた信号処理装置において、キャッシュミスを少なくし、データ伝送時間及びデータの転送量を削減することが可能な信号処理装置を提供することを目的とする。 The present invention has been made in view of such conventional problems, and in a signal processing device using a cache memory, it is possible to reduce cache misses and reduce data transmission time and data transfer amount. An object of the present invention is to provide a possible signal processing device.
ところで、本願発明者は、キャッシュメモリを用いた従来の技術を解析したところ、デコード処理において第1テーブル13へのアクセス頻度が85%で、第2テーブル14へのアクセス頻度が15%である。これにも拘わらず、従来ではLRU方式により第2テーブルのデータをキャッシュメモリに残すアルゴリズムを採用していたため、入れ替えアルゴリズム(Replacement Algorithm)が不適切であることを発見し、本考案を案出するに至った。 By the way, the inventor of the present application has analyzed the conventional technique using the cache memory. As a result, the access frequency to the first table 13 is 85% and the access frequency to the second table 14 is 15% in the decoding process. In spite of this, since the algorithm that leaves the data of the second table in the cache memory by the LRU method has been adopted in the past, the replacement algorithm (Replacement Algorithm) is found to be inappropriate and the present invention is devised. It came to.
そこで、上記目的を達成するために、本発明に係る信号処理装置においては、第1及び第2メモリ領域のデータを用いて信号処理を行う信号処理装置であって、前記データを一時格納するためのキャッシュメモリと、前記キャッシュメモリを介して前記第1及び第2メモリ領域の少なくとも1つにアクセスすることによって前記データを読み出すアクセス手段と、前記キャッシュメモリに一時格納する空き領域が不足した場合に、前記キャッシュメモリに空き領域を確保する制御手段とを備え、前記制御手段は、前記第1メモリ領域のデータが前記第2メモリ領域のデータよりも優先して前記キャッシュメモリに保持されるように、前記空き領域を確保することを特徴とする。 Therefore, in order to achieve the above object, in the signal processing device according to the present invention, the signal processing device performs signal processing using data in the first and second memory areas, and temporarily stores the data. A cache memory, access means for reading out the data by accessing at least one of the first and second memory areas via the cache memory, and when a free area temporarily stored in the cache memory is insufficient And a control means for securing a free area in the cache memory, wherein the control means is such that the data in the first memory area is held in the cache memory in preference to the data in the second memory area. The free space is secured.
この構成により、第1メモリ領域にアクセス頻度の高いデータを格納しておけば、リプレースメント アルゴリズムが適切となる。したがって、キャッシュメモリを用いた信号処理装置において、キャッシュミスを少なくし、データ伝送時間及びデータの転送量を削減した信号処理装置を提供することが可能となる。 With this configuration, if the frequently accessed data is stored in the first memory area, the replacement algorithm becomes appropriate. Therefore, it is possible to provide a signal processing device that uses a cache memory to reduce cache misses and reduce data transmission time and data transfer amount.
また、本発明に係る信号処理装置においては、前記信号処理装置はさらに、前記第1メモリ領域が前記第2メモリ領域よりも強度が強いことを示す強度属性を格納する属性格納手段を備え、前記制御手段は、前記属性格納手段に格納された強度属性に応じて、前記キャッシュメモリに保持するデータを決定することを特徴とすることができる。 In the signal processing device according to the present invention, the signal processing device further includes attribute storage means for storing an intensity attribute indicating that the first memory area is stronger than the second memory area, The control means may determine data to be held in the cache memory according to the strength attribute stored in the attribute storage means.
この構成により、リプレースメント アルゴリズムが確実に適切となり、第2メモリ領域のデータに対して割り当てられるキャッシュメモリのデータ領域を最小限にすますことができる。 With this configuration, the replacement algorithm is surely appropriate, and the data area of the cache memory allocated to the data in the second memory area can be minimized.
また、本発明に係る信号処理装置においては、前記アクセス手段は、前記第1メモリ領域については、前記第1メモリ領域のデータを前記キャッシュメモリに移してからアクセスし、前記第2メモリ領域については、前記第2メモリ領域のデータを前記キャッシュメモリに移さないでアクセスすることを特徴としてもよい。 In the signal processing device according to the present invention, the access means accesses the first memory area after transferring the data in the first memory area to the cache memory, and accesses the second memory area. The data in the second memory area may be accessed without being transferred to the cache memory.
この構成により、リプレースメント アルゴリズムが確実に適切となり、第2メモリ領域のデータに対して割り当てられるキャッシュメモリのデータ領域をなくし、キャッシュメモリデータ領域をすべて第1メモリ領域のデータに対して割り当てることができる。 With this configuration, the replacement algorithm is surely appropriate, the cache memory data area allocated to the data in the second memory area can be eliminated, and the entire cache memory data area can be allocated to the data in the first memory area. .
また、本発明に係る信号処理装置においては、前記第1メモリ領域は、前記第2メモリ領域よりもアクセス頻度が高いデータを格納することを特徴とすることもできる。 In the signal processing device according to the present invention, the first memory area stores data having a higher access frequency than the second memory area.
この構成により、リプレースメント アルゴリズムを確実に適切とすることができる。
また、本発明に係る信号処理装置においては、前記第1及び第2メモリ領域は、それぞれ、入力データを一定規則に従って変換するための変換規則を示す第1及び第2テーブルを保持し、前記制御手段は、前記第2テーブルのデータが前記第1テーブルのデータよりも優先して前記キャッシュメモリから廃棄されるように、前記空き領域を確保することを特徴とすることができる。
This configuration ensures that the replacement algorithm is appropriate.
In the signal processing device according to the present invention, the first and second memory areas hold first and second tables indicating conversion rules for converting input data according to a predetermined rule, respectively, and the control The means may secure the free area so that the data of the second table is discarded from the cache memory in preference to the data of the first table.
この構成により、第1メモリ領域にアクセス頻度の高い第1テーブルを格納しておけば、リプレースメント アルゴリズムが適切となる。したがって、キャッシュメモリを用いた信号処理装置において、キャッシュミスを少なくし、データ伝送時間及びデータの転送量を削減しつつ、入力データを一定規則に従って変換する信号処理装置を提供することが可能となる。 With this configuration, if the first table with high access frequency is stored in the first memory area, the replacement algorithm is appropriate. Therefore, in a signal processing device using a cache memory, it is possible to provide a signal processing device that converts input data according to a certain rule while reducing cache misses and reducing data transmission time and data transfer amount. .
また、本発明に係る信号処理装置においては、前記信号処理装置はさらに、前記第1テーブルが前記第2テーブルよりも強度が強いことを示す強度属性を格納する属性格納手段を備え、前記制御手段は、前記属性格納手段に格納された強度属性に応じて、前記キャッシュメモリから廃棄するデータを決定することを特徴としてもよい。 In the signal processing device according to the present invention, the signal processing device further includes attribute storage means for storing an intensity attribute indicating that the first table is stronger than the second table, and the control means May determine the data to be discarded from the cache memory according to the strength attribute stored in the attribute storage means.
この構成により、第1メモリ領域にアクセス頻度の高い第1テーブルを格納しておけば、リプレースメント アルゴリズムが確実に適切となり、第2メモリ領域のデータに対して割り当てられるキャッシュメモリのデータ領域を最小限にすますことができる。 With this configuration, if the first table with high access frequency is stored in the first memory area, the replacement algorithm is surely appropriate, and the cache memory data area allocated to the data in the second memory area is minimized. Can be
また、本発明に係る信号処理装置においては、前記信号処理装置は、入力データであるハフマン符号をデコードする装置であり、前記ハフマン符号は、符号長の最長ビットがNビットであり、前記第1テーブルは、nを1以上でN未満の整数としたときに、nビット以下の符号データをデコードするためのテーブルであり、前記第2テーブルは、前記nビットよりも長い符号データをデコードするためのテーブルであることを特徴とすることもできる。 Further, in the signal processing device according to the present invention, the signal processing device is a device that decodes a Huffman code that is input data, and the Huffman code has a longest code length of N bits, The table is a table for decoding code data of n bits or less when n is an integer of 1 to less than N, and the second table is for decoding code data longer than the n bits. It can also be characterized by being a table.
この構成により、第1メモリ領域にアクセス頻度の高い符号長の短いハフマン符号デコード用の第1テーブルが格納されるので、リプレースメント アルゴリズムが確実に適切となり、第2メモリ領域のデータに対して割り当てられるキャッシュメモリのデータ領域を最小限にすますことができる。 With this configuration, since the first table for decoding a short Huffman code having a high code frequency is stored in the first memory area, the replacement algorithm is surely appropriate and assigned to the data in the second memory area. The data area of the cache memory can be minimized.
なお、本発明は、このような信号処理装置として実現することができるだけでなく、このような信号処理装置が備える特徴的な手段をステップとする信号処理方法として実現したり、それらのステップをコンピュータに実行させるプログラムとして実現したりすることもできる。そして、そのようなプログラムは、CD−ROM等の記録媒体やインターネット等の伝送媒体を介して配信することができるのはいうまでもない。 Note that the present invention can be realized not only as such a signal processing device but also as a signal processing method using steps characteristic of the signal processing device as a step. It can also be realized as a program to be executed. Needless to say, such a program can be distributed via a recording medium such as a CD-ROM or a transmission medium such as the Internet.
以上の説明から明らかなように、本発明に係る信号処理装置によれば、第1メモリ領域にアクセス頻度の高いデータを格納しておけば、リプレースメント アルゴリズムが適切となるので、キャッシュメモリを用いた信号処理装置において、キャッシュミスを少なくし、データ伝送時間及びデータの転送量を削減した信号処理装置を提供することが可能となる。 As is clear from the above description, according to the signal processing device according to the present invention, if the frequently accessed data is stored in the first memory area, the replacement algorithm becomes appropriate. In the signal processing device, it is possible to provide a signal processing device in which cache misses are reduced and data transmission time and data transfer amount are reduced.
よって、本発明により、キャッシュミスが少なく、データ伝送時間及びデータの転送量を削減した信号処理が可能となり、多機能の携帯電話機などのコンピュータ装置が普及してきた今日における本願発明の実用的価値は極めて高い。 Therefore, according to the present invention, signal processing with fewer cache misses and reduced data transmission time and data transfer amount is possible, and the practical value of the present invention in the present day when computer devices such as multifunctional mobile phones have become widespread. Extremely expensive.
以下、本発明の実施の形態に係る信号処理装置について図面を参照しながら説明する。
<全体構成>
(実施の形態1)
図1は、本発明の実施の形態1に係る信号処理装置1の全体構成を示すブロック図である。なお、図1では、信号処理装置1を、図22のMPEG−AAC規格のハフマンコードブック(例えば、8)を用いてハフマン符号にエンコードされたビット列をデコードするデコーダとして機能させる場合が図示されている。
Hereinafter, a signal processing device according to an embodiment of the present invention will be described with reference to the drawings.
<Overall configuration>
(Embodiment 1)
FIG. 1 is a block diagram showing an overall configuration of a
図1に示されるように信号処理装置1は、主メモリ10と、アクセス手段としてのプロセッサ20と、キャッシュメモリ装置30等とを備える。
As shown in FIG. 1, the
主メモリ10は、DRAM等により構成され、第1メモリ領域11に1段階でデコード処理するための1段階用の第1テーブル13を、第2の領域12に2段階でデコード処理するための2段階用の第2テーブル14を、それぞれ記憶する。
The
キャッシュメモリ装置30は、SRAM等により構成され、タグエリア、データエリア、データエリアに残る確率の高さである強度の属性を示すウィークフラグW、書き戻しの要否を表すダーティフラグD等を記憶するキャッシュメモリ34と、リプレース制御を行う制御部51と、キャッシュメモリ34に残る確率の高さを設定するためデータ(属性データ)を格納する属性格納部52等とを備え、いわゆるLRU方式によってアクセス順序の古いキャッシュエントリをリプレースするリプレース制御を前提とした上で、リプレース対象を決定するためのアクセス順序を示す順序データを、アクセス順序に反して改変することにより、アクセス頻度の低いデータを保持するキャッシュエントリをリプレース対象としてキャッシュメモリから追い出すよう構成されている。具体的には、アクセス順序が最古であるとみなすことを示すウィークフラグWをキャッシュエントリに付加することによって、順序データを間接的に改変している。これにより順序データを直接改変する複雑な回路を不要としている。
The
プロセッサ20は、デコード処理を開始するにあたって、主メモリ10の第1メモリ領域11に第1テーブル13を、第2メモリ領域12に第2テーブル14を書き込んだり、予め定められた属性値設定データに基づいて、属性格納部52に強度属性を設定したりする。そして、プロセッサ20は、デコード対象のハフマン符号列をアドレスとしてキャッシュメモリにアクセスすることにより、デコード結果を取得する。
When starting the decoding process, the
図2は第1テーブル13の構成を示す図であり、図3は第2テーブル14の構成を示す図である。 FIG. 2 is a diagram showing the configuration of the first table 13, and FIG. 3 is a diagram showing the configuration of the second table 14.
第1テーブル13及び第2テーブル14は、入力データを一定規則に従って変換するための変換規則を示すものであり、具体的には、エンコードの際に用いられたハフマンコードブックに対応し、第1メモリ領域11と第2メモリ領域12とにそれぞれマップされる。
The first table 13 and the second table 14 show conversion rules for converting the input data according to a certain rule. Specifically, the first table 13 and the second table 14 correspond to the Huffman codebook used for encoding, Maps to the
第1テーブル13は、ビットストリームから読み出した所定ビット数データに含まれ得る、所定数(6ビット)以下のビット数を有する比較的符号長の短いハフマン符号をデコード結果にデコードするためのテーブルである。また、第2テーブル14は、短いハフマン符号でデコードが完了しなかった場合に第1テーブル13により取得されるアドレスポインタと、次の取得点で示されるビット長のハフマン符号とに基づいて算出される所定数を超えるビット数を有する比較的符号長の長いハフマン符号をデコードするためのテーブルである。このように、比較的短いハフマン符号と比較的長いハフマン符号とは、第1テーブル13及び第2テーブル14を用いた処理によってデコードされる。 The first table 13 is a table for decoding a relatively short code length Huffman code having a bit number equal to or less than a predetermined number (6 bits), which can be included in the predetermined bit number data read from the bit stream, into a decoding result. is there. The second table 14 is calculated based on the address pointer acquired by the first table 13 when decoding is not completed with a short Huffman code and the bit length Huffman code indicated by the next acquisition point. 3 is a table for decoding a Huffman code having a relatively long code length having a number of bits exceeding a predetermined number. As described above, the relatively short Huffman code and the relatively long Huffman code are decoded by the processing using the first table 13 and the second table 14.
第1テーブル13は、図2に示されるように、符号長又は未完了記号(ここでは、「15」)のデータが格納される欄と、デコード結果又は次のアドレスのデータが格納される欄と、次の取得長のデータが格納される欄とから構成される。なお、この第1テーブル13の左側には、説明の便宜のため、これらのデータが格納されるアドレスと、ラインとが示されている。 As shown in FIG. 2, the first table 13 includes a column in which data of a code length or an incomplete symbol (here, “15”) is stored, and a column in which data of a decoding result or a next address is stored. And a field for storing data of the next acquisition length. Note that, on the left side of the first table 13, for convenience of explanation, addresses and lines where these data are stored are shown.
第2テーブル14は、図3に示されるように、符号長のデータが格納される欄と、デコード結果のデータが格納される欄とから構成される。この第2テーブル14の左側には、説明の便宜のため、アドレスを求めるための次のインデックスデータと、これらのデータが格納されるアドレスと、ラインとが示されている。 As shown in FIG. 3, the second table 14 includes a column for storing code-length data and a column for storing decoding result data. On the left side of the second table 14, for the convenience of explanation, the next index data for obtaining an address, an address where these data are stored, and a line are shown.
なお、ハフマンエンコードにおいては、一般に出現頻度のより高い入力値に対して、より短いハフマン符号が割り当てられ、出現頻度のより低い入力値に対して、より長いハフマン符号が割り当てられる。したがって、デコード処理においては、第2テーブル14よりも第1テーブル13の方がアクセス頻度が高いことになる。 In Huffman encoding, a shorter Huffman code is generally assigned to an input value having a higher appearance frequency, and a longer Huffman code is assigned to an input value having a lower appearance frequency. Therefore, in the decoding process, the first table 13 has a higher access frequency than the second table 14.
図4は、属性格納部52に格納される属性データの内容の一例を示した図である。
この場合、第1テーブル13にあたるLine0からLine7は強度が大(ウィークフラグWが「0」)で、第2テーブル14にあたるLine8からLine14は強度が小(ウィークフラグWが「1」)であることが示されている。このような強度属性が設定されることにより、適切なリプレイスメント アルゴリズムが発揮され、キャッシュミスが減少されることになる。
<キャッシュメモリ装置の具体的構成>
図5は、キャッシュメモリ装置30の具体的構成例を示すブロック図である。なお、ここではキャッシュメモリ装置30の具体例として、4ウェイ・セット・アソシエイティブ方式のキャッシュメモリに本発明を適用した場合の構成について説明する。
FIG. 4 is a diagram illustrating an example of the contents of attribute data stored in the
In this case, the strength of
<Specific Configuration of Cache Memory Device>
FIG. 5 is a block diagram illustrating a specific configuration example of the
図5に示されるように、キャッシュメモリ装置30は、アドレスレジスタ31、メモリI/F32、デコーダ33、4つのウェイ34a〜34d(以下「ウェイ0〜3」とも略記する。)、4つの比較器35a〜35d、4つのアンド回路36a〜36d、セレクタ38、セレクタ39、デマルチプレクサ41及びキャッシュ制御部42を備える。キャッシュ制御部42は、リプレース部42aと、Wフラグ設定部42bとを含む。
As shown in FIG. 5, the
なお、このキャッシュメモリ装置30の具体例におけるリプレース部42aは図1の制御部51に該当し、Wフラグ設定部42bは図1の属性格納部52に該当する。
In the specific example of the
アドレスレジスタ31は、主メモリ10へのアクセスアドレスを保持するレジスタである。このアクセスアドレスは32ビットであるものとする。図5に示されるように、アクセスアドレスは、最上位ビットから順に、21ビットのタグアドレス、4ビットのセットインデックス(図5中のSI)、5ビットのワードインデックス(図5中のWI)を含む。ここで、タグアドレスは、ウェイにマッピングされるメモリ中の領域(そのサイズはセット数×ブロックである)を指す。この領域のサイズは、タグアドレスよりも下位のアドレスビット(A10〜A0)で定まるサイズつまり2kバイトであり、1つのウェイのサイズでもある。セットインデックス(SI)は、ウェイ0〜3に跨る複数セットの1つを指す。このセット数は、セットインデックスが4ビットなので16セットある。タグアドレス及びセットインデックスで特定されるキャッシュエントリは、リプレース単位であり、キャッシュメモリに格納されている場合はラインデータ又はラインと呼ばれる。ラインデータのサイズは、セットインデックスよりも下位のアドレスビットで定まるサイズつまり128バイトである。1ワードを4バイトとすると、1ラインデータは32ワードである。ワードインデックス(WI)は、ラインデータを構成する複数ワード中の1ワードを指す。アドレスレジスタ31中の最下位2ビット(A1、A0)は、ワードアクセス時には無視される。
The
メモリI/F32は、主メモリ10からキャッシュメモリ装置30へのデータのロードや、キャッシュメモリ装置30から主メモリ10へのデータのライトバック等、キャッシュメモリ装置30から主メモリ10をアクセスするためのI/Fである。
The memory I /
デコーダ33は、セットインデックスの4ビットをデコードし、4つのウェイ0〜3に跨る16セット中の1つを選択する。
The
4つのウェイ0〜3は、同じ構成を有する4つのウェイであり、4×2kバイトの容量を有する。各ウェイは、16個のキャッシュエントリを有する。
The four
図6は、図5に示される1つのキャッシュエントリにおける詳細なビット構成を示す図である。 FIG. 6 is a diagram showing a detailed bit configuration in one cache entry shown in FIG.
図6に示されるように、1つのキャッシュエントリは、バリッドフラグV0〜V3、21ビットのタグ、128バイトのラインデータ、ウィークフラグW、ダーティフラグD0〜D3を有する。 As shown in FIG. 6, one cache entry has valid flags V0 to V3, a 21-bit tag, 128-byte line data, a weak flag W, and dirty flags D0 to D3.
タグは、21ビットのタグアドレスのコピーである。
ラインデータは、タグアドレス及びセットインデックスにより特定されるブロック中の128バイトデータのコピーであり、32バイトの4つのサブラインからなる。
A tag is a copy of a 21-bit tag address.
The line data is a copy of 128-byte data in the block specified by the tag address and the set index, and consists of four 32-byte sub-lines.
バリッドフラグV0〜V3は、4つのサブラインに対応し、サブラインが有効か否かを示す。 Valid flags V0 to V3 correspond to four sublines and indicate whether or not the sublines are valid.
ウィークフラグWは、当該キャッシュエントリのアクセス順序が最も古いものとみなすためのフラグである。つまり、W=1のとき、プロセッサ20からは当該キャッシュエントリにこれ以上読み出しも書き込みもなされないこと、あるいはアクセス頻度が低いことを意味する。また、W=1のとき、キャッシュメモリ装置30においては、リプレース制御に関してアクセス順序が最古であると取り扱うこと、つまり、最弱(ウィーク)のキャシュエントリーであることを意味する。W=0のとき、そうでないことを意味する。
The weak flag W is a flag for regarding that the access order of the cache entry is the oldest. That is, when W = 1, it means that the
ダーティフラグD0〜D3は、4つのサブラインに対応し、そのサブラインにプロセッサ20から書き込みがあったか否かを示す。つまり、サブライン中にキャッシュされたデータが存在するが、書き込みにより主メモリ10中のデータと異なるため、主メモリ10に書き戻すことが必要か否かを示す。
Dirty flags D0 to D3 correspond to four sublines and indicate whether or not the
比較器35aは、アドレスレジスタ31中のタグアドレスと、セットインデックスにより選択されたセットに含まれる4つのタグ中のウェイ0のタグとが一致するか否かを比較する。比較器35b〜35cについても、ウェイ34b〜34dに対応すること以外は同様である。
The comparator 35a compares whether or not the tag address in the address register 31 matches the tag of the
アンド回路36aは、バリッドフラグと比較器35aの比較結果とが一致するか否かを比較する。比較結果が「1」である場合は、アドレスレジスタ31中のタグアドレス及びセットインデックスに対応するラインデータが存在すること、つまりウェイ0においてヒットしたことを意味する。比較結果が「0」である場合は、キャッシュミスしたことを意味する。アンド回路36b〜36dについても、ウェイ34b〜34dに対応すること以外は同様である。その比較結果は、ウェイ1〜3でヒットしたかキャッシュミスしたかを、それぞれ意味する。
The AND
セレクタ38は、選択されたセットにおけるウェイ0〜3のラインデータのうち、ヒットしたウェイのラインデータを選択する。
The
セレクタ39は、セレクタ38により選択された32ワードのラインデータのうち、ワードインデックスに示される1ワードを選択する。
The
デマルチプレクサ41は、キャッシュエントリにデータを書き込む際に、ウェイ0〜3の1つに書き込みデータを出力する。この書き込みデータはワード単位でよい。
The
キャッシュ制御部42は、キャッシュメモリ装置30の全体の制御を行う。特に、Wフラグの設定とWフラグに従うリプレース制御を行う。
The
図7は、キャッシュ制御部42の構成を示すブロック図である。
キャッシュ制御部42は、上記したように図1の制御部51に該当するリプレース部42aと、図1の属性格納部52に該当するWフラグ設定部42bとを含む。
FIG. 7 is a block diagram illustrating a configuration of the
As described above, the
リプレース部42aは、キャッシュミスによるリプレースに際して、W=1が設定されているキャッシュエントリが存在すれば、当該キャッシュエントリのアクセス順序が最も古いとみなしてリプレース対象として選択し、リプレースを行う。
In the case of replacement due to a cache miss, if there is a cache entry for which W = 1 is set, the
Wフラグ設定部42bは、プロセッサ20からのコマンドに応じてウィークフラグWを設定する。プロセッサ20は、もはや書き込みも読み出しもしないキャッシュエントリについてウィークフラグWの設定を指示するコマンドをキャッシュメモリ装置30に対して発行する。
The W
図8は、Wフラグ設定部42bの構成例を示すブロック図である。
図8に示されるように、Wフラグ設定部42bは、コマンドレジスタ421、スタートアドレスレジスタ422、サイズレジスタ423、スタートアライナ424、加算器425、エンドアライナ426、フラグ書換部427を備える。
FIG. 8 is a block diagram illustrating a configuration example of the W
As shown in FIG. 8, the W
コマンドレジスタ421は、プロセッサ20から直接アクセス可能なレジスタであり、プロセッサ20により書き込まれたWフラグ設定コマンドを保持する。
The
図9(a)に、コマンドレジスタ421にコマンドを書き込む命令の一例を示す。
この命令は、通常の転送命令(mov命令)であり、ソースオペランドとしてコマンドを、デスティネーションオペランドとしてコマンドレジスタ(CR)を指定している。
FIG. 9A shows an example of an instruction for writing a command to the
This instruction is a normal transfer instruction (mov instruction), and designates a command as a source operand and a command register (CR) as a destination operand.
図9(b)に、コマンドの一例を示す。このコマンドは、Wフラグ設定コマンドを示す特定のコードである。Wフラグ設定コマンドは、スタートアドレスレジスタ422に保持されたスタートアドレスからサイズレジスタ423に保持されたサイズのアドレス範囲に対応するデータを保持するキャッシュエントリに対して、Wフラグを設定することを指示するコマンドである。
FIG. 9B shows an example of the command. This command is a specific code indicating a W flag setting command. The W flag setting command instructs the cache entry that sets data corresponding to the address range of the size held in the size register 423 from the start address held in the
スタートアドレスレジスタ422は、プロセッサ20から直接アクセス可能なレジスタであり、プロセッサ20により書き込まれたスタートアドレスを保持する。このスタートアドレスはWフラグを設定すべきアドレス範囲の開始位置を示す。
The
図9(c)に、スタートアドレスレジスタ422にスタートアドレスを書き込む命令の一例を示す。この命令も、図9(a)と同様に通常の転送命令(mov命令)である。
FIG. 9C shows an example of an instruction for writing a start address in the
サイズレジスタ423は、プロセッサ20から直接アクセス可能なレジスタであり、プロセッサ20により書き込まれたサイズを保持する。このサイズは、スタートアドレスからのアドレス範囲を示す。
The
図9(d)に、サイズレジスタ423にサイズを書き込む命令の一例を示す。この命令も、図9(a)と同様に通常の転送命令(mov命令)である。なお、サイズの単位は、バイト数であっても、ライン数(キャッシュエントリ数)であってもよく、予め定められた単位であればよい。
FIG. 9D shows an example of an instruction for writing a size in the
スタートアライナ424は、スタートアドレスをライン境界の位置に調整する。この調整によりプロセッサ20はラインサイズ及びライン境界とは無関係に任意のアドレスをスタートアドレスとして指定することができる。
The
加算器425は、スタートアドレスレジスタ422に保持されたスタートアドレスとサイズレジスタ423に保持されたサイズとを加算する。加算結果は、アドレス範囲の終了位置を指すエンドアドレスである。加算器425は、サイズがバイト数指定の場合はバイトアドレスとして加算し、サイズがライン数指定の場合はラインアドレスとして加算すればよい。
The
エンドアライナ426は、エンドアドレスをライン境界の位置に調整する。この調整によりプロセッサ20はラインサイズ及びライン境界とは無関係に任意の大きさを上記サイズとして指定することができる。
The
図10に、スタートアライナ424及びエンドアライナ426の説明図を示す。
図10において、プロセッサ20から指定されたスタートアドレスはラインNの途中の任意の位置を指す。スタートアライナ424は、次のライン(N+1)の先頭を指すよう調整し、調整後のアドレスをアラインスタートアドレスとして出力する。アラインスタートアドレスが指すラインをスタートラインと呼ぶ。
FIG. 10 is an explanatory diagram of the
In FIG. 10, the start address designated by the
また、エンドアドレスはラインMの途中の任意の位置を指す。エンドアライナ426は、直前のライン(M−1)の先頭を指すよう調整し、調整後のアドレスをアラインエンドアドレスとして出力する。アラインエンドアドレスが指すラインをエンドラインと呼ぶ。
The end address indicates an arbitrary position in the middle of the line M.
この場合、スタートライン(ライン(N+1))からエンドライン(ライン(M−1))までの各ライン(キャッシュエントリ)にWフラグが設定されることになる。このように、スタートアライナ424及びエンドアライナ426がプロセッサ20から指定されたスタートアドレスからエンドアドレスまでのアドレス範囲よりも内側にアラインしているのは、ラインNとラインMの外側の部分にはプロセッサ20から読み出し又は書き込みが発生する可能性があるからである。
In this case, the W flag is set in each line (cache entry) from the start line (line (N + 1)) to the end line (line (M-1)). As described above, the
フラグ書換部427は、アラインスタートアドレスが指すラインからアラインエンドアドレスが指すラインまで(図10の例ではライン(N+1)からライン(M−1)まで)、キャッシュメモリ装置30にエントリされていればWフラグを1に設定する。
<Wフラグ設定処理>
図11は、フラグ書換部427におけるWフラグ設定処理の一例を示すフローチャートである。
If the
<W flag setting process>
FIG. 11 is a flowchart illustrating an example of the W flag setting process in the
フラグ書換部427は、コマンドレジスタ421にWフラグ設定コマンドが保持されている場合、スタートラインからエンドラインまでの各ラインアドレスを順に出力しながらループ1の処理(S82〜S86)を行う。フラグ書換部427は、各ラインについて同じ処理を行うので、ここでは1ライン分の処理について説明する。
When the W flag setting command is held in the
すなわち、フラグ書換部427は、キャッシュメモリ装置30がプロセッサ20からアクセスされていない間に、ラインアドレスをアドレスレジスタ31に出力し(S83)、アドレスレジスタ31のタグアドレスとキャッシュエントリのタグとを比較器35a〜35dに比較させ、ヒットするかどうかを判定する(S84)。さらにフラグ書換部427は、ヒットした場合には、ヒットしたキャッシュエントリに対してWフラグを1にセットし(S85)、キャッシュミスした場合には、キャッシュメモリにエントリされていないので、なにもしない。
That is, the
これにより、スタートラインからエンドラインまでの各ラインについて、キャッシュメモリ装置30にエントリされている場合には、Wフラグが「1」に設定される。
<リプレース処理>
図12は、リプレース部42aにおけるリプレース処理を示すフローチャートである。
Thus, if each line from the start line to the end line is entered in the
<Replace processing>
FIG. 12 is a flowchart showing the replacement process in the
同図12においてリプレース部42aは、メモリアクセスがキャッシュミスしたとき(S91)、セットインデックスにより選択されたセットにおける、4つウェイのウィークフラグWを読み出し(S92)、4つのウィークフラグの論理和が1であるか否か、つまりW=1のウェイが存在するか否かを判定する(S93)。W=1のウェイが存在すると判定された場合、当該キャッシュエントリのアクセス順序が最も古いとみなしてW=1のウェイを1つ選択し(S94)、W=1のウェイが存在しないと判定された場合、通常のLRU方式によりウェイを1つ選択する(S95)。このとき、ウィークフラグWが1になっているウェイが複数存在する場合は、リプレース部42aはランダムに1つを選択する。
In FIG. 12, when the memory access causes a cache miss (S91), the
さらに、リプレース部42aは、当該セットにおける選択されたウェイのキャッシュエントリを対象にリプレースし(S96)、リプレース後に当該キャッシュエントリのウィークフラグWを0初期化する(S97)。なお、このときバリッドフラグV、ダーティフラグDは、それぞれ1、0に初期化される。
Further, the
このように、W=1のウェイが存在しない場合、リプレース対象は、通常のLRU方式により選択される。また、W=1のウェイが存在する場合、リプレース対象は、W=1のウェイのアクセス順序が最も古いものと取り扱われる結果、W=1のウェイのキャッシュエントリが選択される。これにより、アクセス頻度の低いW=1のデータがキャッシュメモリに存在するために生じるキャッシュミスを低減することができる。 As described above, when there is no way of W = 1, the replacement target is selected by the normal LRU method. When there is a way of W = 1, the replacement target is treated as the oldest access order of the way of W = 1, and as a result, the cache entry of the way of W = 1 is selected. As a result, it is possible to reduce cache misses caused by the fact that W = 1 data with low access frequency exists in the cache memory.
以上説明してきたように、本実施の形態1におけるキャッシュメモリによれば、ウィークフラグW=1のラインは、プロセッサからこれ以上読み出しも書き込みもなされないラインであり、そのアクセス順序が最古として取り扱われる結果、真っ先にリプレース対象として選択される。これによりアクセス頻度の低いデータによるキャッシュミスの誘発を低減することができる。 As described above, according to the cache memory of the first embodiment, the line with the weak flag W = 1 is a line on which no further reading or writing is performed from the processor, and the access order is treated as the oldest. As a result, it is selected as the replacement target first. As a result, it is possible to reduce the occurrence of a cache miss due to data with low access frequency.
また、従来のLRU方式におけるアクセス順序を示す順序データを直接改変することなく、間接的にWフラグを付加することによってアクセス順序を改変しているので、複雑なハードウェア回路を追加することなく、実現することができる。 In addition, since the access order is modified by adding the W flag indirectly without directly modifying the order data indicating the access order in the conventional LRU method, without adding a complicated hardware circuit, Can be realized.
次いで、信号処理装置1の各部が実行する動作を説明する。
図13から図19は、キャッシュメモリ34に格納されるデータの流れを示した図である。
Next, operations performed by each unit of the
13 to 19 are diagrams showing the flow of data stored in the
本実施の形態1では、図22のMPEG−AAC規格のハフマンコードブック8を用いてエンコードされた符号をデコードする信号処理装置1を例にとり説明する。
In the first embodiment, a
なお、従来の信号処理装置との動作の差異を明らかにするために、キャッシュメモリ34の1つのウェイの4セットだけを使用するものとし、また、入力のビット列が、従来と同様「01110110000111111011010001111xxxx」と続いているものとして説明する。
In order to clarify the difference in operation with the conventional signal processing apparatus, only four sets of one way of the
図13に示されるように、プロセッサ20は、まず、当該ビット列の最初の6ビット「011101」をアドレスとして、第1テーブル13を引く。この場合、当該アドレス「011101」がLine3にあたるので(図2参照)、当該Line3のデータが主メモリ10からキャッシュメモリ34に移された後、アドレス「011101」のデータをアクセスし、符号長5ビットと、デコード結果「0」とを取得する。
As shown in FIG. 13, the
より詳しくは、プロセッサ20は、キャッシュメモリ装置30に対して、ビット列の最初の6ビット「011101」をアドレスとして、リード信号を出力する。「011101」をアドレスとするリード信号を受信したキャッシュメモリ装置30は、キャッシュメモリ34にLine3のデータが存在しないので、Line3の先頭から最終までをアドレス指定することによりLine3のデータをキャッシュメモリ34の1つのセットに書き込む。そして、タグにはLine3が、Wフラグには「0」が、ダーティフラグDには「0」が書き込まれる。これらの書き込みが終わると、キャッシュメモリ装置30は、アドレス「011101」のデータ、符号長5ビットと、デコード結果「0」とをプロセッサ20に出力する。
More specifically, the
そして、符号長5ビットと、デコード結果「0」とを取得すると、プロセッサ20は、後の信号処理(逆量子化処理、IMDCT(Inverse Modified Discrete Cosine Transform)処理等)を行うためにデコード結果「0」をバッファ等に出力した後、上記符号長が5ビットであったので、上記ビット列を5ビット進める。つまり、取得点Pを5ビット移動させる。そうすると、次のビット列は「110000111111011010001111xxxx」となる。
When the code length of 5 bits and the decoding result “0” are acquired, the
次のビット列が「110000111111011010001111xxxx」である場合、図14に示されるように、先ほどと同様に、プロセッサ20は、当該ビット列の最初の6ビット「110000」をアドレスとして、第1テーブル13を引く。この場合、当該アドレス「110000」がLine6にあたるので(図2参照)、当該Line6のデータが主メモリ10からキャッシュメモリ34に移された後(図14)、当該アドレス「110000」のデータをアクセスし、符号長6ビット、デコード結果「3」を取得する。
When the next bit string is “110000111111011010001111xxxx”, as shown in FIG. 14, the
なお、タグにはLine6が、Wフラグには「0」が、ダーティフラグDには「0」が書き込まれる。
Note that
そして、プロセッサ20は、デコード結果「3」を出力した後、上記符号長が6ビットであったので、上記ビット列を6ビット進める。つまり、取得点Pを6ビット移動させる。上記符号長が6ビットであったので、上記ビット列を6ビット進めると、次のビット列は「111111011010001111xxxx」となる。
Then, after outputting the decoding result “3”, the
次のビット列が「111111011010001111xxxx」である場合、図15に示されるように、プロセッサ20は、先ほどと同様に、当該ビット列の最初の6ビット「111111」をアドレスとして、第1テーブル13を引く。この場合、当該アドレス「111111」がLine7にあたるので(図2参照)、当該Line7のデータが主メモリ10からキャッシュメモリ34に移された後、当該アドレス「111111」のデータにアクセスし、未完了記号「15」、次のアドレスポインタ「1100010」、次に読み込むビット数「4」を取得する。
When the next bit string is “111111011010001111xxxx”, as shown in FIG. 15, the
なお、タグにはLine7が、Wフラグには「0」が、ダーティフラグDには「0」が書き込まれる。ここで、キャッシュメモリ装置30のデータの取得動作については、上記の場合と同様であるので、その説明を以下省略する。
Note that
そこで、図3に示した第2テーブル14のアドレス「1100010」にポインタを進め、上記ビット列を6ビット進めた後に、続く4ビットの値をアドレス「1100010」からのインデックスとし、第2テーブル14を引く。この場合、当該4ビットの値は、「0110」であるので、アドレス「1100010」に「0110」を足して、次にアクセスするアドレスは「1101000」となる。 Therefore, the pointer is advanced to the address “1100010” of the second table 14 shown in FIG. 3, the bit string is advanced by 6 bits, and the subsequent 4-bit value is used as an index from the address “1100010”. Pull. In this case, since the 4-bit value is “0110”, “0110” is added to the address “1100010”, and the next access address is “1101000”.
つまり、プロセッサ20は、図16に示されるように、次の4ビット「0110」を取得し、先に取得したアドレス「1100010」に次の4ビット「0110」を足して、次にアクセスするアドレスを「1101000」を計算する。
That is, as shown in FIG. 16, the
計算が終わると、プロセッサ20は、計算により得られた「1101000」をアドレスとして、第2テーブル14を引く。このアドレス「1101000」がLine13にあたるので(図3参照)、当該Line13のデータが主メモリ10からキャッシュメモリ34に移された後、プロセッサ20は、当該データをアクセスし、符号長3ビット、デコード結果「61」を取得する。
When the calculation is completed, the
なお、タグにはLine13が、Wフラグには「1」が、ダーティフラグDには「0」が書き込まれる。
Note that
そして、プロセッサ20は、デコード結果「61」を出力した後、上記符号長が3ビットであったので、上記ビット列を3ビット進める。つまり、取得点Pを6+3=9ビット移動させる。取得点Pを移動させると、次のビット列は「010001111xxxx」となる。
Then, after outputting the decoding result “61”, the
次のビット列が「010001111xxxx」である場合、図17に示されるように、プロセッサ20は、先ほどと同様に、当該ビット列の最初の6ビット「010001」をアドレスとして、第1テーブル13を引く。この場合、当該アドレス「010001」がLine2にあたるので(図2参照)、当該Line2のデータを主メモリ10からキャッシュメモリ34に移した後、当該データにアクセスする必要がある。
When the next bit string is “010001111xxxx”, as shown in FIG. 17, the
ところで、今、キャッシュメモリ34に空き領域はないので、キャッシュメモリ34に格納されているいずれかのラインのデータを主メモリ10に書き戻し、それによって生じた空き領域に当該Line2のデータを移す必要がある。
Now, since there is no free area in the
さてここで、制御部51は、属性格納部52で指定されている主メモリ10の第1メモリ領域11及び第2メモリ領域12の強度情報に基づいて、キャッシュメモリ34に格納されているいずれかのラインのデータを主メモリ10に書き戻すかを決定する。この場合、第1テーブル13にあたるLine0からLine7は強度が大で、第2テーブル14にあたるLine8からLine14は強度が小であることが示されている(図4参照)。このため、第2テーブル14のデータで、現在、キャッシュメモリ34上に格納されているデータを主メモリ10に書き戻す。つまり現在Line13のデータがキャッシュメモリ34に格納されているので、このデータが主メモリ10に書き戻され(図17)、それによって生じた空き領域にLine2のデータが移される(図18)。
Here, the
その後、プロセッサ20は、当該Line2のデータをアクセスし、符号長4ビット、デコード結果10を取得する。上記符号長が4ビットであったので上記ビット列を4ビット進めると、ビット列は「01111xxxx」となる。
After that, the
この過程において、上記説明では、Line13のデータがキャッシュメモリ34から主メモリ10に書き戻されるとしたが、本一連の動作の過程では、Line13のデータは、キャッシュメモリ34に格納されている間に値が変化していないので、つまりキャッシュメモリ34上での値と主メモリ10上での値とが同一であるので、従来の多くのキャッシュメモリの制御方法では、書き戻すという動作はなく、Line2のデータをLine13のデータ上に上書きする、ということになる。
In this process, in the above description, it is assumed that the data of
すなわち、キャッシュメモリ34に空きがない場合、従来では、LRU方式により、Line3のデータをリプレース対象に決定し、そのライン上にLine2のデータを上書きしている。これに対して、本実施の形態1の制御部51は、キャッシュメモリ34のウィークフラグWに「1」がセットされているラインをサーチし、Line13のデータをリプレース対象に決定する。そして、制御部51は、Line13のダーティフラグDの値が「0」のままであるのを確認し、そのライン上にLine2のデータを上書きするようにしている。
That is, when there is no free space in the
これにより、アクセス頻度の高いデータがキャッシュメモリ34に残るので、ヒットの確率が高くなり、キャッシュミスが生じる確率が低くなることになる。
As a result, since frequently accessed data remains in the
次のビット列が「01111xxxx」である場合、プロセッサ20は、先ほどと同様に、当該ビット列の最初の6ビットをアドレスとして、第1テーブル13を引く。この場合、当該アドレス「01111x」は、Line3にあたる(図2参照)。今、当該Line3のデータは、キャッシュメモリ34に格納されているので、ヒットし、プロセッサ20は、直ちに当該アドレス「01111x」のデータをアクセスし、直ちに符号長5ビット、デコード結果16を取得する。
When the next bit string is “01111xxxx”, the
この過程においては、先に説明した従来の技術では、キャッシュメモリ34に空き領域はない場合、通常、一番過去にアクセスされたLineが書き戻されるので、Line3のデータが複数回、主メモリ10とキャッシュメモリ34の間で移動を繰り返したが、上記制御部51(リプレース部42a)と上記属性格納部52(Wフラグ設定部42b)との働きによって、アクセス頻度の高いデータが優先的にキャッシュメモリ34のデータエリア上に残るように制御され、結果として、主メモリ10とキャッシュメモリ34の間でのデータの移動回数を削減できる。
In this process, in the conventional technique described above, when there is no free space in the
以上のように本実施の形態1によれば、主メモリ10の第1のメモリ領域11と、第2のメモリ領域12と、当該メモリ領域11,12のデータを一時格納するキャッシュメモリ34と、キャッシュメモリ34を介して上記第1、第2のメモリ領域11,12にアクセスするためのプロセッサ20と、上記キャッシュメモリ34に空き領域が不足した場合、空き領域を確保する制御部51とを用いて、上記制御部51において、上記第1のメモリ領域11のデータ(第1テーブル13)を優先的にキャッシュメモリ34に保持するようにしながら空き領域を確保するようにすることによって、主メモリ10とキャッシュメモリ34との間の転送回数を削減できることとなる。
As described above, according to the first embodiment, the
なお、本実施の形態におけるハフマンデコード処理では、第1のメモリ領域11に1回アクセスすることでデコードが完了するか、第1のメモリ領域11に1回アクセスした後、第2のメモリ領域12に1回アクセスすることでデコードが完了するか、の2種類の過程でデコードが完了するような処理について説明したが、必ずしもそのようなものである必要はない。
In the Huffman decoding process according to the present embodiment, the decoding is completed by accessing the
例えば、特開2000−286717号公報(実施の形態1)で示されるように、1回メモリにアクセスすることでデコードが完了するか、そうでない場合は、さらに1回以上の複数回メモリにアクセスすることでデコードを完了させるという処理であってもよい。その場合、たとえば、1回目にアクセスされる可能性があるメモリ領域を本実施の形態でいうところの第1のメモリ領域11に割り当て、2回目以降にアクセスされる可能性のあるメモリ領域を本実施の形態でいうところの第2のメモリ領域12に割り当てればよい。
For example, as shown in Japanese Patent Laid-Open No. 2000-286717 (Embodiment 1), decoding is completed by accessing the memory once, or if not, the memory is accessed one or more times more than once. In this case, the decoding may be completed. In this case, for example, a memory area that may be accessed for the first time is assigned to the
あるいは、比較的小さな整数をmとしたとき、m回目までにアクセスされる可能性があるメモリ領域を本実施の形態でいうところの第1のメモリ領域11に割り当て、m回目より後にアクセスされる可能性のあるメモリ領域を本実施の形態でいうところの第2のメモリ領域12に割り当てるという方法もある。
Alternatively, when m is a relatively small integer, a memory area that may be accessed by the mth time is assigned to the
この場合についても、第1のメモリ領域11のデータ(第1テーブル5000)を優先的にキャッシュメモリ34に保持するようにしながら空き領域を確保するようにすることによって、主メモリ10とキャッシュメモリ34との間の転送回数を従来より大幅に削減できることとなる。
Also in this case, the
(実施の形態2)
次いで、本発明の実施の形態2に係る信号処理装置2について説明する。
(Embodiment 2)
Next, the
ところで、実施の形態1の信号処理装置1では、制御部51を設けて、アクセス頻度の低いデータがキャッシュメモリに残らないようにしている。つまり、信号処理装置1においては、第2テーブル14のデータをキャッシュメモリ34に一旦格納し、空きがない場合には第2テーブル14のデータをリプレースの対象にしている。
By the way, in the
しかしながらそうすると、その分第1テーブル13のデータがキャッシュメモリ34に存在する確率が低くなる。すなわち、第1テーブル13のデータに対する割り当て領域が減ることになる。
However, if it does so, the probability that the data of the 1st table 13 will exist in the
そこで、そもそもアクセス頻度の低いデータがキャッシュメモリに格納されないように制御するようにしている。 Therefore, control is performed so that data with low access frequency is not stored in the cache memory.
その場合は、図20に示すような構成になる。
すなわち、図20に示されるように、信号処理装置2は、主メモリ10と、プロセッサ20と、キャッシュメモリを介して主メモリ10にアクセスする機能と、キャッシュメモリを介さずに主メモリ10にアクセスする機能とを備えるキャッシュメモリ装置60とを備え、主メモリ10の第1メモリ領域11に格納され、キャッシュメモリを介してアクセスされる第1テーブル13と、主メモリ10の第2メモリ領域12に格納され、キャッシュメモリを介さずにアクセスされる第2テーブル14とで構成される。
In that case, the configuration is as shown in FIG.
That is, as shown in FIG. 20, the
キャッシュメモリ装置60は、キャッシュメモリ61と、制御部62と、アクセス制御部63と、属性格納部64等とからなる。
The
キャッシュメモリ61は、キャッシュメモリ34からウィークフラグWを削除した構成である。
The
制御部62は、通常のLRU方式でリプレース対象を決定する。
属性格納部64は、プロセッサ20から出力された属性を設定するコマンドに基づいて強度属性のデータを格納する。
The
The
図21は、属性格納部64に格納される属性データの内容の一例を示した図である。
この場合、第1テーブル13にあたるLine0からLine7は強度が大(キャッシュ)で、第2テーブル14にあたるLine8からLine14は強度が小(ノンキャッシュ)であることが示されている。このような強度属性が設定されることにより、適切なリプレイスメント アルゴリズムが発揮され、キャッシュミスが減少されることになる。
FIG. 21 is a diagram illustrating an example of the contents of attribute data stored in the
In this case, it is indicated that
アクセス制御部63は、属性格納部64に格納されたデータに基づいて、キャッシュメモリ61を介してアクセスするか、第2テーブル14にアクセスするかを決定する。具体的には、プロセッサ20がアクセスするアドレスがLine0〜Line7の範囲である場合には、アクセス制御部63は、キャッシュメモリ61をイネーブルにし、キャッシュメモリ61を介するLine0〜Line7のデータの読み出しを仲介する。プロセッサ20がアクセスするアドレスがLine8〜Line14の範囲である場合には、アクセス制御部63は、キャッシュメモリ61をディスエーブルにし、主メモリ10の第2メモリ領域12に格納された第2テーブル14の該当アドレスのデータに直接アクセスし、読み出したデータをプロセッサ20に出力する。
The
このような構成により、プロセッサ20は、第1テーブル13にアクセスするときは上記キャッシュメモリ61を介してアクセスし、第2テーブル14にアクセスするときはキャッシュメモリ61を介さないでアクセスすることができ、アクセス頻度の低い第2テーブル14のデータがキャッシュメモリ61に格納されないようにすることができる。
With such a configuration, the
これにより、アクセス頻度の高い第1テーブル13のデータが一度キャッシュメモリに格納されるとそのまま保持される可能が高まり、結果として、主メモリ10とキャッシュメモリ61との間の転送回数を削減できることとなる。
<変形例>
なお、本発明のキャッシュメモリは、上記の実施の形態1の構成に限るものではなく、種々の変形が可能である。以下、変形例のいくつかについて説明する。
As a result, once the frequently accessed data in the first table 13 is stored in the cache memory, it is more likely to be held as it is, and as a result, the number of transfers between the
<Modification>
The cache memory of the present invention is not limited to the configuration of the first embodiment, and various modifications can be made. Hereinafter, some modified examples will be described.
(1) 上記実施の形態1では、ウィークフラグWによりアクセス順序が最古であることを示しているが、アクセス順序が最新又は最古でないことを示すものとしてもよい。この場合、リプレース部42aは、W=1のキャッシュエントリは最古でないとみなして、リプレース対象として選択せず、他のキャッシュエントリを選択する構成とすればよい。最古でないことを示すウィークフラグWを、アクセス頻度の高いデータあるいはアクセス頻度が中くらいのデータを保持するキャッシュエントリに付加することにより、無駄リプレースを防止することができる。
(1) In the first embodiment, the weak flag W indicates that the access order is the oldest, but the access order may indicate that the access order is the latest or not the oldest. In this case, the
(2) プロセッサ20が、ウィークフラグW=1の設定とデータの書き込みとを命令する特別なストア命令を実行し、キャッシュ制御部42は、さらに、特別なストア命令を検出する命令検出部と、当該ストア命令による書き込みの際にW=1に設定するフラグ設定部とを備える構成としてもよい。
(2) The
(3) 上記実施の形態1では、4ウェイ・セット・アソシエイティブのキャッシュメモリを例に説明したが、ウェイ数は、いくつでもよい。また、上記実施の形態1では、セット数が16である例を説明したが、セット数はいくつでもよい。 (3) In the first embodiment, a 4-way set associative cache memory has been described as an example. However, the number of ways may be any number. In the first embodiment, an example in which the number of sets is 16 has been described. However, any number of sets may be used.
(4) 上記実施の形態1では、セット・アソシエイティブのキャッシュメモリを例に説明したが、フル・アソシエイティブ方式のキャッシュメモリであってもよい。 (4) In the first embodiment, a set-associative cache memory has been described as an example. However, a full-associative cache memory may be used.
(5) 上記実施の形態1では、サブラインのサイズをラインのサイズの1/4としているが、1/2、1/8、1/16等他のサイズでもよい。その場合、各キャッシュエントリは、サブラインと同数のバリッドフラグ及びダーティフラグをそれぞれ保持すればよい。 (5) In the first embodiment, the size of the sub-line is set to 1/4 of the size of the line, but other sizes such as 1/2, 1/8, and 1/16 may be used. In that case, each cache entry may hold the same number of valid flags and dirty flags as sublines.
(6) また、上記実施の形態では、音楽データのエンコードデータについて例えばMPEG−AAC規格のハフマンコードブック(例えば、8)に対応するテーブルを用いてデコードする場合について説明したが、他のコードブックに対応したテーブルを用いてデコードする場合に適用できる。また、MP3等のエンコードデータをデコードする場合にも適用できる。さらに、圧縮符号化された映像データ等をデコードするような種々の信号処理に適用できるのは、いうまでもない。 (6) In the above embodiment, the case where the encoded data of music data is decoded using a table corresponding to, for example, the Huffman codebook (for example, 8) of the MPEG-AAC standard has been described. This can be applied when decoding using a table corresponding to. Also, the present invention can be applied when decoding encoded data such as MP3. Furthermore, it goes without saying that the present invention can be applied to various signal processes such as decoding compressed and encoded video data.
本発明に係る信号処理装置は、キャッシュミスを低減し、キャッシュメモリと主メモリとの間のデータ転送時間・量を削減する効果を有し、プロセッサと記憶装置によって構成される機器、例えば、パーソナルコンピュータ等において有用である。また、デジタル化されたオーディオ信号やビデオ信号をプロセッサと記憶装置によって処理する機器、例えば、デジタルテレビ、DVD機器、携帯電話機、携帯情報端末、ヘッドホンステレオ等の用途に応用できる。 The signal processing device according to the present invention has the effect of reducing cache misses and reducing the time and amount of data transfer between the cache memory and the main memory, and is composed of a device composed of a processor and a storage device, for example, a personal computer Useful in computers and the like. Further, the present invention can be applied to devices such as digital televisions, DVD devices, mobile phones, portable information terminals, and headphone stereos that process digitized audio signals and video signals by a processor and a storage device.
10 主メモリ
11 第1メモリ領域
12 第2メモリ領域
13 第1テーブル
14 第2テーブル
20 プロセッサ
30,60 キャッシュメモリ装置
34,61 キャッシュメモリ
51,62 制御部
52,64 属性格納部
10
Claims (9)
前記データを一時格納するためのキャッシュメモリと、
前記キャッシュメモリを介して前記第1及び第2メモリ領域の少なくとも1つにアクセスすることによって前記データを読み出すアクセス手段と、
前記キャッシュメモリに一時格納する空き領域が不足した場合に、前記キャッシュメモリに空き領域を確保する制御手段とを備え、
前記制御手段は、前記第1メモリ領域のデータが前記第2メモリ領域のデータよりも優先して前記キャッシュメモリに保持されるように、前記空き領域を確保する
ことを特徴とする信号処理装置。 A signal processing device that performs signal processing using data in first and second memory areas,
A cache memory for temporarily storing the data;
Access means for reading the data by accessing at least one of the first and second memory areas via the cache memory;
Control means for securing free space in the cache memory when there is a shortage of free space to be temporarily stored in the cache memory;
The signal processing apparatus, wherein the control means reserves the free area so that the data in the first memory area is held in the cache memory in preference to the data in the second memory area.
前記制御手段は、前記属性格納手段に格納された強度属性に応じて、前記キャッシュメモリに保持するデータを決定する
ことを特徴とする請求項1記載の信号処理装置。 The signal processing apparatus further includes attribute storage means for storing an intensity attribute indicating that the first memory area is stronger than the second memory area,
The signal processing apparatus according to claim 1, wherein the control unit determines data to be held in the cache memory according to an intensity attribute stored in the attribute storage unit.
ことを特徴とする請求項1記載の信号処理装置。 The access means accesses the first memory area after transferring the data in the first memory area to the cache memory, and accesses the data in the second memory area for the second memory area. The signal processing apparatus according to claim 1, wherein the signal processing apparatus is accessed without moving to the process.
ことを特徴とする請求項1記載の信号処理装置。 The signal processing apparatus according to claim 1, wherein the first memory area stores data having a higher access frequency than the second memory area.
前記制御手段は、前記第2テーブルのデータが前記第1テーブルのデータよりも優先して前記キャッシュメモリから廃棄されるように、前記空き領域を確保する
ことを特徴とする請求項1記載の信号処理装置。 The first and second memory areas respectively hold first and second tables indicating conversion rules for converting input data according to a certain rule,
2. The signal according to claim 1, wherein the control unit reserves the free space so that the data in the second table is discarded from the cache memory in preference to the data in the first table. Processing equipment.
前記制御手段は、前記属性格納手段に格納された強度属性に応じて、前記キャッシュメモリから廃棄するデータを決定する
ことを特徴とする請求項5記載の信号処理装置。 The signal processing device further includes attribute storage means for storing an intensity attribute indicating that the first table is stronger than the second table,
The signal processing apparatus according to claim 5, wherein the control unit determines data to be discarded from the cache memory according to an intensity attribute stored in the attribute storage unit.
前記ハフマン符号は、符号長の最長ビットがNビットであり、
前記第1テーブルは、nを1以上でN未満の整数としたときに、nビット以下の符号データをデコードするためのテーブルであり、
前記第2テーブルは、前記nビットよりも長い符号データをデコードするためのテーブルである
ことを特徴とする請求項5記載の信号処理装置。 The signal processing device is a device for decoding a Huffman code that is input data,
In the Huffman code, the longest bit of the code length is N bits,
The first table is a table for decoding code data of n bits or less when n is an integer greater than or equal to 1 and less than N;
The signal processing apparatus according to claim 5, wherein the second table is a table for decoding code data longer than the n bits.
前記キャッシュメモリに一時格納する空き領域が不足した場合に、前記第1メモリ領域のデータが前記第2メモリ領域のデータよりも優先して前記キャッシュメモリに保持されるように、前記空き領域を確保するステップを含む
ことを特徴とするキャッシュメモリの制御方法。 A cache comprising first and second memory areas, a cache memory for temporarily storing the data, and access means for reading the data by accessing the first and second memory areas via the cache memory A control method for a memory device, comprising:
The free space is secured so that the data in the first memory area is held in the cache memory in preference to the data in the second memory area when there is a shortage of free space to be temporarily stored in the cache memory. A cache memory control method comprising the steps of:
請求項8記載の制御方法に含まれるステップをコンピュータに実行させる
ことを特徴とするプログラム。 A program for a signal processing device that performs signal processing using data in first and second memory areas,
A program for causing a computer to execute the steps included in the control method according to claim 8.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2005025899A JP2005259120A (en) | 2004-02-12 | 2005-02-02 | Signal processing device |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2004035429 | 2004-02-12 | ||
| JP2005025899A JP2005259120A (en) | 2004-02-12 | 2005-02-02 | Signal processing device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JP2005259120A true JP2005259120A (en) | 2005-09-22 |
Family
ID=35084720
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2005025899A Pending JP2005259120A (en) | 2004-02-12 | 2005-02-02 | Signal processing device |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2005259120A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2009169767A (en) * | 2008-01-17 | 2009-07-30 | Toshiba Corp | Pipeline processor |
-
2005
- 2005-02-02 JP JP2005025899A patent/JP2005259120A/en active Pending
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2009169767A (en) * | 2008-01-17 | 2009-07-30 | Toshiba Corp | Pipeline processor |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US9996466B2 (en) | Apparatus, system and method for caching compressed data | |
| US10203901B2 (en) | Transparent hardware-assisted memory decompression | |
| US8799585B2 (en) | Cache memory capable of adjusting burst length of write-back data in write-back operation | |
| JP3399520B2 (en) | Virtual uncompressed cache in compressed main memory | |
| KR20170008233A (en) | Memory controllers employing memory capacity compression, and related processor-based systems and methods | |
| JP2000507010A (en) | Pixel engine data caching mechanism | |
| KR20170012233A (en) | PROVIDING MEMORY BANDWIDTH COMPRESSION USING COMPRESSED MEMORY CONTROLLERS (CMCs) IN A CENTRAL PROCESSING UNIT (CPU)-BASED SYSTEM | |
| CN101589374A (en) | Method and apparatus for setting cache policies in a processor | |
| US10482021B2 (en) | Priority-based storage and access of compressed memory lines in memory in a processor-based system | |
| JP2019513271A5 (en) | ||
| CN102859504A (en) | Storage efficient sectored cache | |
| KR20170115521A (en) | CPU (CENTRAL PROCESSING UNIT) - Provides memory bandwidth compression using back-to-back read operations by COMPRESSED MEMORY CONTROLLERS (CMC) in the underlying system | |
| US6327643B1 (en) | System and method for cache line replacement | |
| US7598891B2 (en) | Data development device and data development method | |
| US7555610B2 (en) | Cache memory and control method thereof | |
| US10061698B2 (en) | Reducing or avoiding buffering of evicted cache data from an uncompressed cache memory in a compression memory system when stalled write operations occur | |
| US20210365378A1 (en) | Method of cache prefetching that increases the hit rate of a next faster cache | |
| JP2006079523A (en) | Cache memory system and its control method | |
| JP2005259120A (en) | Signal processing device | |
| US7865666B2 (en) | Cache memory systems and methods thereof | |
| US20130145097A1 (en) | Selective Access of a Store Buffer Based on Cache State | |
| US6421764B2 (en) | Method and apparatus for efficient clearing of memory | |
| US20050182902A1 (en) | Signal processing apparatus | |
| CN117806987A (en) | Processor, memory, data reading method and electronic equipment | |
| TW201109923A (en) | Stream context cache system |