patents.google.com

JP4718992B2 - Drawing apparatus and drawing method - Google Patents

  • ️Wed Jul 06 2011

以下、この発明の実施形態を図面を参照して説明する。この説明に際し、全図にわたり、共通する部分には共通する参照符号を付す。   Embodiments of the present invention will be described below with reference to the drawings. In the description, common parts are denoted by common reference symbols throughout the drawings.

この発明の第1の実施形態に係るグラフィックプロセッサについて、図1を用いて説明する。図1は、本実施形態に係るグラフィックプロセッサのブロック図である。   A graphic processor according to a first embodiment of the present invention will be described with reference to FIG. FIG. 1 is a block diagram of a graphic processor according to the present embodiment.

図示するように、グラフィックプロセッサ23はラスタライザ(rasterizer)24、複数のピクセルシェーダ(pixel shader)25−0〜25−3、及びローカルメモリ26を備えている。なお、本実施形態ではピクセルシェーダ25の数は4個であるがこれは一例に過ぎず、8個、16個、32個等でも良く、その数は限定されるものではない。ラスタライザ24は、入力された図形情報に従ってピクセル(pixel)を生成する。ピクセルとは、所定の図形を描画する際に取り扱われる最小単位の領域のことであり、ピクセルの集合によって図形が描画される。生成されたピクセルはピクセルシェーダ25−0〜25−3へ投入される。   As illustrated, the graphic processor 23 includes a rasterizer 24, a plurality of pixel shaders 25-0 to 25-3, and a local memory 26. In the present embodiment, the number of pixel shaders 25 is four, but this is only an example, and may be eight, sixteen, thirty-two, etc., and the number is not limited. The rasterizer 24 generates pixels in accordance with the input graphic information. A pixel is a minimum unit area that is handled when a predetermined figure is drawn, and a figure is drawn by a set of pixels. The generated pixels are input to the pixel shaders 25-0 to 25-3.

ピクセルシェーダ25−0〜25−3は、ラスタライザ24から投入されたピクセルにつき演算処理を行い、ローカルメモリ(後述する)上に画像データを生成する。ピクセルシェーダ25−0〜25−3の各々は、データ振り分け部30、同期回路31、テクスチャユニット(texture unit)33、及び複数のピクセルシェーダユニット34を備えている。   The pixel shaders 25-0 to 25-3 perform arithmetic processing on the pixels input from the rasterizer 24, and generate image data on a local memory (described later). Each of the pixel shaders 25-0 to 25-3 includes a data distribution unit 30, a synchronization circuit 31, a texture unit 33, and a plurality of pixel shader units 34.

データ振り分け部30はラスタライザ24からデータを受け取る。そして、受け取ったデータをピクセルシェーダ25−0〜25−3へ割り振る。   The data distribution unit 30 receives data from the rasterizer 24. Then, the received data is allocated to the pixel shaders 25-0 to 25-3.

同期回路31は、ピクセルシェーダユニット34の動作の同期化を行う。   The synchronization circuit 31 synchronizes the operation of the pixel shader unit 34.

テクスチャユニット33はテクスチャ処理を行い、ピクセルシェーダユニット34で処理されたピクセルにテクスチャデータを貼り付ける。   The texture unit 33 performs texture processing and pastes texture data on the pixels processed by the pixel shader unit 34.

ピクセルシェーダユニット34はシェーダエンジン部であり、ピクセルデータに対してシェーダプログラムを実行する。そしてピクセルシェーダユニット34のそれぞれはSIMD(Single Instruction Multiple Data)動作を行って、4個のピクセルを同時に処理する。ピクセルシェーダユニット34はそれぞれ、命令制御部35、描画処理部36、及びデータ制御部37を備えている。   The pixel shader unit 34 is a shader engine unit, and executes a shader program for pixel data. Each of the pixel shader units 34 performs a single instruction multiple data (SIMD) operation to simultaneously process four pixels. Each pixel shader unit 34 includes an instruction control unit 35, a drawing processing unit 36, and a data control unit 37.

命令制御部35については後に詳細に説明する。描画処理部36はピクセルの演算処理を行う。データ制御部37は、ローカルメモリ26からのデータの読み出しを制御する。   The instruction control unit 35 will be described in detail later. The drawing processing unit 36 performs pixel calculation processing. The data control unit 37 controls reading of data from the local memory 26.

ローカルメモリ26は例えばeDRAM(embedded DRAM)であり、ピクセルシェーダ25−0〜24−3で描画されたピクセルデータを記憶する。   The local memory 26 is eDRAM (embedded DRAM), for example, and stores pixel data drawn by the pixel shaders 25-0 to 24-3.

次に、本実施形態に係るグラフィックプロセッサにおける図形描画の概念について説明する。図2は、図形を描画すべき全体の空間を示す概念図である。なお、図2に示す描画領域は、ローカルメモリ内においてピクセルデータを保持するメモリ空間(以下、フレームバッファと呼ぶ)に相当する。   Next, the concept of graphic drawing in the graphic processor according to the present embodiment will be described. FIG. 2 is a conceptual diagram showing the entire space in which a figure is to be drawn. The drawing area shown in FIG. 2 corresponds to a memory space (hereinafter referred to as a frame buffer) that holds pixel data in the local memory.

図示するように、フレームバッファは、マトリクス状に配置された((m+1)×(l+1))個のブロックBLK0〜BLKnを含んでいる。図2ではl=29、m=19、n=599の場合について示しているが、この数は一例に過ぎず、限定されるものではない。ピクセルシェーダ25−0〜25−3は、ブロックBLK0〜BLK599順にピクセルを生成する。各ブロックBLK0〜BLK599はそれぞれ、マトリクス状に配置された32個のスタンプ(stamp)を含んで形成されている。図3は、図2に示された各ブロックが複数のスタンプを有する様子を示している。   As shown in the figure, the frame buffer includes ((m + 1) × (l + 1)) blocks BLK0 to BLKn arranged in a matrix. Although FIG. 2 shows the case of l = 29, m = 19, and n = 599, this number is only an example and is not limited. Pixel shaders 25-0 to 25-3 generate pixels in the order of blocks BLK0 to BLK599. Each of the blocks BLK0 to BLK599 is formed to include 32 stamps arranged in a matrix. FIG. 3 shows how each block shown in FIG. 2 has a plurality of stamps.

各スタンプは、同一のピクセルシェーダによって描画される複数のピクセルの集合体である。本実施形態では1個のスタンプは(4×4)=16個のピクセルを含んでいるが、この数は例えば1個、4個、…等でも良く、限定されるものではない。図3において、各スタンプに記載された番号(=0〜31)を以下スタンプID(StID)と呼び、各ピクセルに記載された番号(=0〜15)を以下ピクセルID(PixID)と呼ぶ。また、各スタンプにおける(2×2)個のピクセルの集合をクアッド(quad)と呼ぶことにする。すなわち、1個のスタンプには(2×2)個のクアッドが含まれる。これらの4つのクアッドを、以下クアッドQ0〜Q3と呼ぶことにする。ブロックBLK0〜BLK599の各々には、上記スタンプが(8×4)=32個含まれている。従って、全体として(640×480)個のピクセルによって、図形を描画すべき空間が形成されている。   Each stamp is a collection of a plurality of pixels drawn by the same pixel shader. In this embodiment, one stamp includes (4 × 4) = 16 pixels, but this number may be one, four,..., For example, and is not limited. In FIG. 3, a number (= 0 to 31) described in each stamp is hereinafter referred to as a stamp ID (StID), and a number (= 0 to 15) described in each pixel is hereinafter referred to as a pixel ID (PixID). A set of (2 × 2) pixels in each stamp is referred to as a quad. That is, one stamp includes (2 × 2) quads. These four quads are hereinafter referred to as quads Q0 to Q3. Each of the blocks BLK0 to BLK599 includes (8 × 4) = 32 stamps. Accordingly, a space for drawing a graphic is formed by (640 × 480) pixels as a whole.

次に、上記フレームバッファに描画される図形に関して説明する。まず図形を描画するにあたって、ラスタライザ24に図形情報が入力される。図形情報は、例えば図形の頂点座標や色情報などである。ここで、例として三角形を描画する場合について説明する。ラスタライザ24に入力された三角形は、描画空間において図4に示すような位置を占めるとする。すなわち、三角形の3つの頂点座標が、ブロックBLK1におけるStID=7のスタンプ、ブロックBLK40におけるStID=19のスタンプ、及びブロックBLK42におけるStID=0のスタンプに位置すると仮定する。ラスタライザ55は、描画すべき三角形が占める位置に対応するスタンプを生成する。この様子を示しているのが図5である。生成されたスタンプデータは、それぞれ予め対応付けられたピクセルシェーダ25−0〜25−3に送られる。   Next, the graphic drawn in the frame buffer will be described. First, graphic information is input to the rasterizer 24 when drawing a graphic. The graphic information is, for example, the vertex coordinates or color information of the graphic. Here, a case where a triangle is drawn will be described as an example. It is assumed that the triangle input to the rasterizer 24 occupies a position as shown in FIG. 4 in the drawing space. That is, it is assumed that the three vertex coordinates of the triangle are located at the stamp of StID = 7 in the block BLK1, the stamp of StID = 19 in the block BLK40, and the stamp of StID = 0 in the block BLK42. The rasterizer 55 generates a stamp corresponding to the position occupied by the triangle to be drawn. This is shown in FIG. The generated stamp data is sent to the pixel shaders 25-0 to 25-3 associated with each other in advance.

そしてピクセルシェーダ25−0〜25−3は、入力されたスタンプデータに基づいて、自らの担当するピクセルについて描画処理を行う。その結果、図5に示されるような三角形が、複数のピクセルによって描画される。ピクセルシェーダ25−0〜25−3によって描画されたピクセルデータは、スタンプ単位でローカルメモリに格納される。   Then, the pixel shaders 25-0 to 25-3 perform drawing processing on the pixels that they are responsible for based on the input stamp data. As a result, a triangle as shown in FIG. 5 is drawn by a plurality of pixels. Pixel data drawn by the pixel shaders 25-0 to 25-3 is stored in the local memory in units of stamps.

図6は、図5におけるブロックBLK1の拡大図である。図示するようにブロックBLK1に関して、ラスタライザ24は8個のスタンプを生成する。それらのスタンプIDはそれぞれStID=7、11〜15、24、26、27である。前述の通り、ラスタライザ24で生成されたスタンプの個々には(4×4)=16個のピクセルが含まれている。しかし、例えスタンプが発行されたとしても、図形によっては全てのピクセルに対して描画処理を行う必要はない。例えば図6において、StID=15のスタンプは三角形の内部にあるので、このスタンプ内に含まれる全てのピクセルに対して描画処理を行う必要がある。しかし、例えばStID=7のスタンプにおいては、PixID=0〜8、12、13、15のピクセルは三角形の外部にあるため描画処理の必要はない。描画処理の必要なピクセルは、PixID=9〜11、14のピクセルのみである。このように、描画処理すべきであることを以下では「バリッド(valid)である」と呼び、描画不要であることを「インバリッド(invalid)である」と呼ぶことにする。   FIG. 6 is an enlarged view of the block BLK1 in FIG. As shown, for the block BLK1, the rasterizer 24 generates 8 stamps. The stamp IDs are StID = 7, 11-15, 24, 26, and 27, respectively. As described above, each of the stamps generated by the rasterizer 24 includes (4 × 4) = 16 pixels. However, even if a stamp is issued, it is not necessary to perform drawing processing for all pixels depending on the figure. For example, in FIG. 6, since the stamp with StID = 15 is inside the triangle, it is necessary to perform drawing processing for all the pixels included in this stamp. However, for example, in the stamp with StID = 7, the pixels with PixID = 0 to 8, 12, 13, and 15 are outside the triangle, so there is no need for drawing processing. Only pixels with PixID = 9 to 11 and 14 need to be rendered. In this way, what is to be rendered is hereinafter referred to as “valid” and what is not necessary is referred to as “invalid”.

次に、各ピクセルシェーダユニット34に含まれる命令制御部35の構成について、以下詳細に説明する。図7は命令制御部35のブロック図である。図7は命令制御部35のブロック図である。図示するように命令制御部35は、書き込み制御部40、コンフィギュレーションレジスタ(configuration register)41、第1データ保持部42、第2データ保持部43、スタンプ保持部44、オーバーラップ検出部45、スレッド生成部46、スレッド保持部47、及び命令管理部48を備えている。   Next, the configuration of the instruction control unit 35 included in each pixel shader unit 34 will be described in detail below. FIG. 7 is a block diagram of the instruction control unit 35. FIG. 7 is a block diagram of the instruction control unit 35. As shown in the figure, the instruction control unit 35 includes a write control unit 40, a configuration register 41, a first data holding unit 42, a second data holding unit 43, a stamp holding unit 44, an overlap detection unit 45, a thread. A generation unit 46, a thread holding unit 47, and an instruction management unit 48 are provided.

命令制御部35は、データ振り分け部30から複数のデータを受け取る。そのデータは図形を描画するために必要となる情報に関するデータであり、例えばXY座標、第1乃至第3データ、及びピクセルバリッド信号である。XY座標は当該スタンプのXY座標である。第3データは描画方向やポリゴンの面(face)情報である。第1データは描画すべき図形の有するパラメータの代表値を示す。第2データは図形の奥行き情報を示す。ピクセルバリッド信号は、当該ピクセルがバリッドか否かを示す情報である。これらのデータのことを、以下ではまとめて「スタンプデータ」と呼ぶことがある。   The instruction control unit 35 receives a plurality of data from the data distribution unit 30. The data is data relating to information necessary for drawing a figure, such as XY coordinates, first to third data, and a pixel valid signal. The XY coordinates are the XY coordinates of the stamp. The third data is the drawing direction and polygon face information. The first data indicates representative values of parameters of the graphic to be drawn. The second data indicates the depth information of the figure. The pixel valid signal is information indicating whether or not the pixel is valid. These data may be collectively referred to as “stamp data” below.

上記スタンプデータはクロック信号CLK2に同期して、命令制御部35へ入力される。そして、第2データ以外のデータは第1スタート信号に応答して命令制御部35へ入力される。図8は各データ信号のタイミングチャートである。   The stamp data is input to the instruction control unit 35 in synchronization with the clock signal CLK2. Data other than the second data is input to the instruction control unit 35 in response to the first start signal. FIG. 8 is a timing chart of each data signal.

図8に示すように、時刻t1で第1スタート信号がアサートされると、その時刻t1から、命令制御部35は第3データ、第1データ、ピクセルバリッド信号、XY座標を受け取る。これらのスタンプデータは連続した8クロックサイクルに分割されて、命令制御部35に送られる。命令制御部35は、例えば最大16スタンプのデータを保持することが出来る。   As shown in FIG. 8, when the first start signal is asserted at time t1, the instruction control unit 35 receives the third data, the first data, the pixel valid signal, and the XY coordinates from the time t1. These stamp data are divided into continuous 8 clock cycles and sent to the instruction control unit 35. The instruction control unit 35 can hold data of, for example, a maximum of 16 stamps.

第2データは、第1スタート信号ではなく第2スタート信号に応答して、命令制御部35へ入力される。図9はクロックCLK2、第2スタート信号、及び第2データのタイミングチャートである。図示するように、時刻t21において、第2スタート信号がアサートされると共に、第2データが受信される。なお、第2スタート信号は、対応するそれ以外のスタンプデータを転送するための第1スタート信号よりも数サイクルだけ遅れてアサートされる。従って命令制御部35は、第2データを、それ以外のスタンプデータより遅れて受信する。   The second data is input to the command control unit 35 in response to the second start signal instead of the first start signal. FIG. 9 is a timing chart of the clock CLK2, the second start signal, and the second data. As shown in the figure, at time t21, the second start signal is asserted and the second data is received. The second start signal is asserted with a delay of several cycles from the first start signal for transferring the corresponding other stamp data. Therefore, the command control unit 35 receives the second data later than the other stamp data.

次に命令制御部35の備える各ブロックについて説明する。命令制御部35は、外部からのチップセレクト、アドレス指定により与えられたデータをコンフィギュレーションレジスタ41に書き込む。コンフィギュレーションレジスタ41は例えば複数のレジスタを含み、それぞれのレジスタに信号INSTBASE、PRELDTIMEを保持する。   Next, each block provided in the instruction control unit 35 will be described. The instruction control unit 35 writes data given by external chip select and address designation to the configuration register 41. The configuration register 41 includes a plurality of registers, for example, and holds signals INSTBASE and PRELDTIME in the respective registers.

INSTBASEは、スタンプ(スレッド)に関して処理を開始すべき最初の命令のアドレスを示す。PRELDTIMEはプリロードタイミングを示す。すなわち、スレッドがイールド命令を実行してからプリロードを要求するまでのクロックサイクル数を指定する。なお、スレッド、スレッドID、クアッドマージ、プリロード、及びイールド命令については後に説明する。プリロードとは下記のことを言う。すなわち、ピクセルシェーダユニット34は内部にキャッシュメモリ(図示せず)を有している。そしてキャッシュメモリに読み出したデータを用いて描画処理を行う。この描画処理のために、実際に処理を行う前に、データをローカルメモリ26から読み出しておくことがある。これがプリロードである。   INSTBASE indicates the address of the first instruction to start processing for the stamp (thread). PRELDTIME indicates the preload timing. That is, the number of clock cycles from when the thread executes the yield instruction until it requests preload is specified. The thread, thread ID, quad merge, preload, and yield instruction will be described later. Preload means the following. That is, the pixel shader unit 34 has a cache memory (not shown) therein. Then, drawing processing is performed using the data read to the cache memory. For this rendering process, data may be read from the local memory 26 before actual processing. This is preloading.

次に、上記命令制御部35に含まれる書き込み制御部40の構成について図10を用いて説明する。図10は書き込み制御部40のブロック図である。図示するように書き込み制御部40は、第1ステートマシーン50、第2ステートマシーン51、クアッドバリッド(quad valid: QV)発生器52、シフトレジスタ53−0〜53−4、及びメモリ54を備えている。   Next, the configuration of the write control unit 40 included in the command control unit 35 will be described with reference to FIG. FIG. 10 is a block diagram of the write control unit 40. As shown in the figure, the write control unit 40 includes a first state machine 50, a second state machine 51, a quad valid (QV) generator 52, shift registers 53-0 to 53-4, and a memory 54. Yes.

書き込み制御部40はデータ振り分け部30から送られる第1スタート信号、第2スタート信号、XY座標、ピクセルバリッド信号、第3データ、第2データ、及び第1データをフリップフロップF/Fにラッチする。また、上記データ信号が入力されるのと同時、または入力される以前に、タスク同期信号をF/Fにラッチする。タスク同期信号は同期回路31が発生する。   The write control unit 40 latches the first start signal, the second start signal, the XY coordinates, the pixel valid signal, the third data, the second data, and the first data sent from the data distribution unit 30 in the flip-flop F / F. . Also, the task synchronization signal is latched in the F / F at the same time as or before the data signal is input. The task synchronization signal is generated by the synchronization circuit 31.

次に、第1ステートマシーン50が第1スタート信号に基づいて、第1データライトイネーブル信号及びスタンプデータライトイネーブル信号を生成する。第1データライトイネーブル信号は第1データ保持部42に対する書き込み動作をイネーブルにする信号であり、スタンプデータライトイネーブル信号はスタンプ保持部44に対する書き込み動作をイネーブルにする信号である。また、スタンプ保持部44から送られるスタンプ番号StNに基づき、第1データライトアドレス信号が生成される。スタンプ番号StNとは、スタンプに固有に与えられた識別番号のことである。第1データライトアドレス信号は、第1データ保持部42において第1データを書き込むべきアドレスを示す。   Next, the first state machine 50 generates a first data write enable signal and a stamp data write enable signal based on the first start signal. The first data write enable signal is a signal that enables a writing operation to the first data holding unit 42, and the stamp data write enable signal is a signal that enables a writing operation to the stamp holding unit 44. A first data write address signal is generated based on the stamp number StN sent from the stamp holding unit 44. The stamp number StN is an identification number uniquely given to the stamp. The first data write address signal indicates an address where the first data is written in the first data holding unit 42.

また第1ステートマシーン50は、内部にカウンタを有しており、信号第1スタート信号がアサートされるとカウンタを起動する。カウンタは、第1スタート信号がアサートされたサイクルでゼロに初期化され、以後、クロックに同期して順次カウントアップする。そしてカウンタ値が例えば7の時、データライト終了信号をアサートする。データライト終了信号は、データの転送終了を示す信号である。データの転送が終了すると、第1ステートマシーン50は動作を停止する。   The first state machine 50 has a counter inside, and starts the counter when the signal first start signal is asserted. The counter is initialized to zero in the cycle in which the first start signal is asserted, and thereafter counts up sequentially in synchronization with the clock. When the counter value is 7, for example, the data write end signal is asserted. The data write end signal is a signal indicating the end of data transfer. When the data transfer ends, the first state machine 50 stops operating.

第1スタート信号がアサートされてから第1ステートマシーン50が動作停止するまでの8サイクルの期間、第1データは第1データ保持部42に毎サイクル書き込まれる。第1データを第1データ保持部42に書き込む際の動作を図11に示す。図11は各種信号のタイミングチャートである。   The first data is written to the first data holding unit 42 every cycle during the period of eight cycles from when the first start signal is asserted until the first state machine 50 stops operating. FIG. 11 shows an operation when writing the first data to the first data holding unit 42. FIG. 11 is a timing chart of various signals.

図示するように、時刻t0で信号第1スタート信号がアサートされると同時に第1データが入力され、また第1ステートマシーン50のカウンタがカウントを開始する(図11における“カウント数”)。第1データは8サイクルに渡って連続して入力される。第1スタート信号がアサートされた1サイクル後の時刻t2において、第1ステートマシーン50は第1データライトイネーブル信号をアサートして、第1データ保持部42への書き込みを許可する。同時に時刻t2から8サイクルに渡って、第1データ保持部42において第1データを書き込むべきアドレス(第1データライトアドレス信号)を生成する。従って、時刻t2からの8サイクルの期間、第1データが、第1データ保持部42における第1データライトアドレス信号の示すアドレスに順次書き込まれる。そしてカウンタのカウンタ値が7に達すると(時刻t8)、第1ステートマシーン50はデータライト終了信号をアサートして、データの転送を終了する。また、時刻t8の次のサイクルで、スタンプデータライトイネーブル信号がアサートされる。これにより、スタンプ保持部44へのデータの書き込みが許可される。またタスク同期信号がアサートされる。   As shown in the figure, at time t0, the first data is input at the same time as the signal first start signal is asserted, and the counter of the first state machine 50 starts counting (“count number” in FIG. 11). The first data is continuously input over 8 cycles. At time t <b> 2 one cycle after the first start signal is asserted, the first state machine 50 asserts the first data write enable signal and permits writing to the first data holding unit 42. At the same time, the first data holding unit 42 generates an address (first data write address signal) in which the first data is to be written over 8 cycles from time t2. Accordingly, the first data is sequentially written to the address indicated by the first data write address signal in the first data holding unit 42 for the period of 8 cycles from the time t2. When the counter value reaches 7 (time t8), the first state machine 50 asserts the data write end signal and ends the data transfer. In the next cycle after time t8, the stamp data write enable signal is asserted. Thereby, writing of data to the stamp holding unit 44 is permitted. The task synchronization signal is asserted.

更に、クアッドバリッド発生器52は、ピクセルバリッド信号を基にしてクアッドバリッドQVを生成する。クアッドバリッドとはクアッドがバリッドであるか否か、すなわちクアッド内に含まれる4個のピクセルのうちいずれか1個でもバリッドであるか否かを示す。   Further, the quad valid generator 52 generates a quad valid QV based on the pixel valid signal. The quad valid indicates whether or not the quad is valid, that is, whether or not any one of the four pixels included in the quad is valid.

また、シフトレジスタ53−0〜53−2は、それぞれXY座標、第3データ、ピクセルバリッド信号を受信する。シフトレジスタ53−0〜53−4はそれぞれ受信した信号を毎サイクル、受信したビット数だけ左シフトしながら保持する。従って、第1ステートマシーン50のカウンタ値が7に達したとき、換言すればデータライト終了信号がアサートされた時に、当該スタンプにおける全ビットがシフトレジスタ53−0〜53−5内に揃うことになる。そして次のサイクルにて、これらのデータがスタンプ保持部44に書き込まれる。またこの際、スタンプ番号StNがメモリ54に書き込まれ、且つメモリ54において対応するエントリのバリッドビットEnVがセットされる(この点については後述する)。   The shift registers 53-0 to 53-2 receive the XY coordinates, the third data, and the pixel valid signal, respectively. The shift registers 53-0 to 53-4 hold the received signals while shifting the received signals to the left by the number of received bits every cycle. Therefore, when the counter value of the first state machine 50 reaches 7, in other words, when the data write end signal is asserted, all the bits in the stamp are aligned in the shift registers 53-0 to 53-5. Become. In the next cycle, these data are written in the stamp holding unit 44. At this time, the stamp number StN is written in the memory 54, and the valid bit EnV of the corresponding entry is set in the memory 54 (this will be described later).

第1スタート信号がアサートされてから所定のクロックサイクルの後、第2スタート信号がアサートされ、第2データが書き込み制御部40に入力される。第2スタート信号がアサートされることにより、書き込み制御部は第2データの送付が開始されたことを認識し、第2ステートマシーン51は動作を開始する。第2データが送付されている期間、シフトレジスタ53−5は受信した信号を毎サイクル、受信したビット数だけMSB(most significant bit)側へシフトさせつつ保持する。第2ステートマシーン51は、第1ステートマシーン50と同様に内部にカウンタを有している。そして第2スタート信号がアサートされるとカウントを開始する。カウンタ値が7に達すると第2データライト終了信号をアサートして、第2データの転送を終了する。   After a predetermined clock cycle after the first start signal is asserted, the second start signal is asserted and the second data is input to the write control unit 40. When the second start signal is asserted, the write control unit recognizes that transmission of the second data has started, and the second state machine 51 starts its operation. During the period in which the second data is sent, the shift register 53-5 holds the received signal while shifting it to the MSB (most significant bit) side by the number of received bits every cycle. Like the first state machine 50, the second state machine 51 has a counter inside. When the second start signal is asserted, counting is started. When the counter value reaches 7, the second data write end signal is asserted to end the transfer of the second data.

次にメモリ54について図12を用いて説明する。メモリ54は、例えばFIFO(First In First Out)方式の半導体メモリであり、N個(Nは2以上の自然数であり、8個、16個、またはそれ以上)のエントリを有している。各エントリは、バリッドビットEnV、スタンプ番号StN、第2データレディビットRdy2、及び同期ビットSyncを保持できる。EnVは当該エントリが使用された際に書き込まれる(“1”とされる)。StNはスタンプ番号であり、当該エントリに対応するスタンプに固有に与えられた識別番号のことである。Rdy2は、第2データに関するレディビットであり、当該エントリに対応するスタンプの第2データが第2データ保持部43に書き込み済みか否かを示す。Syncは、タスクと各データとの同期を取るためのビットであり、当該エントリに対応するスタンプがタスク内における最初のスタンプか否かを示す。   Next, the memory 54 will be described with reference to FIG. The memory 54 is, for example, a FIFO (First In First Out) type semiconductor memory, and has N entries (N is a natural number of 2 or more, 8, 16, or more). Each entry can hold a valid bit EnV, a stamp number StN, a second data ready bit Rdy2, and a synchronization bit Sync. EnV is written when the entry is used (set to “1”). StN is a stamp number, which is an identification number uniquely given to the stamp corresponding to the entry. Rdy2 is a ready bit relating to the second data, and indicates whether or not the second data of the stamp corresponding to the entry has been written to the second data holding unit 43. Sync is a bit for synchronizing the task with each data, and indicates whether or not the stamp corresponding to the entry is the first stamp in the task.

スタンプデータライトイネーブル信号(図11参照)がアサートされて、スタンプデータがスタンプ保持部44に書き込まれると、スタンプ保持部44に対応したスタンプ番号StNがメモリ54に書き込まれる。この際、メモリ54において使用されるエントリは、バリッドビットEnVがセットされておらず且つ最も古いエントリである。このエントリは、第1書き込みポインタによって指定される(図10参照)。スタンプ番号StNが書き込まれると、そのエントリのバリッドビットEnVが“1”にセットされる。すなわち使用中となる。そして第1書き込みポインタがインクリメントされる。   When the stamp data write enable signal (see FIG. 11) is asserted and the stamp data is written to the stamp holding unit 44, the stamp number StN corresponding to the stamp holding unit 44 is written to the memory 54. At this time, the entry used in the memory 54 is the oldest entry in which the valid bit EnV is not set. This entry is designated by the first write pointer (see FIG. 10). When the stamp number StN is written, the valid bit EnV of the entry is set to “1”. That is, it is in use. Then, the first write pointer is incremented.

次に第2スタート信号がアサートされると、メモリ54のうちでRdy2がセットされていない最も古いエントリのRdy2がセット(“1”)される。このエントリは、第2書き込みポインタによって指定される(図10参照)。また、そのエントリに保持されるスタンプ番号StNが、第2データ保持部43において、当該第2データが書き込まれるエントリのエントリ番号となる。Rdy2がセットされると、第2書き込みポインタがインクリメントされる。   Next, when the second start signal is asserted, Rdy2 of the oldest entry in the memory 54 where Rdy2 is not set is set (“1”). This entry is designated by the second write pointer (see FIG. 10). In addition, the stamp number StN held in the entry becomes the entry number of the entry in which the second data is written in the second data holding unit 43. When Rdy2 is set, the second write pointer is incremented.

スレッド保持部47がフル(full)ではなく、メモリ54の読み出しポインタの示すエントリのバリッドビットEnVがセットされており、且つ第2データレディビットRdy2もセットされており、そしてスタンプ保持部のリードポートが空いている(読み出し命令が無い)ならば、スタンプ保持部44からQV、及びXY座標が読み出されてスレッド生成部46に送られ、スレッド生成部46でクアッドマージが行われる。読み出しポインタは、メモリ54において、読み出すべきデータが保持されているエントリを指定する。   The thread holding unit 47 is not full, the valid bit EnV of the entry indicated by the read pointer of the memory 54 is set, the second data ready bit Rdy2 is also set, and the read port of the stamp holding unit Is empty (there is no read command), the QV and XY coordinates are read from the stamp holding unit 44 and sent to the thread generation unit 46, and the thread generation unit 46 performs quad merge. The read pointer specifies an entry in the memory 54 that holds data to be read.

ここで、クアッドマージについて図13を用いて簡単に説明する。図13はクアッドマージの概念図である。クアッドマージとは、同一XY座標の連続する2つのスタンプを1つのスタンプにマージすることである。クアッドマージを行うことで、2つのスタンプのうちバリッドなクアッドを1つのスタンプに合成出来、一度に処理出来る。従って、描画処理すべきデータ量を圧縮出来る。   Here, the quad merge will be briefly described with reference to FIG. FIG. 13 is a conceptual diagram of quad-merge. The quad merge is to merge two consecutive stamps having the same XY coordinates into one stamp. By performing quad merge, a valid quad of two stamps can be combined into one stamp and processed at a time. Therefore, the amount of data to be drawn can be compressed.

図13に示すように、1つのスタンプに含まれる4つのクアッドをそれぞれクアッドQ0〜Q3と呼ぶことにする。まず始めにクアッドQ0、Q2がバリッドで且つクアッドQ1、Q3がインバリッドなスタンプ1が命令制御部に入力され、引き続きクアッドQ1、Q2がバリッドで且つクアッドQ0、Q3がインバリッドなスタンプ2が入力された場合を考える。この場合、2つのスタンプ1、2をマージすることにより、スタンプ1のクアッドQ0、Q2と、スタンプ2のクアッドQ1、Q2とを含む新規なスタンプを生成する。この新規なスタンプを、クアッドマージ前のスタンプと区別するために以後スレッド(thread)と呼ぶことにする。   As shown in FIG. 13, the four quads included in one stamp are called quads Q0 to Q3, respectively. First, the stamp 1 in which the quads Q0 and Q2 are valid and the quads Q1 and Q3 are invalid is input to the instruction control unit. Subsequently, the quads Q1 and Q2 are valid and the quads Q0 and Q3 are invalid stamp 2 are input. Think about the case. In this case, the two stamps 1 and 2 are merged to generate a new stamp including quads Q0 and Q2 of stamp 1 and quads Q1 and Q2 of stamp 2. This new stamp is hereinafter referred to as a thread in order to distinguish it from the stamp before the quad merge.

書き込み制御部40の説明に戻る。書き込み制御部40は、同期回路31の発生するタスク同期信号をラッチする。タスク同期信号がアサートされると、メモリ54のうちでバリッドビットEnVがセットされておらず、且つそれらのうちで最も先頭(バリッドビットがセットされた最後のスタンプに対応するエントリの次)のエントリの同期ビットSyncをセットする。図11は、タスク同期信号が最も早いタイミングでアサートされた場合を示しており、前のタスクの最後のスタンプをメモリ54に書き込むタイミング(スタンプデータライトイネーブル信号がアサートされるタイミング)の次のサイクルで同期ビットSyncがセットされる。メモリ54の第1、第2書き込みポインタは、ちょうど同期ビットSyncを書き込むべき位置を指している。同期ビットSyncの書き込みでは第1、第2書き込みポインタはインクリメントされない。よって、次のタスクの最初のスタンプは、同期ビットSyncがセットされたエントリに書き込まれる。   Returning to the description of the write control unit 40. The write control unit 40 latches the task synchronization signal generated by the synchronization circuit 31. When the task synchronization signal is asserted, the valid bit EnV is not set in the memory 54, and the first entry (next to the entry corresponding to the last stamp in which the valid bit is set) among them. Synchronization bit Sync is set. FIG. 11 shows a case where the task synchronization signal is asserted at the earliest timing, and the next cycle of the timing for writing the last stamp of the previous task to the memory 54 (timing at which the stamp data write enable signal is asserted). The synchronization bit Sync is set. The first and second write pointers of the memory 54 point to positions where the synchronization bit Sync is to be written. When the synchronization bit Sync is written, the first and second write pointers are not incremented. Therefore, the first stamp of the next task is written to the entry in which the synchronization bit Sync is set.

リセット直後(例えば電源投入直後など)は、読み出しポインタはゼロに初期化され、エントリ0の同期ビットSyncが1にされる。タスクの処理開始を示すタスク実行命令がアサートされると、読み出しポインタが示すエントリの同期ビットSyncがクリアされる。よって、読み出しポインタが示すエントリの同期ビットSyncがクリアされていれば、当該エントリに対応するスタンプは既に開始されたタスクに属するものである。従って、この場合にはクアッドマージの為にスタンプ保持部からのデータ読み出しが要求される。逆に読み出しポインが示すエントリの同期ビットSyncが1であれば、そのエントリのスタンプは次のタスクのものであり、且つそのタスクに対するタスク実行命令がアサートされていないことを意味する。   Immediately after reset (for example, immediately after power-on), the read pointer is initialized to zero, and the synchronization bit Sync of entry 0 is set to 1. When a task execution instruction indicating the start of task processing is asserted, the synchronization bit Sync of the entry indicated by the read pointer is cleared. Therefore, if the synchronization bit Sync of the entry indicated by the read pointer is cleared, the stamp corresponding to the entry belongs to the task that has already started. Therefore, in this case, data reading from the stamp holding unit is required for quad merging. Conversely, if the synchronization bit Sync of the entry indicated by the read point is 1, it means that the stamp of the entry is that of the next task, and the task execution instruction for that task has not been asserted.

また書き込み制御部は、タスクの最初のスタンプであることを意味する新規タスク信号を生成する。これは、タスク実行命令がアサートされて、最初のスタンプがメモリ54からスレッド生成部46に出力される際にアサートされる。   The write control unit also generates a new task signal that means the first stamp of the task. This is asserted when the task execution instruction is asserted and the first stamp is output from the memory 54 to the thread generation unit 46.

次に第1データ保持部42について説明する。第1データ保持部42は、複数のエントリを有する半導体メモリである。第1データライトイネーブル信号がアサートされると、第1データ保持部42におけるエントリのうち、第1データライトアドレス信号の示すエントリに第1データが書き込まれる。これら3つの信号は書き込み制御部40から送られる。   Next, the first data holding unit 42 will be described. The first data holding unit 42 is a semiconductor memory having a plurality of entries. When the first data write enable signal is asserted, the first data is written to the entry indicated by the first data write address signal among the entries in the first data holding unit 42. These three signals are sent from the write control unit 40.

また、第1データリードイネーブル信号がアサートされると、第1データ保持部42は描画処理部36から第1データリードアドレス信号を受信する。第1データリードアドレス信号は、読み出すべきスタンプのアドレスを示す。そして、第1データ保持部42におけるエントリのうち、第1データリードアドレス信号により示されるエントリから、第1データが読み出される。   When the first data read enable signal is asserted, the first data holding unit 42 receives the first data read address signal from the drawing processing unit 36. The first data read address signal indicates the address of the stamp to be read. Then, the first data is read from the entry indicated by the first data read address signal among the entries in the first data holding unit 42.

次に第2データ保持部43について説明する。第2データ保持部43は、複数のエントリを有する半導体メモリである。書き込み時において、データ振り分け部30から1サイクルあたり例えば64ビットの第2データが送付されてくる。そして、書き込み制御部40が第2データを複数サイクル保持して第2データを組み立てた後、書き込み制御部40が第2データライト終了信号をアサートする。これにより、第2データ保持部43において、第2スタンプ番号StNWが示すアドレスに第2データが書き込まれる。なお、第2スタンプ番号StNWは、第2データ保持部43において、当該スタンプに対して付与されたスタンプ番号StNと同一である。   Next, the second data holding unit 43 will be described. The second data holding unit 43 is a semiconductor memory having a plurality of entries. At the time of writing, for example, 64-bit second data is sent from the data distribution unit 30 per cycle. Then, after the write control unit 40 holds the second data for a plurality of cycles and assembles the second data, the write control unit 40 asserts a second data write end signal. As a result, the second data holding unit 43 writes the second data at the address indicated by the second stamp number StNW. The second stamp number StNW is the same as the stamp number StN assigned to the stamp in the second data holding unit 43.

データの読み出し時は、描画処理部36が第2データリードイネーブル信号をアサートすると、第2データ保持部43は描画処理部36からスタンプ番号StNを受信する。そして、スタンプ番号StNにより指定されるエントリ内のデータが読み出される。   At the time of reading data, when the drawing processing unit 36 asserts the second data read enable signal, the second data holding unit 43 receives the stamp number StN from the drawing processing unit 36. Then, the data in the entry designated by the stamp number StN is read.

次にスタンプ保持部44について説明する。スタンプ保持部44は、複数のエントリを有する半導体メモリを含む。書き込み制御部40が信号スタンプデータライトイネーブル信号をアサートすると、スタンプ保持部44において、スタンプ番号StNが示すアドレスにスタンプデータが書き込まれる。スタンプデータは書き込み制御部40から送られ、座標、QV、第3データ、及びピクセルバリッド信号を含む。またスタンプ保持部44は、スレッド生成部46からのデータ読み出し要求(クアッドマージのため)と、描画処理部36からのデータ読み出し要求(レジスタリードのため)とを調停して、スタンプデータを外部へ出力する。描画処理部36からの読み出し要求に対応する際には2個のスタンプのデータが読み出される。以下、それぞれのスタンプのスタンプ番号を旧スタンプ番号StN0、新規スタンプ番号StN1と呼ぶことにする。クアッドマージされる2つスタンプのうち、StN0は古い方のスタンプ、StN1は新しい方のスタンプを意味する。しかし、クアッドマージされていないスレッドの場合、StN1に対応するスタンプデータは任意の値である(通常は、1つ前に生成されたスレッドのStN0に対応するデータである)。この場合、読み出されたStN1のデータは不要なデータであり、命令制御部35によって参照されることは無い。   Next, the stamp holding unit 44 will be described. The stamp holding unit 44 includes a semiconductor memory having a plurality of entries. When the write control unit 40 asserts the signal stamp data write enable signal, the stamp holding unit 44 writes the stamp data at the address indicated by the stamp number StN. The stamp data is sent from the writing control unit 40 and includes coordinates, QV, third data, and a pixel valid signal. The stamp holding unit 44 arbitrates the data read request from the thread generation unit 46 (for quad merge) and the data read request from the drawing processing unit 36 (for register read), and sends the stamp data to the outside. Output. When responding to a read request from the drawing processing unit 36, data of two stamps are read. Hereinafter, the stamp numbers of the respective stamps are referred to as an old stamp number StN0 and a new stamp number StN1. Among the two stamps to be quad-merged, StN0 means the older stamp, and StN1 means the newer stamp. However, in the case of a thread that has not been quad-merged, the stamp data corresponding to StN1 is an arbitrary value (usually data corresponding to StN0 of the thread generated immediately before). In this case, the read data of StN1 is unnecessary data and is not referred to by the instruction control unit 35.

次にオーバーラップ検出部45について説明する。オーバーラップ検出部45はXYテーブルを備える。図14はXYテーブルの概念図である。図示するようにXYテーブルはM個(Mは2以上の自然数)のエントリを有し、それぞれのエントリにバリッドビットEnV、XY座標、及びスタンプ番号StNが保持される。   Next, the overlap detection unit 45 will be described. The overlap detection unit 45 includes an XY table. FIG. 14 is a conceptual diagram of an XY table. As shown in the figure, the XY table has M entries (M is a natural number of 2 or more), and a valid bit EnV, XY coordinates, and a stamp number StN are held in each entry.

XYテーブルは、全てのスタンプのXY座標を保持する。そして、1つのXY座標につき1つのエントリがアサインされ、有効なエントリに対してはエントリバリッドEnVがセットされる。StNフィールドは、各ビットが対応するXY座標と同一のXY座標を有するスタンプのスタンプ番号に対応する。例えばStN=5のスタンプのXY座標が“B”であったとすると、エントリ1のXY座標フィールドには“B”がセットされ、且つStNフィールドの5番目のビットに“1”がセットされる。別の例としては、スタンプ保持部に存在する全16スタンプのXY座標が全て“A”であったとすると、エントリ0のXY座標フィールドに“A”がセットされ、そのStNフィールドは全ビットが“1”、すなわちStN=0xFFFFとされる。   The XY table holds the XY coordinates of all stamps. One entry is assigned to one XY coordinate, and an entry valid EnV is set for a valid entry. The StN field corresponds to the stamp number of the stamp having the same XY coordinate as the XY coordinate to which each bit corresponds. For example, if the XY coordinate of the stamp of StN = 5 is “B”, “B” is set in the XY coordinate field of entry 1, and “1” is set in the fifth bit of the StN field. As another example, if the XY coordinates of all 16 stamps existing in the stamp holding unit are all “A”, “A” is set in the XY coordinate field of entry 0, and all bits of the StN field are “ 1 ″, that is, StN = 0xFFFF.

オーバーラップ検出部45は、スレッド生成部46のマージバッファ内にクアッドが存在し且つ新規スタンプがスレッド生成部46に入力された際に動作を開始する。スレッド生成部46の構成は後述する。そして、マージバッファ内のクアッド、すなわち前に入力されたスタンプが含むバリッドなクアッドと新規スタンプとがマージされる。この際、全てのクアッドがマージされなかった場合、すなわちいずれかのクアッドがマージバッファに残った場合には、オーバーラップ検出部45は前のスタンプ(マージバッファ内に存在していたスタンプ)に対して動作し、XYタグを出力する。他方、全てのクアッドがマージされた場合、すなわちスタンプがマージバッファに残らなかった場合には、オーバーラップ検出部45は上記動作に加えて新規スタンプに対しても動作し、XY座標タグのエントリにStNを登録する。換言すれば、この場合には2つのスタンプを連続して処理する。   The overlap detection unit 45 starts an operation when a quad exists in the merge buffer of the thread generation unit 46 and a new stamp is input to the thread generation unit 46. The configuration of the thread generation unit 46 will be described later. Then, the quad in the merge buffer, that is, the valid quad included in the previously input stamp and the new stamp are merged. At this time, if all the quads are not merged, that is, if any of the quads remain in the merge buffer, the overlap detection unit 45 performs the previous stamp (stamp that existed in the merge buffer). And outputs an XY tag. On the other hand, when all the quads are merged, that is, when the stamp does not remain in the merge buffer, the overlap detection unit 45 operates on the new stamp in addition to the above operation, and enters the entry of the XY coordinate tag. Register StN. In other words, in this case, two stamps are processed in succession.

図15はオーバーラップ検出部45のブロック図である。図示するようにオーバーラップ検出部45は、M個のエントリ部60−0〜60−(M−1)、XYテーブル選択部61、及びエントリ割り当て部62を備えている。   FIG. 15 is a block diagram of the overlap detection unit 45. As illustrated, the overlap detection unit 45 includes M entry units 60-0 to 60- (M-1), an XY table selection unit 61, and an entry allocation unit 62.

XYテーブル選択部61はXYテーブルの空きエントリを探す。XYテーブルにおけるM個のエントリはエントリ部60−0〜60−(M−1)にそれぞれ対応している。そしてエントリ部60−0〜60−(M−1)は、各々が保持するXY座標と、マージバッファに保持されるスタンプのXY座標とを比較する。   The XY table selection unit 61 searches for an empty entry in the XY table. The M entries in the XY table correspond to entry sections 60-0 to 60- (M-1), respectively. Then, the entry units 60-0 to 60- (M-1) compare the XY coordinates held by each with the XY coordinates of the stamp held in the merge buffer.

エントリ割り当て部62は、XY座標比較結果に基づいてXYテーブルのいずれかのエントリをアロケート(allocate)する。マージバッファにクアッドがあり且つ新規スタンプの全てのクアッドがマージされた時に、オーバーラップ検出部45はXYテーブルにおいて新規スタンプに対応するStNフィールドをセットする。   The entry allocation unit 62 allocates any entry in the XY table based on the XY coordinate comparison result. When there is a quad in the merge buffer and all quads of the new stamp have been merged, the overlap detector 45 sets the StN field corresponding to the new stamp in the XY table.

次に、オーバーラップ検出部45に含まれる各回路ブロックの構成について以下説明する。図16はエントリ部60−0〜60−(M−1)のブロック図である。図示するように、エントリ部60−0〜60−(M−1)の各々はNANDゲート64、比較器65、ANDゲート66、67−0〜67−(M−1)、68−0〜68−(M−1)、ORゲート69、70−0〜70−(M−1)、71、インバータ72−0〜72−(M−1)、及びデコーダ73を備えている。   Next, the configuration of each circuit block included in the overlap detection unit 45 will be described below. FIG. 16 is a block diagram of the entry units 60-0 to 60- (M-1). As illustrated, each of the entry units 60-0 to 60- (M-1) includes a NAND gate 64, a comparator 65, an AND gate 66, 67-0 to 67- (M-1), and 68-0 to 68. -(M-1), OR gate 69, 70-0 to 70- (M-1), 71, inverters 72-0 to 72- (M-1), and decoder 73.

比較器65は、マージバッファに保持されているXY座標と、当該エントリに保持されるXY座標とを比較する。そして両者が等しければ“1”を、そうでなければ“0”を出力する。NANDゲート64は、QMステージにおけるNANDゲート64の出力と、ORゲート71の出力(EnV:Entry Valid)とのNAND演算を行う。   The comparator 65 compares the XY coordinates held in the merge buffer with the XY coordinates held in the entry. If both are equal, “1” is output, otherwise “0” is output. The NAND gate 64 performs a NAND operation on the output of the NAND gate 64 in the QM stage and the output of the OR gate 71 (EnV: Entry Valid).

ANDゲート66は、比較器65の出力と、NANDゲート64の出力とのAND演算を行う。そして、ANDゲート66におけるAND演算結果が、XY座標が同一か否かを示すXY比較結果信号となる。   The AND gate 66 performs an AND operation on the output of the comparator 65 and the output of the NAND gate 64. The AND operation result in the AND gate 66 becomes an XY comparison result signal indicating whether or not the XY coordinates are the same.

ORゲート69は、ANDゲート66の出力とXY不一致信号とのOR演算を行う。XY不一致信号は、XY座標が不一致だった場合にアサートされる信号である。   The OR gate 69 performs an OR operation between the output of the AND gate 66 and the XY mismatch signal. The XY mismatch signal is a signal that is asserted when the XY coordinates do not match.

デコーダ73は、スレッド生成部46から送られるスタンプ番号StNをデコードする。ANDゲート67−0〜67−(M−1)の各々は、デコーダ73でデコードして得られたMビットの信号の各ビットと、ORゲート69の出力とのAND演算を行う。ORゲート69−0〜69−(M−1)の各々は、それぞれANDゲート67−0〜67−(M−1)の出力と、XYテーブルにおけるStNフィールドのデータの各ビットとのOR演算を行う。ANDゲート68−0〜68−(M−1)の各々は、それぞれORゲート70−0〜70−(M−1)の出力と、インバータ72−0〜72−Fの出力とのAND演算を行う。インバータ72−0〜72−(M−1)の各々は、スタンプ保持部44の各エントリ0〜(M−1)のデキュー(dequeue)をイネーブルにするためのM個のスタンプ保持部デキュー信号をそれぞれ反転させる。ORゲート71は、フリップフロップでラッチされたANDゲート68−0〜68−(M−1)の出力のOR演算を行う。   The decoder 73 decodes the stamp number StN sent from the thread generation unit 46. Each of the AND gates 67-0 to 67-(M−1) performs an AND operation on each bit of the M-bit signal obtained by decoding by the decoder 73 and the output of the OR gate 69. Each of the OR gates 69-0 to 69- (M-1) performs an OR operation between the output of the AND gates 67-0 to 67- (M-1) and each bit of the data of the StN field in the XY table. Do. Each of the AND gates 68-0 to 68- (M-1) performs an AND operation on the outputs of the OR gates 70-0 to 70- (M-1) and the outputs of the inverters 72-0 to 72-F. Do. Each of the inverters 72-0 to 72- (M-1) outputs M stamp holding unit dequeue signals for enabling dequeue of each entry 0 to (M-1) of the stamp holding unit 44. Invert each one. The OR gate 71 performs an OR operation on the outputs of the AND gates 68-0 to 68- (M-1) latched by the flip-flop.

上記構成において、ORゲート71の演算結果がXYテーブルのエントリバリッド、ANDゲート68−0〜68−(M−1)の出力をラッチするF/FがStNフィールド、XY座標をラッチするF/FがXYフィールドとなる。次に、XYテーブルへのXY座標の登録方法について図17を用いて説明する。図17は各種信号のタイミングチャートである。図示するように、時刻t62、t64、及びt68に、スタンプ番号StN0=0、1、2のスタンプがスレッド生成部46から入力される場合を考える。なお、これらのスタンプはXY座標が同一(“A”)であったとする。   In the above configuration, the operation result of the OR gate 71 is the entry valid of the XY table, the F / F that latches the outputs of the AND gates 68-0 to 68- (M-1) is the StN field, and the F / F that latches the XY coordinates. Becomes the XY field. Next, a method for registering XY coordinates in the XY table will be described with reference to FIG. FIG. 17 is a timing chart of various signals. As shown in the figure, consider a case where stamps with stamp numbers StN0 = 0, 1, and 2 are input from the thread generation unit 46 at times t62, t64, and t68. These stamps are assumed to have the same XY coordinates (“A”).

まず時刻t62においてStN0が入力される。そして、マージバッファのスタンプのXY座標と、自らのXYフィールドとを比較する。   First, StN0 is input at time t62. Then, the XY coordinate of the merge buffer stamp is compared with its own XY field.

上記比較の結果、両者は一致しなかったとすると、XY比較結果信号はネゲートされたままである。そして、XYエントリ割り当て信号がアサートされることによって新規エントリ0がアサインされ、そのエントリにXY座標(“A”)及びStN(“0x8000”)がセットされる。つまり、StNのビット0がセットされる。そしてXYタグは新たにアサインされた新規エントリのエントリ番号となり、その内容はXY座標=“A”である。また、XYテーブルにおいて新規に割り当てられたエントリのバリッドビットEnVが“1”にセットされる。従って、次に使用すべきXYテーブルエントリが“0”から“1”に変化する。すなわち、以降に入力される、異なるXY座標を有するスタンプは、エントリ1に保持される。   As a result of the comparison, if the two do not match, the XY comparison result signal remains negated. When the XY entry assignment signal is asserted, a new entry 0 is assigned, and the XY coordinates (“A”) and StN (“0x8000”) are set in the entry. That is, bit 0 of StN is set. The XY tag becomes the entry number of the newly assigned new entry, and its contents are XY coordinates = “A”. In addition, the valid bit EnV of the newly assigned entry in the XY table is set to “1”. Therefore, the XY table entry to be used next changes from “0” to “1”. That is, a stamp having different XY coordinates that is input thereafter is held in entry 1.

次に時刻t64で次のStN0が入力される。このスタンプは時刻t62で入力されたスタンプと同一XY座標であるので比較器65の出力が反転し、XY比較結果信号がアサートされる。従って、XY割り当て信号はアサートされず、新規エントリはアサインされない。そして直前に入力されたStN0が登録されているエントリ0に新たなStN0(“0xC000”)がセットされる。これは、StN0=1であり、そのStN0のビット1がセットされるためである。時刻t69でStN0=2が入力された場合も同様である。   Next, at time t64, the next StN0 is input. Since this stamp has the same XY coordinates as the stamp input at time t62, the output of the comparator 65 is inverted and the XY comparison result signal is asserted. Therefore, the XY assignment signal is not asserted and no new entry is assigned. Then, a new StN0 (“0xC000”) is set in entry 0 in which StN0 input immediately before is registered. This is because StN0 = 1 and bit 1 of StN0 is set. The same applies when StN0 = 2 is input at time t69.

次にXYテーブルからのデータの抹消方法について説明する。スタンプ保持部44がデキューされた際、スタンプ保持部デキュー信号に対応するStNフィールドのビットは、そのサイクルの終わりにクリアされる。そして、StNフィールドが全てクリアされているエントリのバリッドビットEnVが、その次のサイクルでクリアされる。スタンプ保持部デキュー信号は任意のタイミングでアサートされる。   Next, a method for deleting data from the XY table will be described. When the stamp holder 44 is dequeued, the StN field bit corresponding to the stamp holder dequeue signal is cleared at the end of the cycle. Then, the valid bit EnV of the entry in which all the StN fields are cleared is cleared in the next cycle. The stamp holding unit dequeue signal is asserted at an arbitrary timing.

図18はXYテーブル選択部61のブロック図である。図示するように、XYテーブル選択部61は、優先度エンコーダ73及びマルチプレクサ74を備えている。優先度エンコーダ73は、XYテーブルのエントリバリッド(バリッドビット)EnVをエンコードして、XYテーブル内の空きエントリを探す。そして空きエントリ中において、次に使用すべきエントリを決定して、次に使用すべきXYテーブルエントリを出力する。   FIG. 18 is a block diagram of the XY table selection unit 61. As illustrated, the XY table selection unit 61 includes a priority encoder 73 and a multiplexer 74. The priority encoder 73 encodes the entry valid (valid bit) EnV in the XY table and searches for an empty entry in the XY table. Then, in the empty entry, the entry to be used next is determined, and the XY table entry to be used next is output.

マルチプレクサ74は、XYテーブルの各エントリに保持されるXY座標を参照する。そして、スレッド保持部から与えられるプリロード用XYタグに基づいて、プリロード用XY座標を出力する。   The multiplexer 74 refers to the XY coordinates held in each entry of the XY table. Then, based on the preload XY tag given from the thread holding unit, the preload XY coordinates are output.

図19は、エントリ割り当て部62のブロック図である。図示するように、エントリ割り当て部62はORゲート75−0、75−1、NORゲート76、ANDゲート77−0〜77−(M−1)、及びデコード回路78を備えている。エントリ割り当て部62は、各エントリ部60−0〜60−(M−1)におけるXY座標の比較結果を監視する。そしていずれのエントリ部60−6〜60−(M−1)でもXY座標の比較結果が一致しなかった場合、XYテーブル選択部61で発見した空きエントリを、書き込み対象エントリとして選択する。   FIG. 19 is a block diagram of the entry allocation unit 62. As shown in the figure, the entry allocation unit 62 includes OR gates 75-0 and 75-1, a NOR gate 76, AND gates 77-0 to 77- (M-1), and a decode circuit 78. The entry allocation unit 62 monitors the comparison result of the XY coordinates in each entry unit 60-0 to 60- (M-1). If the comparison result of the XY coordinates does not match in any of the entry parts 60-6 to 60- (M-1), the empty entry found by the XY table selection part 61 is selected as a write target entry.

すなわち、ORゲート75は各エントリにおけるXY比較結果信号のNOR演算を行う。デコード回路78は、次に使用すべきXYテーブルエントリをデコードする。ANDゲート77−0〜77−(M−1)は、デコード回路78で得たデコード結果と、NORゲート75の出力とのAND演算を行う。そして、ANDゲート77−0〜77−(M−1)の出力が、それぞれXYエントリ割り当て信号となる。   That is, the OR gate 75 performs a NOR operation on the XY comparison result signal in each entry. The decode circuit 78 decodes the XY table entry to be used next. AND gates 77-0 to 77-(M−1) perform an AND operation on the decoding result obtained by the decoding circuit 78 and the output of the NOR gate 75. The outputs of the AND gates 77-0 to 77- (M-1) are XY entry assignment signals, respectively.

各エントリにおけるXY比較結果信号の全てが“Low”(不一致)であると、NORゲート75の出力が“High”となる。そして、デコード回路78は次に使用すべきXYテーブルエントリに応じて、Mビットの出力のいずれかのビットを“High”にする。従って、ANDゲート77−0〜77−(M−1)のうち、“High”とされたビットに対応するもののXYエントリ割り当て信号が“High”となり、エントリ部60−0〜60−(M−1)のうちの該当するものに対してアロケートが要求される。   If all the XY comparison result signals in each entry are “Low” (non-match), the output of the NOR gate 75 becomes “High”. Then, the decode circuit 78 sets any bit of the M-bit output to “High” according to the XY table entry to be used next. Accordingly, among the AND gates 77-0 to 77- (M−1), the XY entry assignment signal corresponding to the bit set to “High” becomes “High”, and the entry units 60-0 to 60- (M−). Allocation is required for the corresponding one of 1).

次にスレッド生成部46について説明する。スレッド生成部46はまず、スレッド生成部46に入力された最新のクアッドバリッドと、その直前に入力されマージバッファに保持されるクアッドバリッドとに基づいて、クアッドマージの可否をクアッド毎に判断する。そしてクアッドマージの可否を、第1乃至第3スレッド情報として生成する。   Next, the thread generation unit 46 will be described. First, the thread generation unit 46 determines whether or not quad merging is possible for each quad based on the latest quad valid input to the thread generation unit 46 and the quad valid input immediately before and stored in the merge buffer. Then, whether or not quad-merge is possible is generated as first to third thread information.

第1乃至第3スレッド情報について、図20乃至図22を用いて説明する。図20乃至図22は、クアッドマージを行う際の様子を示す概念図である。   The first to third thread information will be described with reference to FIGS. 20 to 22 are conceptual diagrams showing a state when performing quad merge.

まず第1スレッド情報について図20を用いて説明する。第1スレッド情報は、マージバッファ内のクアッドを追い出して、追い出したクアッドを新規スレッドに含めるか否かを示している。そして、第1スレッド情報はそれぞれが4ビットの信号を4つ含んでいる。4つの信号はそれぞれ、マージバッファ内の各クアッドに対応しており、各信号の各ビットが新規スレッド内の4つのクアッドのそれぞれに対応している。例えば、マージバッファ内のクアッドQ0の第1スレッド情報の各ビットは、マージバッファ内のクアッドQ0を、新規スレッドのクアッドQ0〜Q3のいずれかとすることを示している。従って、第1スレッド情報=(1000)だとすると、マージバッファ内のクアッドQ0を新規スレッドのクアッドQ0とすることを意味する。また第1スレッド情報=(0100)だとすると、マージバッファ内のクアッドQ0を新規スレッドのクアッドQ1とすることを意味する。また、マージバッファ内のクアッドQ1の第1スレッド情報=(1000)は、マージバッファ内のクアッドQ1を新規スレッドのクアッドQ1とすることを意味する。   First, the first thread information will be described with reference to FIG. The first thread information indicates whether or not the quad in the merge buffer is evicted and the evicted quad is included in the new thread. The first thread information includes four 4-bit signals each. Each of the four signals corresponds to each quad in the merge buffer, and each bit of each signal corresponds to each of the four quads in the new thread. For example, each bit of the first thread information of quad Q0 in the merge buffer indicates that quad Q0 in the merge buffer is any of quads Q0 to Q3 of the new thread. Therefore, if the first thread information = (1000), it means that the quad Q0 in the merge buffer is the quad Q0 of the new thread. If the first thread information = (0100), it means that the quad Q0 in the merge buffer is the quad Q1 of the new thread. Further, the first thread information = (1000) of the quad Q1 in the merge buffer means that the quad Q1 in the merge buffer becomes the quad Q1 of the new thread.

次に第2スレッド情報について図21を用いて説明する。第2スレッド情報は、最新のクアッドを新規スレッドに含めるか否かを示している。そして、第2スレッド情報はそれぞれが4ビットの信号を4つ含んでいる。4つの信号はそれぞれ、最新の各クアッドQ0〜Q3に対応しており、各信号の各ビットが新規スレッド内の4つのクアッドのそれぞれに対応している。例えば、最新のクアッドQ0の第2スレッド情報=(1000)だとすると、最新のクアッドQ0を新規スレッドのクアッドQ0とすることを意味する。また第2スレッド情報=(0100)だとすると、最新のクアッドQ0を新規スレッドのクアッドQ1とすることを意味する。また、最新クアッドQ1の第2スレッド情報=(1000)は、最新クアッドQ1を新規スレッドのクアッドQ0とすることを意味する。   Next, the second thread information will be described with reference to FIG. The second thread information indicates whether or not to include the latest quad in the new thread. The second thread information includes four 4-bit signals each. Each of the four signals corresponds to the latest quads Q0 to Q3, and each bit of each signal corresponds to each of the four quads in the new thread. For example, if the second thread information of the latest quad Q0 = (1000), this means that the latest quad Q0 is the quad Q0 of the new thread. If the second thread information = (0100), it means that the latest quad Q0 is the new thread quad Q1. Also, the second thread information = (1000) of the latest quad Q1 means that the latest quad Q1 is the new thread quad Q0.

次に第3スレッド情報について図22を用いて説明する。第3スレッド情報は、最新のクアッドをマージバッファに保持させるか否かを示している。そして、第3スレッド情報はそれぞれが4ビットの信号を4つ含んでいる。4つの信号はそれぞれ最新のクアッドQ0〜Q3に対応しており、各信号の各ビットがマージバッファ内の4つのクアッドのそれぞれに対応している。例えばクアッドQ0に関する第3スレッド情報=(1000)だとすると、最新のクアッドQ0をマージバッファ内のクアッドQ0とすることを意味する。また第3スレッド情報=(0100)だとすると、最新のクアッドQ0をマージバッファ内のクアッドQ1とすることを意味する。また、最新のクアッドQ1に関する第3スレッド情報=(1000)は、最新のクアッドQ1をマージバッファ内のクアッドQ0とすることを意味する。   Next, the third thread information will be described with reference to FIG. The third thread information indicates whether or not to hold the latest quad in the merge buffer. The third thread information includes four 4-bit signals each. Each of the four signals corresponds to the latest quads Q0 to Q3, and each bit of each signal corresponds to each of the four quads in the merge buffer. For example, if the third thread information regarding quad Q0 = (1000), this means that the latest quad Q0 is the quad Q0 in the merge buffer. If the third thread information = (0100), it means that the latest quad Q0 is the quad Q1 in the merge buffer. The third thread information = (1000) regarding the latest quad Q1 means that the latest quad Q1 is the quad Q0 in the merge buffer.

またスレッド生成部46はクアッドマージを行うかどうかの判定を行う。そしてクアッドマージを行う場合にはマージバッファ内のスタンプデータをオーバーラップ検出部45へ送り、オーバーラップ検出部45に処理させる。また、マージ判定結果を基に、スレッド保持部47へ送るデータを生成する。更にスレッドIDを生成すると共に、マージバッファのスタンプに対するXYタグをオーバーラップ検出部45から受け取る。更に、スレッド保持部47へデータを転送する。またマージバッファのスタンプと新規スタンプの全てのクアッドがマージされた際には、新規スタンプデータをオーバーラップ検出部45に送り、オーバーラップ検出部45に処理させる。   Further, the thread generation unit 46 determines whether or not to perform quad merge. When quad merging is performed, the stamp data in the merge buffer is sent to the overlap detection unit 45 and processed by the overlap detection unit 45. Further, data to be sent to the thread holding unit 47 is generated based on the merge determination result. Further, a thread ID is generated, and an XY tag for the merge buffer stamp is received from the overlap detection unit 45. Further, the data is transferred to the thread holding unit 47. When all the quads of the merge buffer stamp and the new stamp are merged, the new stamp data is sent to the overlap detection unit 45 to be processed by the overlap detection unit 45.

図23はスレッド生成部46のブロック図である。図23では、第1乃至第3スレッド情報を発生する領域については図示を省略している。図示するようにスレッド生成部46は、マージ判定部83、マージバッファ84、イネーブル信号発生器85、QV発生器86、ディバイドビット(Divide bit)発生器87、スレッドID発生器88、F/F89−1〜89−6、ORゲート90、及びANDゲート92−0〜92−3を備えている。   FIG. 23 is a block diagram of the thread generation unit 46. In FIG. 23, an area where the first to third thread information is generated is not shown. As illustrated, the thread generation unit 46 includes a merge determination unit 83, a merge buffer 84, an enable signal generator 85, a QV generator 86, a divide bit generator 87, a thread ID generator 88, and an F / F 89-. 1 to 89-6, an OR gate 90, and AND gates 92-0 to 92-3.

マージ判定部83は、上記第1乃至第3スレッド情報を生成する。   The merge determination unit 83 generates the first to third thread information.

F/F89−1はスタンプ番号StNをラッチする。F/F89−3はスタンプ番号StN、新規タスク信号、タスク同期信号及びXY座標をラッチする。F/F89−5は第1乃至第3スレッド情報をラッチする。   The F / F 89-1 latches the stamp number StN. The F / F 89-3 latches the stamp number StN, the new task signal, the task synchronization signal, and the XY coordinates. The F / F 89-5 latches the first to third thread information.

F/F89−2は、F/F89−1でラッチされたデータを再度ラッチする。すなわちF/F89−1に保持されるスタンプ番号が新規スタンプ番号StN0であり、F/F89−2に保持されるスタンプ番号が旧スタンプ番号StN1である。F/F89−4は、F/F89−3でラッチされたデータを再度ラッチする。F/F89−6は、QV発生器86の出力をラッチする。これらのF/F89−2、89−4、89−6を含んでマージバッファ84が形成される。   The F / F 89-2 latches the data latched by the F / F 89-1 again. That is, the stamp number held in the F / F 89-1 is the new stamp number StN0, and the stamp number held in the F / F 89-2 is the old stamp number StN1. The F / F 89-4 latches the data latched by the F / F 89-3 again. The F / F 89-6 latches the output of the QV generator 86. A merge buffer 84 is formed including these F / Fs 89-2, 89-4, and 89-6.

イネーブル信号発生器85は、クアッドマージを行うか否かを判定し、クアッドマージを行う際にクアッドマージイネーブル信号を生成する。クアッドマージが行われる条件は次の通りである。
・マージバッファ84のクアッドのXY座標と、これからマージしようとする新規スタンプのXY座標とが同一であること
・マージバッファ84のクアッド(前回のマージの残り)のピクセルバリッド(ピクセルバリッド信号)と、これからマージしようとする新規スタンプのピクセルバリッド(ピクセルバリッド信号)との間に重複がないこと
・新規タスク信号=0、すなわち当該タスクにおける最初のスタンプでないこと
QV発生器86は、クアッドマージイネーブル信号がアサートされていれば、第1乃至第3スレッド情報に基づいて信号クアッドバリッドQV、スタンプ情報(StNum0〜StNum3)、及びクアッド情報(QNum0〜QNum3)を生成する。QV発生器86により発生されるクアッドバリッドQVは、スレッド保持部47へ出力されるべき現在のクアッドバリッドである。スタンプ情報StNum0〜StNum3及びクアッド情報(QNum0〜QNum3)は、クアッドマージがいかにしてなされたかを示す情報である。これらの情報StNum0〜StNum3、QNum0〜QNum3について図24を参照しつつ説明する。
The enable signal generator 85 determines whether or not to perform quad merge, and generates a quad merge enable signal when performing quad merge. The conditions for performing the quad merge are as follows.
-The XY coordinates of the quad in the merge buffer 84 and the XY coordinates of the new stamp to be merged are the same.
There is no overlap between the pixel valid (pixel valid signal) of the quad (merge of the previous merge) of the merge buffer 84 and the pixel valid (pixel valid signal) of the new stamp to be merged.
New task signal = 0, that is, not the first stamp in the task
If the quad merge enable signal is asserted, the QV generator 86 generates a signal quad valid QV, stamp information (StNum0 to StNum3), and quad information (QNum0 to QNum3) based on the first to third thread information. To do. The quad valid QV generated by the QV generator 86 is the current quad valid to be output to the thread holding unit 47. The stamp information StNum0 to StNum3 and the quad information (QNum0 to QNum3) are information indicating how quad merge is performed. The information StNum0 to StNum3 and QNum0 to QNum3 will be described with reference to FIG.

図示するように、スタンプ情報StNum0〜StNum3は、新規スレッドにおけるクアッドQ0〜Q3のそれぞれが、マージバッファ84内のスタンプのクアッドと新規スタンプのクアッドとのいずれであるかを示す。例えばスタンプ情報StNum0〜StNum3は各1ビットの信号であって、“0”であればマージバッファ内のスタンプ、“1”であれば新規スタンプを示す。より具体的には、StNum0=“0”の場合、新規スレッドのクアッドQ0はマージバッファ内スタンプのクアッドであり、StNum0=“1”の場合、新規スレッドのクアッドQ0は新規スタンプのクアッドであり、StNum1=“0”の場合、新規スレッドのクアッドQ1はマージバッファ内スタンプのクアッドであり、StNum1=“1”の場合、新規スレッドのクアッドQ1は新規スレッドのクアッドであり、以下StNum2、StNum3の場合も同様である。   As illustrated, the stamp information StNum0 to StNum3 indicates whether each of the quads Q0 to Q3 in the new thread is a quad of a stamp or a quad of a new stamp in the merge buffer 84. For example, the stamp information StNum0 to StNum3 is a 1-bit signal, and “0” indicates a stamp in the merge buffer, and “1” indicates a new stamp. More specifically, when StNum0 = "0", quad Q0 of the new thread is a quad of the stamp in the merge buffer, and when StNum0 = "1", quad Q0 of the new thread is a quad of the new stamp, When StNum1 = “0”, the quad Q1 of the new thread is a quad of the stamp in the merge buffer. When StNum1 = “1”, the quad Q1 of the new thread is a quad of the new thread. Hereinafter, the cases of StNum2 and StNum3 Is the same.

クアッド情報QNum0〜QNum3は、新規スレッドにおけるクアッドQ0〜Q3のそれぞれの、マージ前のスタンプ(StNumで指定されるスタンプ)内における位置を示している。例えばクアッド情報QNum0〜QNum3は2ビットの信号であって、“00”であればクアッドの位置は(x、y=0、0)、“01”であれば(x、y=1、0)、“10”であれば(x、y=0、1)、“11”であれば(x、y=1、1)である。   The quad information QNum0 to QNum3 indicates the position of each of the quads Q0 to Q3 in the new thread in the pre-merge stamp (stamp specified by StNum). For example, quad information QNum0 to QNum3 is a 2-bit signal. If “00”, the quad position is (x, y = 0, 0), and if “01” (x, y = 1, 0). , “10” (x, y = 0, 1), and “11” (x, y = 1, 1).

従って、StNum0=“0”、QNum0=“00”の場合、新規スレッドのクアッドQ0は、マージバッファ内のスタンプにおける(x、y=0、0)の位置のクアッドである。またStNum0=“1”、QNum0=“00”の場合、新規スレッドのクアッドQ0は、新規スタンプにおける(x、y=0、0)の位置のクアッドである。   Therefore, when StNum0 = “0” and QNum0 = “00”, the quad Q0 of the new thread is a quad at the position (x, y = 0, 0) in the stamp in the merge buffer. When StNum0 = "1" and QNum0 = "00", the quad Q0 of the new thread is a quad at the position (x, y = 0, 0) in the new stamp.

なお、クアッドマージイネーブル信号=0の場合にはクアッドマージは行われない。従って、マージバッファ内のスタンプがそのまま新規スレッドとして出力され、また入力された新規スタンプはマージバッファにラッチされ保存される。   If the quad merge enable signal = 0, quad merge is not performed. Therefore, the stamp in the merge buffer is output as it is as a new thread, and the input new stamp is latched and stored in the merge buffer.

ディバイドビット発生器87は、第1乃至第3スレッド情報を監視する。そして、クアッドマージにより新規スタンプのクアッドが分割され、一部のクアッドがマージバッファに保持され、他の一部が新規スレッドの一部となる場合に、ディバイドビットDivideをセットする。   The divide bit generator 87 monitors the first to third thread information. Then, when the quad of the new stamp is divided by the quad merge, a part of the quad is held in the merge buffer and the other part becomes a part of the new thread, the divide bit Divide is set.

スレッドID発生器88は、クアッドマージが終了する度にスレッドID(TdID)を生成し、生成したスレッドIDを新規スレッドに対して付与する。スレッドID発生器88は内部にカウンタを有しており、新規スレッドが生成される毎にカウントアップし、そのカウンタ値をスレッドIDとして出力する。   The thread ID generator 88 generates a thread ID (TdID) every time quad merge ends, and assigns the generated thread ID to a new thread. The thread ID generator 88 has a counter inside, counts up every time a new thread is generated, and outputs the counter value as a thread ID.

なおスタンプ番号StNに関して、前述の通りマージバッファ84内のものがStN0となり、新規スタンプのものがStN1となる。これは、クアッドマージを行わない場合であっても、一旦はマージバッファ84に格納されるからである。StN0はオーバーラップ検出部45に登録される。マージバッファ84にクアッドがあり、且つ新規スタンプが入力されると、マージバッファ84のStNがStN0になる。また全てのクアッドがマージされた場合、新規スタンプのStNがStN0となる。   Regarding the stamp number StN, as described above, the one in the merge buffer 84 is StN0, and the new stamp is StN1. This is because even if the quad merge is not performed, the merge buffer 84 temporarily stores the merge. StN0 is registered in the overlap detection unit 45. When there is a quad in the merge buffer 84 and a new stamp is input, StN of the merge buffer 84 becomes StN0. When all the quads are merged, StN of the new stamp becomes StN0.

クアッドバリッドQV、ピクセルバリッド信号、スタンプ番号StN、XY座標、新規タスク信号は、マージバッファ84に保持される。これらの信号は、新規スタンプがスレッド生成部46に入力された際にラッチされ、次の新規スタンプが入力されるまで保持される。   The quad valid QV, the pixel valid signal, the stamp number StN, the XY coordinates, and the new task signal are held in the merge buffer 84. These signals are latched when a new stamp is input to the thread generation unit 46, and are held until the next new stamp is input.

スレッドバッファライトイネーブル信号は、スレッド保持部47への書き込みをイネーブルにする信号である。ピクセルバリッド信号がセットされている際、すなわちマージバッファ84にデータが存在し且つ次の新規スタンプが入力された際に、スレッドバッファライトイネーブル信号はセットされて、スレッド保持部47へ書き込まれる。   The thread buffer write enable signal is a signal that enables writing to the thread holding unit 47. When the pixel valid signal is set, that is, when data exists in the merge buffer 84 and the next new stamp is input, the thread buffer write enable signal is set and written to the thread holding unit 47.

次に、スレッド保持部47について説明する。スレッド保持部47は、図25に示すような、スレッドに関する情報を保持出来るテーブルを有する。図示するように、テーブルは例えば8つのエントリを備え、スレッドに関する情報を各エントリに保持出来る。使用可能なエントリ数は、最大で例えば8エントリである。各エントリに保持される情報は、EnV、End、EEnd、NewT、Rdy、Run、PLCnt、PL、SpID、TdID、PC、Lck、TlC、XYtag、StN0、StN1、QV、StNum0〜StNum3、QNum0〜QNum3である。   Next, the thread holding unit 47 will be described. The thread holding unit 47 has a table that can hold information about threads as shown in FIG. As shown in the figure, the table includes, for example, eight entries, and information regarding threads can be held in each entry. The maximum number of usable entries is, for example, 8 entries. The information held in each entry is EnV, End, EEnd, NewT, Rdy, Run, PLCnt, PL, SpID, TdID, PC, Lck, TLC, XYtag, StN0, StN1, QV, StNum0 to StNum3, QNum0 to QNum3 It is.

EnVは各エントリのバリッドビットである。Endはエンド命令がFEステージを通過したことを示す。エンド命令とは、スレッドに対して行われるべき処理に関する命令列の最後の命令である。NewTは、新規なタスクに属する最初のスレッドに対してセットされる。Rdyはレディビットであり、当該エントリ(スレッド)が実行可能か、すなわち処理を開始して良いか否かを示す。Runはランビットであり、当該エントリが実行中であるか否かを示す。PLCntはプリロードカウントである。プリロードとは、命令制御部35において処理を終了したスレッドのデータ領域の、データキャッシュに対するプリフェッチ(prefetch)要求のことである。PLCntは、プリロード発行前はサイクル数をカウントダウンし、発行後はプリロードの発行順位のデコード値を保持する。PLはプリロードステートを示し、プリロード発行可能か否かを示す。SpIDは、現在実行中または次に実行すべきサブパス(Sub-pass)番号である。サブパスについては後に詳細に説明する。PCは実行開始プログラムカウンタである。Lckは、スレッドがロックを取っているか否かを示す。ロックについても後述する。TlCは、データ未着のテクスチャロード命令の個数を示す。Tld命令はテクスチャロード命令のことであり、テクスチャユニット33へのテクスチャデータのロード命令である。   EnV is a valid bit of each entry. End indicates that the end instruction has passed the FE stage. The end instruction is the last instruction in the instruction sequence related to processing to be performed on the thread. NewT is set for the first thread belonging to the new task. Rdy is a ready bit and indicates whether the entry (thread) can be executed, that is, whether the processing can be started. Run is a run bit and indicates whether or not the entry is being executed. PLCnt is a preload count. The preload is a prefetch request to the data cache in the data area of the thread that has been processed by the instruction control unit 35. The PLCnt counts down the number of cycles before issuing the preload, and holds the decode value of the preload issue order after issuing. PL indicates a preload state and indicates whether or not a preload can be issued. SpID is a sub-pass number that is currently being executed or to be executed next. The sub path will be described in detail later. PC is an execution start program counter. Lck indicates whether or not the thread is locked. The lock will also be described later. TLC indicates the number of texture load instructions that have not yet received data. The Tld instruction is a texture load instruction, and is a texture data load instruction to the texture unit 33.

次にスレッド保持部47の構成について図26を用いて説明する。図26はスレッド保持部47のブロック図である。図示するように、スレッド保持部47はスレッドレジスタ群94、プリロードブロック95、アップデート部96、スレッド発行制御部97、テクスチャロード制御部98、インターフェース99、及び比較部100を備えている。   Next, the configuration of the thread holding unit 47 will be described with reference to FIG. FIG. 26 is a block diagram of the thread holding unit 47. As illustrated, the thread holding unit 47 includes a thread register group 94, a preload block 95, an update unit 96, a thread issue control unit 97, a texture load control unit 98, an interface 99, and a comparison unit 100.

スレッドレジスタ群94はM個のレジスタ101を備えている。そして、レジスタ101の各々が、図25に示したテーブルのエントリ0〜(M−1)にそれぞれ対応している。図27はレジスタ101のブロック図である。   The thread register group 94 includes M registers 101. Each of the registers 101 corresponds to entries 0 to (M−1) of the table shown in FIG. FIG. 27 is a block diagram of the register 101.

図示するように、アップデート部96からデータが送られるもの、すなわちステートがアップデートされるもの(EnV、End、Rdy、Run、PLCnt、PL、SpID、PC、Lck、TlC)は、毎サイクルそれがF/Fに書き込まれる。また、StN0、StN1、NewT、XY座標tag、TdID、QNum0〜QNum3、StNum0〜StNum3、QV(これらの信号をXXXXと呼ぶことにする)は、同じものが再度F/Fに書き込まれる。   As shown in the drawing, data sent from the update unit 96, that is, data whose state is updated (EnV, End, Rdy, Run, PLCnt, PL, SpID, PC, Lck, TLC) Written to / F. Also, the same StN0, StN1, NewT, XY coordinate tag, TdID, QNum0 to QNum3, StNum0 to StNum3, and QV (these signals will be referred to as XXXX) are written to the F / F again.

他方、スレッドライトイネーブル信号がアサートされ、スレッド保持部に対する書き込みエントリ番号がレジスタ101のエントリ番号と一致した場合、当該レジスタ101のバリッドビットがアサートされる。また、信号XXXXがF/Fに新たに書き込まれる。更に、PLCntとPCについては、コンフィギュレーションレジスタ41の値(9’h000、INSTBASE)がF/Fに書き込まれる。End、Rdy、Run、PL、SpID、Lck、TlCはそれぞれゼロとされる。   On the other hand, when the thread write enable signal is asserted and the write entry number for the thread holding unit matches the entry number of the register 101, the valid bit of the register 101 is asserted. In addition, the signal XXXX is newly written to the F / F. Further, for PLCnt and PC, the value (9'h000, INSTBASE) of the configuration register 41 is written to the F / F. End, Rdy, Run, PL, SpID, Lck, and TLC are each zero.

次にプリロードブロック95について説明する。図28はプリロードブロック95のブロック図である。プリロードブロック95は、データキャッシュプリロードに必要な信号を生成する。   Next, the preload block 95 will be described. FIG. 28 is a block diagram of the preload block 95. The preload block 95 generates a signal necessary for data cache preloading.

図28において、スレッド保持部の各エントリ0〜(M−1)に相当するレジスタ101の各々は、プリロードステートPLがPLWATからPLREQに変化すると、プリロード発行信号をアサートする。PLWATは初期状態であり、スレッド及びプリロード発行前の状態のことである。またPLREQはプリロード発行要求中の状態のことである。   In FIG. 28, each of the registers 101 corresponding to the entries 0 to (M−1) of the thread holding unit asserts a preload issue signal when the preload state PL changes from PLWAT to PLREQ. PLWAT is an initial state and is a state before issuing a thread and a preload. PLREQ is a state in which a preload issue request is being made.

プリロード発行信号がアサートされると、アービター103はこれを受け、エントリ0〜(M−1)の順序で要求を選択する。ANDゲート104はアービター103での選択結果に基づくMビットの信号を出力する。各ビットはスレッド保持部のエントリ0〜Mに対応しており、各エントリに対するアクノリッジ信号となる。例えばアービター103がエントリ0を選択すると、ANDゲート104はアクノリッジをエントリ0に返す。   When the preload issue signal is asserted, the arbiter 103 receives it and selects requests in the order of entries 0 to (M−1). The AND gate 104 outputs an M-bit signal based on the selection result in the arbiter 103. Each bit corresponds to entries 0 to M of the thread holding unit, and becomes an acknowledge signal for each entry. For example, when the arbiter 103 selects the entry 0, the AND gate 104 returns an acknowledge to the entry 0.

更にエンコーダ105はアクノリッジ信号をエンコードする。そしてエンコード結果がF/Fで2度ラッチされた後、スレッド保持部のエントリ番号を示すプリロードスレッドエントリ番号として出力される。   Furthermore, the encoder 105 encodes the acknowledge signal. The encoding result is latched twice by the F / F and then output as a preload thread entry number indicating the entry number of the thread holding unit.

ORゲート107はアクノリッジ信号を監視する。そしてM個のアクノリッジ信号のいずれかがアサートされると、プリロード要求信号をアサートさせる。   The OR gate 107 monitors the acknowledge signal. When any of the M acknowledge signals is asserted, the preload request signal is asserted.

セレクタ106はエンコーダ105におけるエンコード結果に応じて、エントリ0〜(M−1)のいずれかからスタンプ番号、スレッドID、サブパスID(StN0、TdID、SpID)を読み出して、F/Fにラッチさせる。そして、XYテーブルからXY座標を読み出すためにプリロード用XYタグが出力され、更に、スレッドID及びサブパスIDを示すプリロードスレッドID及びプリロードサブパスIDが出力される。   The selector 106 reads the stamp number, the thread ID, and the sub path ID (StN0, TdID, SpID) from any of the entries 0 to (M−1) according to the encoding result in the encoder 105, and latches it in the F / F. Then, a preload XY tag is output to read the XY coordinates from the XY table, and further, a preload thread ID and a preload subpath ID indicating a thread ID and a subpath ID are output.

次にアップデート部96について説明する。アップデート部96はスレッド保持部の各エントリのステータス(EnV、End、Rdy、Run、PLCnt、PL、SpID、PC、Lck、TlCのステート)をアップデートする。アップデート部96はM個のセクション102を含んでおり、各セクション102がそれぞれエントリ0〜(M−1)に対応している。各セクション102は、ステータスをアップデートするためのアップデートロジックを備えている。以下、アップデートロジックについて説明する。   Next, the update unit 96 will be described. The update unit 96 updates the status (EnV, End, Rdy, Run, PLCnt, PL, SpID, PC, Lck, TLC state) of each entry in the thread holding unit. The update unit 96 includes M sections 102, and each section 102 corresponds to entries 0 to (M-1). Each section 102 includes update logic for updating the status. Hereinafter, the update logic will be described.

<Endのアップデートロジック>
Endビットは、エンド命令に到達したことを示すビットであり、スレッド生成時にクリアされる。アップデートロジックは、エンド命令がアサートされ、且つ実行スレッドエントリ番号が当該エントリのエントリ番号と同一であるとき、Endビットをセットする。Endは、バリッドビットEnVがデキュー条件の揃うまでクリアされないため、その間誤って再びRunさせないためにセットされる。
<End update logic>
The End bit is a bit indicating that the end instruction has been reached, and is cleared when a thread is generated. The update logic sets the End bit when the end instruction is asserted and the execution thread entry number is the same as the entry number of the entry. End is not cleared until the valid bit EnV meets the dequeue condition, so that End is not set to run again in the meantime.

<EnVのアップデートロジック>
図29はバリッドビットEnVのアップデートロジックの回路図である。EnVは、スレッド生成時にセットされる。アップデートロジックにおいて、比較器108はTlC==0の場合に“High”を出力する。そしてNANDゲート109が、比較器108の出力とEndとのNAND演算を行う。NAND演算結果はスレッドデキュー要求信号としてスレッド保持部へ与えられる。Endビットがセットされ、TlC=0となったら、スレッド保持部のデキューブロックに対してデキュー要求信号をアサートする。そして、デキューブロックから与えられるスレッドデキュー許可信号がアサートされると、バリッドビットがクリアされる。
<EnV update logic>
FIG. 29 is a circuit diagram of the update logic of the valid bit EnV. EnV is set when a thread is created. In the update logic, the comparator 108 outputs “High” when TLC == 0. The NAND gate 109 performs a NAND operation on the output of the comparator 108 and End. The NAND operation result is given to the thread holding unit as a thread dequeue request signal. When the End bit is set and TLC = 0, the dequeue request signal is asserted to the dequeue block of the thread holding unit. When the thread dequeue permission signal given from the dequeue block is asserted, the valid bit is cleared.

<PLのアップデートロジック>
図30はPLの各ステートを示している。PLはPLWAT、PLREQ、PLDON、及びPLRUNの4つのステートを取ることが出来る。PLWATは初期状態であり、スレッド発行前でプリロード発行前の状態である。PLREQは、プリロード発行要求中の状態である。PLDONは、プリロード発行終了で且つスレッドの発行前の状態である。PLRUNは、スレッド実行中の状態である。
<PL update logic>
FIG. 30 shows each state of the PL. The PL can take four states: PLWAT, PLREQ, PLDON, and PLRUN. PLWAT is an initial state, and is a state before issuing a preload before issuing a thread. PLREQ is a state in which a preload issue request is being made. PLDON is a state after completion of preload issuance and before thread issuance. PLRUN is a state in which a thread is being executed.

PLがPLWATにセットされるタイミングは、スレッドがスレッド保持部に保持される時、またはPL=PLRUNにおいてイールド命令がアサートされた時である。PL=PLWATであるとき、PLCnt=0になったらPLはPLREQにセットされる。PL=PLREQのとき、当該エントリに対応するプリロード発行信号がアサートされたら、PLはPLDONにセットされる。PL=PLDONであるとき、当該エントリに対応するスレッドが描画処理部36に発行されたら、PLはPLRUNにセットされる。   The timing when PL is set to PLWAT is when a thread is held in the thread holding unit or when a yield instruction is asserted at PL = PLRUN. When PL = PLWAT, when PLCnt = 0, PL is set to PLREQ. When PL = PLREQ, if the preload issue signal corresponding to the entry is asserted, PL is set to PLDON. When PL = PLDON, if a thread corresponding to the entry is issued to the drawing processing unit 36, PL is set to PLRUN.

<PLCntのアップデートロジック>
図31はPLCntの各ステートを示している。イールド命令がアサートされると、PLCntにはPRELDTIMEがロードされる。PL=PLWATであるとき、PLCntはカウントダウンされる。PLCnt=0になったサイクルまでPLのステートはPLWATに留まるため、PLCnt=0においてもさらにカウントダウンされ、最終的に−1(0x1ff)までカウントダウンされる。このとき、同時にPLのステートはPLREQに代わるので−2にはならない。またPLCnt=−1であるときはすでにPLはPLREQのステートに遷移しているので、PLCntはいずれのステートでも良く、誤動作を抑制出来る。PL=PLREQであるとき、PLCntにマスターエイジカウンタ(Master Age Counter)のカウンタ初期値AgeMsがセットされる。すなわち、PLCntは−1になった次のサイクルでAgeMsがセットされることになる。上記以外の時、スレッドが発行(自スレッド以外も含む)されると、対応するランセット信号(後述する)がアサートされるので、PLCntの同じビット位置をクリアし、Ageを正しく反映させる。
<Update logic of PLCnt>
FIG. 31 shows each state of PLCnt. When the yield instruction is asserted, PRENTTIME is loaded into PLCnt. When PL = PLWAT, PLCnt is counted down. Since the state of PL remains in PLWAT until the cycle when PLCnt = 0, it is further counted down even at PLCnt = 0 and finally counted down to −1 (0 × 1ff). At this time, since the PL state is replaced with PLREQ at the same time, it does not become -2. Further, when PLCnt = −1, since the PL has already transitioned to the PLREQ state, the PLCnt may be in any state, and malfunction can be suppressed. When PL = PLREQ, a counter initial value AgeMs of a master age counter (Master Age Counter) is set in PLCnt. That is, AgeMs is set in the next cycle when PLCnt becomes -1. At other times, when a thread is issued (including a thread other than its own), a corresponding lancet signal (described later) is asserted, so the same bit position of PLCnt is cleared and Age is correctly reflected.

図32はPLCntのアップデートロジックの回路図である。図示するように、選択回路111はPLCnt、PLCntをカウントダウンしたもの、PLCntとエイジレジスタアップデート信号の反転信号とのAND演算結果、AgeMs、“0”、及びPRELDTIMEのいずれかを選択し、それを新たなPLCntとする。選択回路111は、制御回路112の制御に基づいて選択動作を行う。制御回路112は各種信号に基づいて選択回路111の選択動作を制御するが、その具体的な制御方法は図31を用いて説明したとおりである。エイジレジスタアップデート信号及びAgeMsについては後述する。   FIG. 32 is a circuit diagram of the PLCnt update logic. As shown in the figure, the selection circuit 111 selects one of the PLCnt, the PLCnt countdown, the AND operation result of the PLCnt and the inverted signal of the age register update signal, AgeMs, “0”, and PRELDTIME. PLCnt. The selection circuit 111 performs a selection operation based on the control of the control circuit 112. The control circuit 112 controls the selection operation of the selection circuit 111 based on various signals. The specific control method is as described with reference to FIG. The age register update signal and AgeMs will be described later.

<Lckのアップデートロジック>
図33はロックビットLckのアップデートロジックである。図示するように、比較器113は、エントリ番号EntNと新規スレッドエントリ番号とを比較する。新規スレッドエントリ番号とは、新たに生成されてスレッド保持部に書き込まれたスレッドに関する。ANDゲート114は、比較器113の出力とバリッドビットEnVとのAND演算を行う。ANDゲート115は、ANDゲート114の出力とロック命令とのAND演算を行う。ANDゲート116は、ANDゲート114の出力と、ロッククリア命令、エンド命令とのAND演算を行う。ORゲート117は、ANDゲート115の出力とLckとのOR演算を行う。ANDゲート118は、ORゲート117の出力とANDゲート116の出力とのAND演算を行う。そしてANDゲート118の出力が新規なLckとなる。
<Lck update logic>
FIG. 33 shows the update logic of the lock bit Lck. As shown in the figure, the comparator 113 compares the entry number EntN with the new thread entry number. The new thread entry number relates to a thread newly generated and written in the thread holding unit. The AND gate 114 performs an AND operation on the output of the comparator 113 and the valid bit EnV. The AND gate 115 performs an AND operation on the output of the AND gate 114 and the lock instruction. The AND gate 116 performs an AND operation on the output of the AND gate 114, the lock clear instruction, and the end instruction. The OR gate 117 performs an OR operation between the output of the AND gate 115 and Lck. The AND gate 118 performs an AND operation on the output of the OR gate 117 and the output of the AND gate 116. The output of the AND gate 118 becomes a new Lck.

上記構成において、ロック命令がアサートされると、新規スレッドエントリ番号に一致するエントリのLckビットがセットされる。ロッククリア命令またはエンド命令がアサートされた場合には、実行スレッドエントリ番号が一致するエントリのLckビットはクリアされる。   In the above configuration, when the lock instruction is asserted, the Lck bit of the entry matching the new thread entry number is set. When the lock clear instruction or the end instruction is asserted, the Lck bit of the entry having the same execution thread entry number is cleared.

<TlCのアップデートロジック>
図34はTlCのアップデートロジックである。図示するように、比較器119は新規スレッドエントリ番号と当該エントリのスレッドエントリ番号とを比較する。比較器120は、テクスチャロード命令実行中において、テクスチャロードを行う実行スレッドエントリ番号と当該エントリのエントリ番号とを比較する。ANDゲート121は、比較器119の出力とテクスチャロード命令とのAND演算を行う。ANDゲート122は、比較器120の出力とテクスチャロードアクノリッジ信号とのAND演算を行う。テクスチャロードアクノリッジ信号は、テクスチャロード命令につき実行が完了したことを示すアクノリッジ信号である。減算器123は、TlCを−1する。加算器124は、TlCを+1する。選択回路125はANDゲート121の出力に基づいて、加算器124における加算前後のTlCのいずれかを選択する。選択回路126はANDゲート122の出力に基づいて、減算器123の出力と選択回路125の出力とのいずれかを選択する。そして選択回路126で選択された信号が、新たなTlCとなる。
<TLC update logic>
FIG. 34 shows TLC update logic. As shown in the figure, the comparator 119 compares the new thread entry number with the thread entry number of the entry. The comparator 120 compares the execution thread entry number that performs texture loading with the entry number of the entry during execution of the texture load instruction. The AND gate 121 performs an AND operation on the output of the comparator 119 and the texture load instruction. The AND gate 122 performs an AND operation on the output of the comparator 120 and the texture load acknowledge signal. The texture load acknowledge signal is an acknowledge signal indicating that execution has been completed for the texture load instruction. The subtractor 123 decrements TLC by -1. The adder 124 increments TLC by +1. Based on the output of the AND gate 121, the selection circuit 125 selects one of TLCs before and after the addition in the adder 124. The selection circuit 126 selects either the output of the subtractor 123 or the output of the selection circuit 125 based on the output of the AND gate 122. Then, the signal selected by the selection circuit 126 becomes a new TLC.

TlCのアップデートロジックは、サブパス実行時にはテクスチャロード命令の実行個数をカウントする。テクスチャロード命令の実行時は、テクスチャロード命令がアサートされる。そのとき、新規スレッドエントリ番号と一致するエントリのTlCフィールドを1カウントアップする。テクスチャロード命令のカウントは、サブパスの1回目の実行でカウントして、その後の全てのスレッドに対して同じ値を使うのではなく、実際にそのスレッドが実行した数を動的にカウントする。分岐命令の実効状態によってテクスチャロード命令の実行個数が異なるかもしれないからである。   The TLC update logic counts the number of executed texture load instructions when executing a sub-pass. When the texture load instruction is executed, the texture load instruction is asserted. At that time, the TLC field of the entry matching the new thread entry number is incremented by one. The count of the texture load instruction is not counted in the first execution of the sub-pass and the same value is used for all subsequent threads, but the number actually executed by the thread is dynamically counted. This is because the number of executed texture load instructions may vary depending on the effective state of the branch instruction.

テクスチャロードアクノリッジ信号がアサートされ、自分のエントリ番号がテクスチャロードを実行するスレッドエントリ番号に一致したら、TlCをカウントダウンする。   When the texture load acknowledge signal is asserted and its own entry number matches the thread entry number that executes texture loading, TLC is counted down.

<SpIDのアップデートロジック>
次にSpIDのアップデートロジックについて図35を用いて説明する。図示するようにSpIDのアップデートロジックは、比較器127、ANDゲート128、及び選択回路129を備えている。比較器127は当該エントリのエントリ番号と新規スレッドエントリ番号とを比較する。ANDゲート128は比較器127の出力とイールド命令とのAND演算を行う。選択回路129は、ANDゲート128の出力に基づいてSpIDと次のサブパスIDのいずれかを選択し、選択した方を新たなSpIDとする。
<SpID update logic>
Next, the SpID update logic will be described with reference to FIG. As illustrated, the SpID update logic includes a comparator 127, an AND gate 128, and a selection circuit 129. The comparator 127 compares the entry number of the entry with the new thread entry number. The AND gate 128 performs an AND operation on the output of the comparator 127 and the yield instruction. The selection circuit 129 selects either SpID or the next subpath ID based on the output of the AND gate 128, and sets the selected one as a new SpID.

SpIDアップデートロジックは、イールド命令がアサートされると、対応するエントリのSpIDをインクリメントする。エンド命令の場合にはすぐにデキューされるので、インクリメントの必要はない。   The SpID update logic increments the SpID of the corresponding entry when the yield instruction is asserted. In the case of an end instruction, it is dequeued immediately, so there is no need for increment.

<PCのアップデートロジック>
次にPCのアップデートロジックについて図36を用いて説明する。図示するようにPCアップデートロジックは、SpIDアップデートロジックにおいて、SpID及び次のサブパスIDを、それぞれPC及び次のPCに置き換えたものである。
<PC update logic>
Next, the update logic of the PC will be described with reference to FIG. As shown in the figure, the PC update logic is obtained by replacing the SpID and the next sub-path ID with the PC and the next PC, respectively, in the SpID update logic.

PCアップデートロジックは、スレッド生成時にINSTBASEをPCにロードする。そして、イールド命令がアサートされると、新規スレッドエントリ番号と一致するエントリのPCに次のPCをセットする。すなわちPCをインクリメントする。   The PC update logic loads INSTBASE into the PC when a thread is generated. When the yield instruction is asserted, the next PC is set to the PC of the entry that matches the new thread entry number. That is, the PC is incremented.

<Rdyのアップデートロジック>
次にレディビットRdyのアップデートロジックについて図37を用いて説明する。図示するように、検出器132はTlCがゼロであるか否かを検出する。検出器133はPLが1であるか否かを検出する。検出器134は、TdIDと次のバリッドなスレッドIDとが等しいか否かを検出する。ANDゲート135は、Runの反転信号と、EnVと、検出器132の出力とのAND演算を行う。ANDゲート136は、スレッド追い越し信号と、同一XYロック信号の反転信号とのAND演算を行う。ANDゲート137は、ANDゲート135の出力と、検出器133、134の出力と、ANDゲート136の出力とのAND演算を行う。そしてANDゲート136の出力が新たなRdyとなる。
<Update logic of Rdy>
Next, update logic of the ready bit Rdy will be described with reference to FIG. As shown, detector 132 detects whether TLC is zero. The detector 133 detects whether PL is 1. The detector 134 detects whether or not TdID is equal to the next valid thread ID. The AND gate 135 performs an AND operation on the inverted signal of Run, EnV, and the output of the detector 132. The AND gate 136 performs an AND operation on the thread overtaking signal and the inverted signal of the same XY lock signal. The AND gate 137 performs an AND operation on the output of the AND gate 135, the outputs of the detectors 133 and 134, and the output of the AND gate 136. The output of the AND gate 136 becomes a new Rdy.

なお、スレッド追い越し信号は、エントリ0〜(M−1)に関する処理が、前のスレッドに関する処理を時間的に追い越していないかどうかを示す。また同一XYロック信号は、当該エントリと同一XY座標を有する他のエントリが存在し、且つそれがロックをとっていることを示す信号である。ロックとは、同一XY座標のものについては他のスレッドの発行を禁止する命令である。   The thread overtaking signal indicates whether or not the processing related to entries 0 to (M−1) has temporally overtaken the processing related to the previous thread. The same XY lock signal is a signal indicating that there is another entry having the same XY coordinates as the entry and that it is locked. A lock is an instruction for prohibiting other threads from issuing ones having the same XY coordinates.

Rdyアップデートロジックは、スレッドが実行可能になると、Rdyビットをセットする。スレッドが実行可能な状態とは以下の全てが成立した場合である。
・EnV=1:有効なエントリである
・Run=0:実行中のエントリではない
・TlC=0:テクスチャデータのロードが終了している
・同一XYロック信号=0:自分のXY座標と同一のXY座標を持つスレッド保持部エントリがロックを取っていない。つまりそのエントリのロックビットLckがゼロにクリアされている
・自エントリに対応するスレッド追い越し信号が1である
・PL=1:プリロードを既に開始している
・自分のスレッドIDは、スレッド保持部においてバリッドな次のスレッドIDと同一でない。
スレッドが実行開始され且つランビットRunが設定されると、レディビットRdyの成立条件が成立しなくなるので、レディビットRdyはクリアされる。
<Runのアップデートロジック>
次に、ランビットRunのアップデートロジックについて説明する。エントリの発行(WakeUp時)には、RunビットとRdyビットの状態が関連する。この様子を示しているのが図38である。図示するように、エントリが発行可能になるとRdyビットがセットされる(Rdy=1)。次に、Rdyビットがセットされたエントリのうちいずれかが選択されて発行される際、Runビットがセットされる(Run=1)。更に、次のサイクルでRdyビットがクリアされる(Run=1、Rdy=0)。そして、選択されたスレッドがエンド命令またはイールド命令を実行するとRunビットがクリアされ、アイドル状態に戻る(Run=0、Rdy=0)。
The Rdy update logic sets the Rdy bit when the thread is ready to run. A thread is executable when all of the following are true:
EnV = 1: Valid entry
・ Run = 0: Not an entry being executed
-TLC = 0: Loading of texture data is complete
Same XY lock signal = 0: The thread holding unit entry having the same XY coordinate as its own XY coordinate is not locked. That is, the lock bit Lck of the entry is cleared to zero
-The thread overtaking signal corresponding to its own entry is 1.
・ PL = 1: Preload has already started
The own thread ID is not the same as the next valid thread ID in the thread holding unit.
When the execution of the thread is started and the run bit Run is set, the ready condition for the ready bit Rdy is not satisfied, so the ready bit Rdy is cleared.
<Run update logic>
Next, the update logic of the run bit Run will be described. The state of the Run bit and the Rdy bit is related to the issue of the entry (during WakeUp). FIG. 38 shows this state. As shown in the figure, when an entry can be issued, the Rdy bit is set (Rdy = 1). Next, when any of the entries having the Rdy bit set is selected and issued, the Run bit is set (Run = 1). Further, the Rdy bit is cleared in the next cycle (Run = 1, Rdy = 0). When the selected thread executes the end instruction or the yield instruction, the Run bit is cleared and the idle state is returned (Run = 0, Rdy = 0).

図39はRunアップデートロジックの回路図である。図示するように、比較器138が当該エントリのエントリ番号と新規スレッドエントリ番号とを比較する。ORゲート139はイールド命令とエンド命令とのOR演算を行う。NANDゲート140は、比較器138の出力とORゲート139の出力とのOR演算を行う。ANDゲート141は、NANDゲート140の出力とRunとのAND演算を行う。ORゲート142は、ANDゲート141の出力とランセット信号とのOR演算を行う。そしてORゲート142の出力がRunとなる。   FIG. 39 is a circuit diagram of the Run update logic. As shown in the figure, the comparator 138 compares the entry number of the entry with the new thread entry number. The OR gate 139 performs an OR operation between the yield instruction and the end instruction. The NAND gate 140 performs an OR operation on the output of the comparator 138 and the output of the OR gate 139. The AND gate 141 performs an AND operation on the output of the NAND gate 140 and Run. The OR gate 142 performs an OR operation between the output of the AND gate 141 and the lancet signal. The output of the OR gate 142 becomes Run.

上記構成において、イールド命令またはエンド命令がアサートされると、実行中のスレッドエントリ番号と同一のエントリのRunビットがクリアされる。また、スレッド発行制御部97から与えられるランセット信号がアサートされると、Runビットがセットされる。Runビットがセットされる条件は次の通りである。
・スレッド保持部内における全エントリのRunビットがゼロのとき、またはRunビットがクリアされるとき
・Rdy=1
・PLCntがセットされているビットが最もLSB(least significant bit)に近いもの。LSBに近い程プリロードを開始したタイミングが早い。サブパス0のスタンプでプリロードしていないものは、MSBがセットされているので最も優先度が低い。
In the above configuration, when the yield instruction or the end instruction is asserted, the Run bit of the same entry as the thread entry number being executed is cleared. When the lancet signal given from the thread issue control unit 97 is asserted, the Run bit is set. The conditions for setting the Run bit are as follows.
When the Run bit of all entries in the thread holding unit is zero or when the Run bit is cleared
・ Rdy = 1
The bit for which PLCnt is set is the closest to the least significant bit (LSB). The closer to LSB, the earlier the timing at which preloading is started. The sub-pass 0 stamp that is not preloaded has the lowest priority because the MSB is set.

次に図26におけるスレッド発行制御部97について説明する。図40、図41はスレッド発行制御部97の回路図である。   Next, the thread issue control unit 97 in FIG. 26 will be described. 40 and 41 are circuit diagrams of the thread issue control unit 97.

図示するように、スレッド発行制御部97は、各エントリに対応した8つのANDゲート143−0〜143−(M−1)、144−0〜144−(M−1)、ORゲート145−0〜145−(M−1)、NORゲート146−0〜146−(M−1)、及びRun検出部147を備えている。ANDゲート143−0〜143−(M−1)の各々は、エントリ0〜(M−1)に保持されるRdyとPLCntとのAND演算を行う。なお、エントリ0〜(M−1)に保持されるPLCntを、それぞれPLCnt0〜PLCnt(M−1)と呼ぶことにする。ORゲート145−0〜145−(M−1)の各々は、ANDゲート143−0〜143−(M−1)の出力の全ビットのOR演算を行う。NORゲート146−0〜146−(M−1)の各々は、ORゲート145−0〜145−(M−1)の出力と、エントリ0〜(M−1)に保持されるRdyとのNOR演算を行う。ANDゲート144−0〜144−(M−1)は、NORゲート146−0〜146−(M−1)の出力とRun検出部147の出力とのAND演算を行う。そしてANDゲート144−0〜144−(M−1)の出力が、それぞれランセット信号0〜(M−1)となる。   As illustrated, the thread issuance control unit 97 includes eight AND gates 143-0 to 143- (M-1), 144-0 to 144- (M-1) corresponding to each entry, and an OR gate 145-0. ˜145- (M−1), NOR gates 146-0˜146- (M−1), and a Run detector 147. Each of AND gates 143-0 to 143- (M-1) performs an AND operation on Rdy and PLCnt held in entries 0 to (M-1). Note that the PLCnts held in the entries 0 to (M−1) are referred to as PLCnt0 to PLCnt (M−1), respectively. Each of the OR gates 145-0 to 145- (M-1) performs an OR operation on all the bits of the outputs of the AND gates 143-0 to 143- (M-1). Each of the NOR gates 146-0 to 146- (M-1) is NOR between the outputs of the OR gates 145-0 to 145- (M-1) and Rdy held in the entries 0 to (M-1). Perform the operation. The AND gates 144-0 to 144- (M-1) perform an AND operation on the output of the NOR gates 146-0 to 146- (M-1) and the output of the Run detection unit 147. The outputs of the AND gates 144-0 to 144- (M-1) are the lancet signals 0 to (M-1), respectively.

Run検出部147は、NORゲート147−0、147−1、ORゲート147−2を備えている。NORゲート147−0は、エントリ0〜(M−1)に保持されるRunのNOR演算を行う。NORゲート147−1は、イールド命令とエンド命令のNOR演算を行う。ORゲート147−2は、NORゲート147−0、147−1の出力のOR演算を行う。そしてORゲート147−2の出力がRun検出部147の出力となる。   The Run detection unit 147 includes NOR gates 147-0 and 147-1 and an OR gate 147-2. The NOR gate 147-0 performs a NOR operation of Run held in the entries 0 to (M-1). The NOR gate 147-1 performs NOR operation of the yield instruction and the end instruction. The OR gate 147-2 performs an OR operation on the outputs of the NOR gates 147-0 and 147-1. The output of the OR gate 147-2 becomes the output of the Run detection unit 147.

またスレッド発行制御部97は、AgeMsと、プリロードブロックから与えられるアクノリッジ信号とのOR演算を行う。そして、そのOR演算結果とANDゲート144−0〜144−(M−1)の出力を反転させた信号とのAND演算を行い、演算結果をAgeMsとして出力する。   The thread issuance control unit 97 performs an OR operation on AgeMs and the acknowledge signal given from the preload block. Then, an AND operation is performed on the OR operation result and a signal obtained by inverting the output of the AND gates 144-0 to 144- (M-1), and the operation result is output as AgeMs.

更に図41に示すようにスレッド発行制御部97は、エントリ0〜(M−1)に保持されるRunに応じて、スレッド保持部のエントリ0〜(M−1)に保持されるスタンプの本体データを選択して出力する。スタンプの本体データとは、NewT、SpID、TdID、StN0、StN1、QV、StNum0〜StNum3、及びQNum0〜QNum3を含む。   Further, as shown in FIG. 41, the thread issuance control unit 97 determines the main body of the stamp held in the entries 0 to (M−1) of the thread holding unit according to the Run held in the entries 0 to (M−1). Select and output data. The main body data of the stamp includes NewT, SpID, TdID, StN0, StN1, QV, StNum0 to StNum3, and QNum0 to QNum3.

スレッド保持部47において、PLCntを保持するレジスタはプリロードカウント値を保持するレジスタであるが、プリロード後はエイジレジスタ(age register)として機能する。エイジレジスタとしての機能とは、当該エントリに保持されるデータが、スレッド保持部47内においてどれだけ古いデータであるかを示す機能である。スレッド発行制御部97は、エイジレジスタを更新するためのエイジレジスタアップデート信号及び初期値AgeMsを生成し、PLCntアップデートロジックに出力する。   In the thread holding unit 47, the register that holds the PLCnt is a register that holds the preload count value, but functions as an age register after preloading. The function as the age register is a function indicating how old the data held in the entry is in the thread holding unit 47. The thread issuance control unit 97 generates an age register update signal and an initial value AgeMs for updating the age register, and outputs them to the PLCnt update logic.

またスレッド発行制御部97は発行すべきエントリを探し、そのエントリ内のRunビットをセットする。更にスレッド発行制御部97は、Runビットを参照することによりいずれかのエントリを選択する。ここで、プリロード発行時及びスレッド発行時のエイジレジスタについて説明する。図42はプリロード発行時のエイジレジスタの様子を示す概念図である。図示するようにエイジレジスタはM個のエントリを有し、各エントリ内に例えば8ビットのデータを保持できる。またスレッド保持部47は、既にプリロード発行済みのエントリ番号に対応したビット位置がセットされた(“1”にされた)、8ビット長のマスターエイジレジスタ(master age register)を備える。マスターエイジレジスタは、例えばエントリ番号0、1、2のスレッドが既にプリロードを発行しているとすると、ビット0、1、2がセットされていることになる。   Further, the thread issue control unit 97 searches for an entry to be issued and sets the Run bit in the entry. Furthermore, the thread issuance control unit 97 selects any entry by referring to the Run bit. Here, the age register at the time of preload issue and thread issue will be described. FIG. 42 is a conceptual diagram showing the state of the age register when a preload is issued. As shown in the figure, the age register has M entries, and can hold, for example, 8-bit data in each entry. The thread holding unit 47 includes an 8-bit master age register in which a bit position corresponding to an entry number that has already been issued with a preload is set (set to “1”). For example, if the threads of entry numbers 0, 1, and 2 have already issued a preload, bits 0, 1, and 2 are set in the master age register.

図42に示すようにエントリ0〜2がプリロード発行済みの状態で、次にエントリ3がプリロードを発行したと仮定する。すると、マスターエイジレジスタの値が、エイジレジスタのプリロード発行したレジスタにコピーされる。これは、エントリにとっては自分より早いタイミングでプリロードを発行しているエントリ番号に対応するビットがセットされることになる。その後、マスターエイジレジスタの対応するビット(ビット3)がセットされる。既にエントリはプリロードを発行したためである。   As shown in FIG. 42, it is assumed that entries 0 to 2 have been issued a preload, and then entry 3 has issued a preload. Then, the value of the master age register is copied to the register that issued the preload of the age register. This means that the bit corresponding to the entry number that has issued the preload at an earlier timing for the entry is set. Thereafter, the corresponding bit (bit 3) of the master age register is set. This is because the entry has already issued a preload.

図43はスレッド発行時のエイジレジスタの様子を示す概念図である。スレッドが発行される際には、Rdyビットがセットされ且つ最も古いエントリが選択される。   FIG. 43 is a conceptual diagram showing the state of the age register when a thread is issued. When a thread is issued, the Rdy bit is set and the oldest entry is selected.

エイジレジスタの各エントリにおいては、自分より古くからプリロードされているエントリに対応した位置のビットがセットされている。従って、エイジレジスタを参照することで、いずれのエントリのデータがもっと古いのかを知ることが出来る。そして、エイジレジスタ内のビットと、各エントリのRdyビットとのANDを取る。その後、更に8ビットのリダクションORを取った結果がゼロであり、かつ自分のRdyがセットされているものが「Rdyがセットされていて最も古い」エントリとなる。すなわち、それが選択すべきエントリとなる。図43ではエントリ0がそれにあたる。最も古いのはエントリ1であるが、エントリ1はRdyビットがセットされていないため、次に古いエントリ0が選択される。エントリが選択されると、エイジレジスタ内において選択エントリに対応するビット(エントリ0)が全てクリアされて、今後は選択対象とはならない。またマスターエイジレジスタでも同様である。   In each entry of the age register, a bit at a position corresponding to an entry preloaded from the oldest is set. Therefore, by referring to the age register, it is possible to know which entry data is older. The bit in the age register is ANDed with the Rdy bit of each entry. After that, the result of further reducing the 8-bit reduction OR is zero, and the one having its own Rdy set is the “oldest with Rdy set” entry. That is, it becomes an entry to be selected. In FIG. 43, entry 0 corresponds to this. The oldest entry is entry 1, but entry 1 has the Rdy bit not set, so the next oldest entry 0 is selected. When an entry is selected, all the bits (entry 0) corresponding to the selected entry are cleared in the age register, and are no longer selected. The same applies to the master age register.

次に、スレッド発行制御部97の各ステージの動作について説明する。スレッド発行制御部97は、M個のスレッド保持部エントリのそれぞれに保持されるPLCntとRdyとから、Rdyであり且つ最も早くプリロードを発行したエントリを選択する。すなわちNORゲート146−0〜146−(M−1)のうち、発行すべきエントリに対応するものの出力がアサートされる。   Next, the operation of each stage of the thread issue control unit 97 will be described. The thread issuance control unit 97 selects the entry that is Rdy and has issued the preload earliest from the PLCnt and Rdy held in each of the M thread holding unit entries. That is, the output of the NOR gate 146-0 to 146- (M-1) corresponding to the entry to be issued is asserted.

そして、M個のエントリに対応するランセット信号のうち、選択されたエントリに対応するものがアサートされる。また、各エントリに対応するランセット信号が各エントリのアップデートロジックに入力され、これに基づいてRunビットがセットされる。ランセット信号がアサートされた場合、マスターエイジレジスタの対応するビットがクリアされる。また、Runのエンコード結果に基づき、実行スレッドエントリ番号が生成される。更に、Runビットが参照され、これに基づいていずれかのエントリが選択される。そして、選択されたエントリのデータが描画処理部36へ出力される。出力される信号は、サブパススタート信号、SpID、TdID、実行スレッドエントリ番号、PC、StN0、StN1、QV、StNum0〜StNum3、及びQNum0〜QNum3である。   Then, among the lancet signals corresponding to the M entries, the signal corresponding to the selected entry is asserted. Also, a lancet signal corresponding to each entry is input to the update logic of each entry, and the Run bit is set based on this. When the lancet signal is asserted, the corresponding bit in the master age register is cleared. An execution thread entry number is generated based on the Run encoding result. Further, the Run bit is referred to, and any entry is selected based on the Run bit. Then, the data of the selected entry is output to the drawing processing unit 36. The output signals are the subpath start signal, SpID, TdID, execution thread entry number, PC, StN0, StN1, QV, StNum0 to StNum3, and QNum0 to QNum3.

次に、スレッド保持部47の備える比較部100について説明する。図44は比較部100の回路図である。比較部100は、スレッド保持部のエントリ数と同じM個の比較回路151−0〜151−(M−1)を備えている。比較回路151−0〜151−(M−1)は、スレッド保持部の各エントリのXYタグとエントリバリッドビット、及び命令管理部の各エントリのロックビットSptLckを参照する。そして比較回路151−0〜151−(M−1)は、スレッド保持部47内のMエントリに関して同一XY座標タグを持つ組み合わせがあるかを判定する。   Next, the comparison unit 100 included in the thread holding unit 47 will be described. FIG. 44 is a circuit diagram of the comparison unit 100. The comparison unit 100 includes M comparison circuits 151-0 to 151- (M-1) that are the same as the number of entries in the thread holding unit. The comparison circuits 151-0 to 151- (M-1) refer to the XY tag and entry valid bit of each entry of the thread holding unit and the lock bit SptLck of each entry of the instruction management unit. Then, the comparison circuits 151-0 to 151- (M-1) determine whether there is a combination having the same XY coordinate tag with respect to the M entry in the thread holding unit 47.

すなわち、比較回路151−0は、スレッド保持部47内のエントリ0に保持されるXYタグが、その他のエントリ1〜(M−1)に保持されるXYタグのいずれかと等しいか否かを検出する。比較回路151−1は、エントリ1に保持されるXYタグが、その他のエントリ0、2〜(M−1)に保持されるXY座標タグのいずれかと等しいか否かを検出する。比較回路151−2は、エントリ2に保持されるXY座標タグが、その他のエントリ0、1、3〜(M−1)に保持されるXY座標タグのいずれかと等しいか否かを検出する。以下同様である。   That is, the comparison circuit 151-0 detects whether or not the XY tag held in the entry 0 in the thread holding unit 47 is equal to any of the XY tags held in the other entries 1 to (M-1). To do. The comparison circuit 151-1 detects whether the XY tag held in the entry 1 is equal to any of the XY coordinate tags held in the other entries 0, 2 to (M−1). The comparison circuit 151-2 detects whether the XY coordinate tag held in the entry 2 is equal to any of the XY coordinate tags held in the other entries 0, 1, 3 to (M-1). The same applies hereinafter.

等しいXYタグを有するエントリが存在する場合、その検出結果と、当該エントリに対応する命令管理部のエントリに保持されるロックビットSptLckとのOR演算が、同一XYロック信号として出力される。同一XYロック信号は、対応するエントリと同一XY座標を保持する他のエントリがスレッド保持部内に存在し、且つそのエントリがLockを取っていることを示す。   When entries having the same XY tag exist, an OR operation between the detection result and the lock bit SptLck held in the entry of the instruction management unit corresponding to the entry is output as the same XY lock signal. The same XY lock signal indicates that another entry that holds the same XY coordinates as the corresponding entry exists in the thread holding unit, and that the entry is locked.

図45は図44における比較回路の回路図であり、特に比較回路151−0について示している。比較回路151−0は、検出部152−0〜152−(M−2)、ANDゲート153−0〜153−(M−2)、及びORゲート154を備えている。検出部152−0〜152−(M−2)の各々は、エントリ1〜(M−1)に保持されるXYタグと、エントリ0に保持されるXYタグとを比較して同一であるか否かを検出する。ANDゲート153−0〜153−(M−2)の各々は、検出部152−0〜152−(M−2)の出力のそれぞれと、エントリ1〜(M−1)のエントリバリッドEnVのそれぞれと、命令管理部のエントリ1〜(M−1)に保持されるロックビットSptLckのそれぞれとのAND演算を行う。ORゲート154は、ANDゲート153−1〜153−(M−2)のOR演算を行う。そして、ORゲート154の出力が、エントリ0に対応した同一XYロック信号となる。   FIG. 45 is a circuit diagram of the comparison circuit in FIG. 44, and particularly shows the comparison circuit 151-0. The comparison circuit 151-0 includes detection units 152-0 to 152- (M-2), AND gates 153-0 to 153- (M-2), and an OR gate 154. Whether each of the detection units 152-0 to 152- (M-2) is the same by comparing the XY tag held in the entries 1 to (M-1) with the XY tag held in the entry 0? Detect whether or not. Each of the AND gates 153-0 to 153- (M-2) includes the outputs of the detection units 152-0 to 152- (M-2) and the entry valid EnVs of the entries 1 to (M-1), respectively. And an AND operation with each of the lock bits SptLck held in the entries 1 to (M−1) of the instruction management unit. The OR gate 154 performs an OR operation on the AND gates 153-1 to 153- (M-2). The output of the OR gate 154 becomes the same XY lock signal corresponding to the entry 0.

上記構成において、エントリ0の保持するXYタグと、他のエントリ1〜(M−1)のいずれかが保持するXYタグとが等しく、且つその他エントリのバリッドがセットされ、更にその他エントリがロックを取っていた場合、対応するANDゲート153−0〜153−(M−2)の出力が“High”となる。よって同一XYロック信号がアサートされる。   In the above configuration, the XY tag held by the entry 0 is equal to the XY tag held by any of the other entries 1 to (M-1), the valid of the other entry is set, and the other entry is locked. If it has been taken, the output of the corresponding AND gates 153-0 to 153- (M-2) becomes "High". Therefore, the same XY lock signal is asserted.

スレッド保持部47の備えるインターフェース99は、テクスチャユニット33から送信されるテクスチャロードのアクノリッジ信号をF/Fでラッチする。   The interface 99 provided in the thread holding unit 47 latches the texture load acknowledge signal transmitted from the texture unit 33 with the F / F.

次に、図7における命令管理部48について説明する。命令管理部48はレディキューテーブル(ready queue table)を備えている。レディキューテーブルは、図46に示すようなM個のエントリを備える。レディキューテーブルの各エントリはスレッド保持部47の1エントリに対応しており、それぞれTdEntNo、SpID、SpRdy、及びSptLckを保持する。TdEntNoは対応するスレッド保持部エントリ番号、SpIDは次に実行すべきサブパス番号、SpRdyはスレッドを発行して良いかどうかを示すフラグ、SptLckはロックを取っているかどうかを示すフラグである。各情報は、クアッドマージ後にスレッドを生成した順序で保持される。SpRdyは、スレッドがサブパスの単位で前のスレッドを追い越すことなく発行されるようにセットされる。   Next, the instruction management unit 48 in FIG. 7 will be described. The instruction management unit 48 includes a ready queue table. The ready queue table includes M entries as shown in FIG. Each entry in the ready queue table corresponds to one entry of the thread holding unit 47 and holds TdEntNo, SpID, SpRdy, and SptLck, respectively. TdEntNo is a corresponding thread holding unit entry number, SpID is a sub-pass number to be executed next, SpRdy is a flag indicating whether or not a thread may be issued, and SptLck is a flag indicating whether or not a lock is acquired. Each information is retained in the order in which threads are generated after quad merge. SpRdy is set so that the thread is issued without overtaking the previous thread in sub-pass units.

サブパスについて図47を用いて説明する。命令制御部35は各スレッドに対して、INSTBASEにより指定されるアドレスの命令を、エンド命令を検出するまで実行する。この実行される命令列は、図47に示すようにX個の命令列に分割出来、分割されて出来た個々の命令列がサブパス(Sub pass)である。個々のサブパスの最後にはイールド命令Yieldが配置され、最終サブパスの最後にはイールド命令の代わりにエンド命令Endが配置されている。   The sub path will be described with reference to FIG. The instruction control unit 35 executes the instruction at the address specified by INSTBASE for each thread until an end instruction is detected. The instruction sequence to be executed can be divided into X instruction sequences as shown in FIG. 47, and each instruction sequence generated by the division is a sub pass. A yield instruction Yield is arranged at the end of each sub-pass, and an end instruction End is arranged instead of the yield instruction at the end of the final sub-path.

図48は、サブパスが実行される様子を時間と共に示した概念図である。図48においてスレッド5、6、7は同一のピクセルシェーダユニットによって処理される。図示するように、スレッドに対する処理はイールド命令によって一旦休止する。そして、代わりに他のスレッドに対する命令が実行される。休止したスレッドは、後に発行可能となった際に起動される。すなわち、2つのイールド命令間で実行される命令がサブパスである。そしてサブパスの単位でスレッドが実行され、その期間の処理は連続して実行される。   FIG. 48 is a conceptual diagram showing how sub-passes are executed over time. In FIG. 48, threads 5, 6, and 7 are processed by the same pixel shader unit. As shown in the figure, the processing for the thread is temporarily suspended by the yield instruction. Instead, an instruction for another thread is executed. The suspended thread is activated when it can be issued later. That is, an instruction executed between two yield instructions is a subpath. Then, a thread is executed in units of sub-passes, and processing during that period is executed continuously.

次に実行を予定するサブパスのサブパス番号が互いに同一である複数のスレッドが存在する場合、SpRdyフラグは最も古いスレッドに対してだけセットされる。そして、SpRdyがセットされたスレッドだけが発行可能である。これにより、新しいスレッドに対する処理が、古いスレッドに対する処理を時間的に追い越してしまうことを防止する。   When there are a plurality of threads having the same sub-pass number of the sub-pass to be executed next, the SpRdy flag is set only for the oldest thread. Only threads for which SpRdy is set can be issued. This prevents the process for the new thread from overtaking the process for the old thread in time.

新規スレッドが生成された際、レディキューテーブルの空いている最初のエントリにそのスレッド保持部のエントリ番号がセットされ、SpIDがゼロにセットされ、バリッドビットEnVがセットされる。   When a new thread is created, the entry number of the thread holding unit is set to the first free entry in the ready queue table, SpID is set to zero, and the valid bit EnV is set.

スレッドが発行された際(サブパスが実行された際)、対応するエントリのSpIDがインクリメントされ、次回発行されるサブパス番号を示すようにする。スレッドがエンド命令を実行したら、バリッドビットがクリアされ、エントリはデキューされる。   When a thread is issued (when a sub-pass is executed), the SpID of the corresponding entry is incremented to indicate the sub-pass number to be issued next time. When the thread executes the end instruction, the valid bit is cleared and the entry is dequeued.

各エントリは、自分のSpIDと、自分より1つ古いエントリのSpIDとを常時比較する。そして、その古いエントリのSpIDが自分のSpIDと同一である場合は、自分のSpRdyをクリアする。図46の例であると、エントリ2とエントリ3の関係であり、エントリ3はSpRdyをクリアしている。SpIDフィールドは、自分より1つ古いエントリと同一であるか小さいかのどちらかの値しか取らない。従って、上記のような処理を行うことにより、同一SpIDのうち一番古いスレッドについてのみ、SpRdyビットがセットされることになる。各エントリのSpRdyビットは、そのTdEntNo番号の示すスレッド保持部エントリに対して選択されて出力される。   Each entry always compares its own SpID with the SpID of an entry one older than itself. Then, if the SpID of the old entry is the same as its own SpID, its own SpRdy is cleared. In the example of FIG. 46, the relationship is between entry 2 and entry 3, and entry 3 has cleared SpRdy. The SpID field takes only one value that is the same or smaller than the entry one older than itself. Therefore, by performing the above processing, the SpRdy bit is set only for the oldest thread in the same SpID. The SpRdy bit of each entry is selected and output for the thread holding unit entry indicated by the TdEntryNo number.

実行中のスレッドがロック命令を実行した場合、対応するエントリのロックビットがセットされる。またアンロック命令を実行した場合には、ロックビットはクリアされる。   When the executing thread executes the lock instruction, the lock bit of the corresponding entry is set. When the unlock instruction is executed, the lock bit is cleared.

次に、命令管理部48の回路構成について説明する。図49は命令管理部48の備えるエントリ回路159の回路である。この回路は、レディキューテーブルにおける各エントリの実体を為す回路である。   Next, the circuit configuration of the instruction management unit 48 will be described. FIG. 49 is a circuit of the entry circuit 159 provided in the instruction management unit 48. This circuit is a circuit that forms the entity of each entry in the ready queue table.

図示するようにエントリ回路159は、ANDゲート160−1〜160−8、ORゲート161−1〜161−3、NANDゲート162、比較器163−0〜163−2、加算器164、及び選択回路165−0、165−1、166−0〜166−4を備えている。   As illustrated, the entry circuit 159 includes AND gates 160-1 to 160-8, OR gates 161-1 to 161-3, a NAND gate 162, comparators 163-0 to 163-2, an adder 164, and a selection circuit. 165-0, 165-1, 166-0 to 166-4.

ORゲート161−1は、エンド命令とイールド命令とのOR演算を行う。比較器163−0は、新規スレッドエントリ番号と、自らが保持するスレッドエントリ番号TdEntNoとを比較する。比較器163−2は、自らが保持するサブパスID(SpID)と、1つ古いエントリが保持するサブパスID(旧エントリのSpID)とを比較する。NANDゲート162は、比較器163−2の出力の反転信号と、自らより1つ古いエントリが保持するバリッドビット(旧エントリのEnV)とのNAND演算を行う。ANDゲート160−8は、比較器163−2の出力と旧エントリのバリッドビットとのAND演算を行う。ANDゲート160−1は、比較器163−0の出力と信号エンド命令とのAND演算を行う。ANDゲート160−5は、ORゲート161−0の出力と、ANDゲート160−1の出力の反転信号とのAND演算を行う。ANDゲート160−2は、ORゲート161−1の出力と、比較器163−0の出力とのAND演算を行う。ANDゲート160−3は、自らより1つ古いエントリが保持するロックビット(旧エントリのSptLck)を反転させたものと、比較器163−0の出力とのAND演算を行う。ANDゲート160−4は、ロック命令と、ANDゲート160−8の出力とのAND演算を行う。ORゲート161−2は、ANDゲート161−2の出力とANDゲート160−3の出力とのOR演算を行う。ORゲート161−3は、ANDゲート160−4の出力と、自らが保持するロックビットSptLckとのOR演算を行う。ANDゲート160−6は、ORゲート161−2の出力の反転信号と、ORゲート161−3の出力とのAND演算を行う。比較器163−1は、自らが保持するスレッドエントリ番号TdEntNoと、動作開始スレッドエントリ番号とを比較する。動作開始スレッドエントリ番号は、サブパスの実行を開始したスレッドに関する。   The OR gate 161-1 performs an OR operation between the end instruction and the yield instruction. The comparator 163-0 compares the new thread entry number with the thread entry number TdEntNo held by itself. The comparator 163-2 compares the subpath ID (SpID) held by itself with the subpath ID (SpID of the old entry) held by the one old entry. The NAND gate 162 performs a NAND operation on the inverted signal of the output of the comparator 163-2 and the valid bit (EnV of the old entry) held by the entry one older than itself. The AND gate 160-8 performs an AND operation on the output of the comparator 163-2 and the valid bit of the old entry. The AND gate 160-1 performs an AND operation on the output of the comparator 163-0 and the signal end command. The AND gate 160-5 performs an AND operation on the output of the OR gate 161-0 and the inverted signal of the output of the AND gate 160-1. The AND gate 160-2 performs an AND operation on the output of the OR gate 161-1 and the output of the comparator 163-0. The AND gate 160-3 performs an AND operation on the inverted bit of the lock bit (SptLck of the old entry) held by the entry one older than itself and the output of the comparator 163-0. The AND gate 160-4 performs an AND operation on the lock command and the output of the AND gate 160-8. The OR gate 161-2 performs an OR operation on the output of the AND gate 161-2 and the output of the AND gate 160-3. The OR gate 161-3 performs an OR operation on the output of the AND gate 160-4 and the lock bit SptLck held by itself. The AND gate 160-6 performs an AND operation on the inverted signal of the output of the OR gate 161-2 and the output of the OR gate 161-3. The comparator 163-1 compares the thread entry number TdEntNo held by itself with the operation start thread entry number. The operation start thread entry number relates to the thread that has started execution of the sub-pass.

ANDゲート160−7は、信号サブパススタート信号と、比較器163−1の出力とのAND演算を行う。選択回路165−0は、ANDゲート160−0の出力に基づいて、TdEntNoとスレッドライトエントリ番号とのいずれかを選択する。加算器164は、自らが保持するサブパスID(SpID)を+1する。選択回路165−1は、ANDゲート160−7の出力に基づいて、加算器164の出力、SpID、または“0”のいずれかを選択する。   The AND gate 160-7 performs an AND operation on the signal subpath start signal and the output of the comparator 163-1. The selection circuit 165-0 selects either TdEntNo or thread write entry number based on the output of the AND gate 160-0. The adder 164 increments the sub path ID (SpID) held by itself by +1. The selection circuit 165-1 selects one of the output of the adder 164, SpID, and “0” based on the output of the AND gate 160-7.

選択回路166−0は、シフトイネーブル信号に基づいて、ANDゲート160−5の出力と、自らより1つ新しいエントリのデータ(シフト入力信号)とのいずれかを選択する。そして選択回路166−0の出力がバリッドビットとなる。選択回路166−1は、シフトイネーブル信号に基づいて、ANDゲート160−6の出力と、自らより1つ新しいエントリのシフト入力信号とのいずれかを選択する。そして選択回路166−1の出力がロックビットSptLckとなる。選択回路166−2は、シフトイネーブル信号に基づいて、選択回路165−0の出力と、自らより1つ新しいエントリのシフト入力信号とのいずれかを選択する。そして選択回路166−2の出力がTdEntNoとなる。選択回路166−3は、シフトイネーブル信号に基づいて、選択回路165−1の出力と、自らより1つ新しいエントリのシフト入力信号とのいずれかを選択する。そして選択回路166−3の出力がSpIDとなる。選択回路166−4は、シフトイネーブル信号に基づいて、NANDゲート162の出力と、自らより1つ新しいエントリのシフト入力信号とのいずれかを選択する。そして選択回路166−4の出力がSpRdyとなる。   Based on the shift enable signal, the selection circuit 166-0 selects either the output of the AND gate 160-5 or the data (shift input signal) of one entry newer than itself. The output of the selection circuit 166-0 becomes a valid bit. Based on the shift enable signal, the selection circuit 166-1 selects either the output of the AND gate 160-6 or the shift input signal of one entry newer than itself. The output of the selection circuit 166-1 becomes the lock bit SptLck. Based on the shift enable signal, the selection circuit 166-2 selects either the output of the selection circuit 165-0 or the shift input signal of one entry newer than itself. Then, the output of the selection circuit 166-2 becomes TdEntNo. The selection circuit 166-3 selects either the output of the selection circuit 165-1 or the shift input signal of one entry newer than itself based on the shift enable signal. Then, the output of the selection circuit 166-3 becomes SpID. Based on the shift enable signal, the selection circuit 166-4 selects either the output of the NAND gate 162 or the shift input signal of one entry newer than itself. Then, the output of the selection circuit 166-4 becomes SpRdy.

ANDゲート160−5、160−6の出力、選択回路165−0、165−1の出力、及びNANDゲート162の出力はシフト出力信号となる。そして、自らよりも1つ古いエントリに対応するエントリ回路にシフト入力信号として入力される。   The outputs of the AND gates 160-5 and 160-6, the outputs of the selection circuits 165-0 and 165-1, and the output of the NAND gate 162 are shift output signals. Then, it is input as a shift input signal to the entry circuit corresponding to the entry one older than itself.

なお、エンド命令、ロック命令、ロッククリア命令は、描画処理部36が送られる信号である。またサブパススタート信号はスレッド保持部47から与えられ、サブパスの実行開始を示す信号である。スレッドライトエントリ番号は、スレッド保持部47において、書き込みを行うべきエントリの番号を示す信号であり、オーバーラップ検出部45から与えられる。動作開始スレッドエントリ番号及び新規スレッドエントリ番号はスレッド保持部47のエントリ番号であり、それぞれスレッド保持部47及び描画処理部36から与えられる。   Note that the end command, the lock command, and the lock clear command are signals sent from the drawing processing unit 36. The subpath start signal is given from the thread holding unit 47 and is a signal indicating the start of execution of the subpath. The thread write entry number is a signal indicating the number of an entry to be written in the thread holding unit 47, and is given from the overlap detection unit 45. The operation start thread entry number and the new thread entry number are entry numbers of the thread holding unit 47, and are given from the thread holding unit 47 and the drawing processing unit 36, respectively.

上記構成において、OEステージでスレッドライトイネーブル信号がアサートされると、書き込みポインタが示すエントリに対して、TdEntNoとしてスレッドライトエントリ番号が書き込まれ、SpIDとしてゼロが書き込まれ、バリッドビットEnVとして“1”が書き込まれる。すなわち、選択回路165−0はスレッドライトエントリ番号を選択し、選択回路165−1は“0”を選択する。なおスレッドライトイネーブル信号はスレッド保持部47に対するデータの書き込みをイネーブルにする信号であり、スレッド生成部から与えられる。   In the above configuration, when the thread write enable signal is asserted at the OE stage, the thread write entry number is written as TdEntNo, zero is written as SpID, and “1” is set as the valid bit EnV for the entry indicated by the write pointer. Is written. That is, the selection circuit 165-0 selects the thread write entry number, and the selection circuit 165-1 selects “0”. The thread write enable signal is a signal for enabling writing of data to the thread holding unit 47, and is given from the thread generation unit.

また比較器163−2は、自らより1つ古いエントリがバリッドであり、且つそのエントリのサブパスID(旧エントリのサブパスID)と自らのサブパスIDとが等しい場合、NANDゲート162の出力が“High”となる。この場合、SpID=1に設定される。その他の場合にはNANDゲートの出力は“Low”となり、SpID=0に設定される。   Further, the comparator 163-2 determines that the output of the NAND gate 162 is “High” when the entry one older than itself is valid and the subpath ID of the entry (subpath ID of the old entry) is equal to its own subpath ID. " In this case, SpID = 1 is set. In other cases, the output of the NAND gate is “Low”, and SpID = 0 is set.

また、SpIDが旧エントリのサブパスIDと等しく、且つロック命令がアサートされると、実行中のスレッドエントリ番号と一致するエントリのロックビットSptLckがセットされる。逆に、エンド命令、ロッククリア命令がアサートされたらクリアする。また、直前のエントリのロックビットSptLckがゼロであって、SpIDが自分と同じ場合、自分のビットをクリアにする。   If SpID is equal to the sub-path ID of the old entry and the lock instruction is asserted, the lock bit SptLck of the entry that matches the thread entry number being executed is set. Conversely, when an end command or lock clear command is asserted, it is cleared. If the lock bit SptLck of the previous entry is zero and the SpID is the same as that of itself, the own bit is cleared.

サブパススタート信号がアサートされると、比較器163−1が実行スレッドエントリ番号と自分のTdEntNoとを比較する。そして両者が同一なら自分が発行されたと認識して、加算器164がSpIDをインクリメントする。SpIDがインクリメントされた後、新しいSpIDの値によってSpRdyビットの再評価が行われ、その値が更新される。   When the subpath start signal is asserted, the comparator 163-1 compares the execution thread entry number with its own TdEntNo. If both are the same, it is recognized that it has been issued, and the adder 164 increments the SpID. After the SpID is incremented, the SpRdy bit is re-evaluated with the new SpID value and the value is updated.

エンド命令が実行されると、比較器163−0が実行スレッドエントリ番号と自分のTdEntNoとを比較する。両者が一致すれば、自分のサブパスが終了したと判定され、ANDゲート160−5の出力が“Low”レベルとなって、エントリバリッドEnVはクリアされる。   When the end instruction is executed, the comparator 163-0 compares the execution thread entry number with its own TdEntNo. If the two match, it is determined that the sub-pass has ended, the output of the AND gate 160-5 becomes “Low” level, and the entry valid EnV is cleared.

次に、命令管理部の備える読み出し回路170について図50を用いて説明する。図50は読み出し回路170とエントリ回路159との接続関係を示すブロック図である。読み出し回路170は、命令管理部から、指定されたエントリ内のSpRdyビット及びロックビットSptLckを選択する。   Next, the read circuit 170 included in the instruction management unit will be described with reference to FIG. FIG. 50 is a block diagram showing a connection relationship between the read circuit 170 and the entry circuit 159. The read circuit 170 selects the SpRdy bit and the lock bit SptLck in the specified entry from the instruction management unit.

図示するように、命令管理部48は、エントリと同じ数(M個)の読み出し回路170を備えている。各エントリに対応するエントリ間では、シフト入力信号、シフト出力信号と、エントリバリッドEnV、SpIDが縦列接続されている。そして読み出し回路170は、8個のエントリ回路159からTdEntNo、SpRdyビット、及びロックビットSptLckを受け取り、スレッド保持部47において指定されるエントリに対応したエントリ回路159のSpRdyビット及びロックビットを選択する。   As illustrated, the instruction management unit 48 includes the same number (M) of read circuits 170 as entries. Between entries corresponding to each entry, a shift input signal, a shift output signal, and entry valid EnV and SpID are connected in cascade. Then, the read circuit 170 receives the TdEntNo, SpRdy bit, and lock bit SptLck from the eight entry circuits 159, and selects the SpRdy bit and lock bit of the entry circuit 159 corresponding to the entry specified in the thread holding unit 47.

図51は、各読み出し回路170の回路図である。図示するように読み出し回路170は、ANDゲート171−0〜171−(M−1)、比較器172−0〜172−(M−1)、及びORゲート173を備えている。ここで、命令管理部のエントリ0〜(M−1)に保持されるレディビットをそれぞれSpRdy0〜SpRdy(M−1)と呼び、ロックビットをSptLck0〜SptLck(M−1)、スレッドエントリ番号をTdEntNo0〜TdEntNo(M−1)と呼ぶことにする。   FIG. 51 is a circuit diagram of each readout circuit 170. As shown in the figure, the readout circuit 170 includes AND gates 171-0 to 171-(M−1), comparators 172-0 to 172-(M−1), and an OR gate 173. Here, the ready bits held in the entries 0 to (M-1) of the instruction management unit are respectively called SpRdy0 to SpRdy (M-1), the lock bits are StpLck0 to SptLck (M-1), and the thread entry number is It will be referred to as TdEntNo0 to TdEntNo (M-1).

比較器172−0〜172−7は、TdEntNo0〜TdEntNo(M−1)のそれぞれとエントリ番号EntNとを比較する。そして両者が一致した場合、“High”レベルを出力する。ANDゲート171−0〜171−(M−1)は、SpRdy0〜SpRdy(M−1)のそれぞれと、比較器172−0〜172−(M−1)の出力のそれぞれとのAND演算を行う。更に、SptLck0〜SptLck(M−1)のそれぞれと、比較器172−0〜172−(M−1)の出力のそれぞれとのAND演算を行う。ORゲート173は、ANDゲート171−0〜171−(M−1)の出力のOR演算を行う。そして、ORゲート173の出力が、選択エントリに保持されるSpRdyビット及びSptLckビットとなる。   The comparators 172-0 to 172-7 compare each of TdEnterNo0 to TdEnterNo (M-1) with the entry number EntN. If they match, a “High” level is output. AND gates 171-0 to 171- (M-1) perform an AND operation on each of SpRdy0 to SpRdy (M-1) and each of the outputs of comparators 172-0 to 172- (M-1). . Further, an AND operation is performed on each of SptLck0 to SptLck (M-1) and each of the outputs of the comparators 172-0 to 172- (M-1). The OR gate 173 performs an OR operation on the outputs of the AND gates 171-0 to 171-(M−1). Then, the output of the OR gate 173 becomes the SpRdy bit and the SptLck bit held in the selected entry.

上記読み出し回路170の動作を、例えばエントリ0からデータを読み出す場合を例に挙げて説明する。この場合、比較器172−0の出力が“High”レベルとなり、その他の比較器172−1〜172−(M−1)の出力が“Low”レベルとなる。従って、ANDゲート171−1〜171−(M−1)の出力は強制的に“Low”レベルとなる。他方、ANDゲート171−0は、エントリ0に保持されるSpRdyビット及びロックビットSptLckによって変化する。すなわち、エントリ0のSpRdyビット及びロックビットSptLckが取り出される。   The operation of the read circuit 170 will be described by taking as an example the case of reading data from entry 0, for example. In this case, the output of the comparator 172-0 becomes “High” level, and the outputs of the other comparators 172-1 to 172- (M−1) become “Low” level. Accordingly, the outputs of the AND gates 171-1 to 171-(M−1) are forcibly set to the “Low” level. On the other hand, the AND gate 171-0 changes according to the SpRdy bit and the lock bit SptLck held in the entry 0. That is, the SpRdy bit and the lock bit SptLck of entry 0 are extracted.

次に、上記構成のグラフィックプロセッサの動作について、特に命令制御部35に特に着目して説明する。図52はグラフィックプロセッサにより図形を描画する際の処理のフローチャートである。   Next, the operation of the graphic processor having the above configuration will be described with particular attention paid to the instruction control unit 35. FIG. 52 is a flowchart of processing when a graphic is drawn by the graphic processor.

図形を描画するにあたっては、まずラスタライザ24に図形情報が入力される(ステップS10)。図形情報は、例えば図形の頂点座標や色情報などである。すると、ラスタライザ24は描画すべき図形が占める位置に対応するスタンプを生成する(図6参照)。生成されたスタンプデータは、それぞれ予め対応付けられたピクセルシェーダ25−0〜25−3のデータ振り分け部30に送られる(ステップS11)
次に、各ピクセルシェーダ25−0〜25−3が受け取ったスタンプデータに基づいて描画処理を行うべく、タスクの実行管理が開始される(ステップS12)。
In drawing a graphic, graphic information is first input to the rasterizer 24 (step S10). The graphic information is, for example, the vertex coordinates or color information of the graphic. Then, the rasterizer 24 generates a stamp corresponding to the position occupied by the figure to be drawn (see FIG. 6). The generated stamp data is sent to the data distribution unit 30 of each of the pixel shaders 25-0 to 25-3 associated in advance (step S11).
Next, task execution management is started to perform drawing processing based on the stamp data received by the pixel shaders 25-0 to 25-3 (step S12).

<スタンプデータ受信>
まず、データ振り分け部30が、ピクセルシェーダユニット34の備える命令制御部35に対してスタンプデータを送付する(ステップS13)。データ振り分け部30から命令制御部35へ8クロックサイクルでスタンプデータが転送される。
<Receive stamp data>
First, the data distribution unit 30 sends stamp data to the instruction control unit 35 provided in the pixel shader unit 34 (step S13). Stamp data is transferred from the data distribution unit 30 to the instruction control unit 35 in 8 clock cycles.

データ振り分け部30から送付されるスタンプデータは図53に示すように、スタンプのピクセルバリッド、XY座標、及び第1データ乃至第3データである。図示するようにデータ振り分け部30は、1つのスタンプに関するデータを8サイクルに分割して転送する。データはMSB側から分割されて順に送られる。   As shown in FIG. 53, the stamp data sent from the data distribution unit 30 is a pixel valid of the stamp, XY coordinates, and first to third data. As shown in the figure, the data distribution unit 30 divides data related to one stamp into eight cycles and transfers the data. Data is divided from the MSB side and sent in order.

図54は、データ転送時の各種信号のタイミングチャートである。図中のスタンプデータはピクセルバリッドPV、XY座標、第1データのことである。図示するように、データはクロックCLK2に同期して命令制御部35に送付される。第2データ以外のデータは第1スタート信号に同期して、8サイクルに分割して送付される。第2データは第2スタート信号に同期して8サイクル間で送付される。第2データはそれ以外のデータより規定サイクルΔTだけ遅れて送付される。   FIG. 54 is a timing chart of various signals during data transfer. The stamp data in the figure is pixel valid PV, XY coordinates, and first data. As shown in the figure, the data is sent to the instruction control unit 35 in synchronization with the clock CLK2. Data other than the second data is divided into eight cycles and sent in synchronization with the first start signal. The second data is sent for 8 cycles in synchronization with the second start signal. The second data is sent delayed by a specified cycle ΔT from the other data.

<スタンプデータ書き込み>
次に、転送されたデータは、第1データ保持部42、第2データ保持部43、及びスタンプ保持部44に書き込まれる(ステップS14)。命令制御部35は、最大でスタンプ16個分のスタンプデータを保持できる。そしてスタンプの処理が終了した際には、そのスタンプデータを破棄する。
<Stamp data writing>
Next, the transferred data is written in the first data holding unit 42, the second data holding unit 43, and the stamp holding unit 44 (step S14). The instruction control unit 35 can hold stamp data for up to 16 stamps. When the stamp processing is completed, the stamp data is discarded.

第1データは、第1スタート信号がアサートされてから8サイクルの間、第1データ保持部42へ毎サイクル書き込まれる。第2データは、第2スタート信号がアサートされてから8サイクル間、シフトレジスタ53−5(図10参照)にラッチされ、9サイクル目にまとめて第2データ保持部43に書き込まれる。更に書き込み制御部40は、第1スタート信号がアサートされてから8サイクル間、受信したXY座標、第3データ、ピクセルバリッドに基づいて、XY座標、ピクセルバリッド、第3データ、QVを組み立てた後、それをスタンプ保持部44へ書き込む。   The first data is written to the first data holding unit 42 every cycle for 8 cycles after the first start signal is asserted. The second data is latched in the shift register 53-5 (see FIG. 10) for 8 cycles after the second start signal is asserted, and written to the second data holding unit 43 in the ninth cycle. Further, the write controller 40 assembles the XY coordinates, pixel valid, third data, and QV based on the received XY coordinates, third data, and pixel valid for 8 cycles after the first start signal is asserted. , It is written in the stamp holding unit 44.

スタンプデータの書き込みの際には、スタンプに対して割り当てたスタンプ番号StNを使用する。スタンプ番号StNは、命令制御部35が内部的に使用するスタンプの識別番号であり、0〜(N−1)が割り当てられる。データ振り分け部30からスタンプが転送されると、スタンプ番号のプールから、空いている(未使用の)番号がそのスタンプに割り当てられる。各スタンプは、処理が終了するまでそのスタンプ番号StNを使い続ける。スタンプの処理が終了すると、再びその番号は「フリー(free)」となって、スタンプ番号プールに戻される。   When writing the stamp data, the stamp number StN assigned to the stamp is used. The stamp number StN is an identification number of a stamp used internally by the instruction control unit 35, and 0 to (N-1) is assigned. When the stamp is transferred from the data distribution unit 30, an empty (unused) number is assigned to the stamp from the stamp number pool. Each stamp continues to use its stamp number StN until processing is completed. When the stamp processing is completed, the number becomes “free” again and is returned to the stamp number pool.

より具体的には、スタンプ番号StNは、スタンプ保持部44の空きエントリのうちで、最も若い数字のエントリ番号が割り当てられる。そしてスタンプ保持部44内のそのエントリにスタンプデータが書き込まれる。この様子を示しているのが図55である。図示するように、スタンプ保持部44はN個のエントリを有している。スタンプ保持部は番号の若いエントリから順に使用される。例えばエントリ0〜3までが使用中であったとする(既にデータが書き込まれている)。すると、未使用のエントリ4〜(N−1)のうちで、最も番号の若いエントリ4が使用される。使用中か否かは、各エントリのバリッドビットEnVを参照することで知ることが出来る。バリッドビットEnVは、当該エントリに保持されるスタンプの処理が終了すると、“0”にクリアされる。エントリ4に書き込まれた当該スタンプに対しては、書き込まれるエントリの番号と同じ“4”がスタンプ番号StNとして与えられる。   More specifically, the stamp number StN is assigned the smallest entry number among the empty entries in the stamp holding unit 44. Then, stamp data is written in the entry in the stamp holding unit 44. FIG. 55 shows this state. As illustrated, the stamp holding unit 44 has N entries. The stamp holding unit is used in order from the entry with the smallest number. For example, it is assumed that entries 0 to 3 are in use (data has already been written). Then, among the unused entries 4 to (N−1), the entry 4 with the smallest number is used. Whether or not it is in use can be known by referring to the valid bit EnV of each entry. The valid bit EnV is cleared to “0” when the processing of the stamp held in the entry is completed. For the stamp written in the entry 4, “4” which is the same as the number of the entry to be written is given as the stamp number StN.

図56は第2データ保持部43である。図示するように、第2データ保持部43はN個のエントリを有している。第2データ保持部43の各エントリは、下位ビットから順にピクセル0〜ピクセル(N−1)に関する第2データを保持する。第2データ保持部43は、各エントリのエントリ番号がスタンプ番号StNに一致するように、第2データを保持する。すなわち、エントリ0〜(N−1)は、それぞれStN=0〜(N−1)のスタンプの第2データを保持する。従って、図55においてエントリ4にスタンプデータが格納されたスタンプの第2データは、第2データ保持部44のエントリ4に保持される。   FIG. 56 shows the second data holding unit 43. As shown in the figure, the second data holding unit 43 has N entries. Each entry of the second data holding unit 43 holds second data relating to the pixels 0 to (N−1) in order from the lower bit. The second data holding unit 43 holds the second data so that the entry number of each entry matches the stamp number StN. That is, entries 0 to (N−1) hold second data of stamps of StN = 0 to (N−1), respectively. Therefore, the second data of the stamp whose stamp data is stored in the entry 4 in FIG. 55 is held in the entry 4 of the second data holding unit 44.

図57はメモリ54である。メモリ54はN個のエントリ0〜(N−1)を有するFIFOであり、若い番号のエントリから順に使用される。すなわち、メモリ54のエントリ番号とスタンプ番号とは一致するものではない。例えばメモリ54のエントリ0〜8が使用中であったとすると、次はエントリ9が使用される。エントリ9をStN=4のスタンプが使用すると、バリッドビットEnVが“0”から“1”にセットされ、スタンプ番号StNフィールドに“4”(0100)がセットされる。また第2データ保持部43への第2データの書き込みが終了すると、第2データレディビットRdy2が“0”から“1”にセットされる。更にStN=4のスタンプが、当該タスクに属する最初のスタンプであった場合には、同期ビットSyncが“1”にセットされる。最初でない場合は“0”である。   FIG. 57 shows the memory 54. The memory 54 is a FIFO having N entries 0 to (N−1), which are used in order from the lowest numbered entry. That is, the entry number in the memory 54 and the stamp number do not match. For example, if entries 0 to 8 in the memory 54 are in use, entry 9 is used next. When the stamp of StN = 4 is used for entry 9, the valid bit EnV is set from “0” to “1”, and “4” (0100) is set in the stamp number StN field. When the writing of the second data to the second data holding unit 43 is completed, the second data ready bit Rdy2 is set from “0” to “1”. Further, when the stamp of StN = 4 is the first stamp belonging to the task, the synchronization bit Sync is set to “1”. If it is not the first, it is “0”.

次に、データ振り分け部30から転送される複数のスタンプと、タスクとの関係について図58を用いて説明する。図58は各種信号のタイミングチャートである。データ振り分け部30は、外部からタスクの開始信号(タスク実行命令)を受けてタスクの処理を開始する。タスク実行命令がアサートされると、命令制御部35はタスク実行可能な状態になる。この状態になると、命令制御部35はピクセルシェーダユニット実行信号をアサートする。ピクセルシェーダユニット実行信号がアサートされることで、タスクが実行される。   Next, the relationship between a plurality of stamps transferred from the data distribution unit 30 and tasks will be described with reference to FIG. FIG. 58 is a timing chart of various signals. The data distribution unit 30 receives a task start signal (task execution instruction) from the outside and starts task processing. When the task execution instruction is asserted, the instruction control unit 35 enters a state in which the task can be executed. In this state, the instruction control unit 35 asserts a pixel shader unit execution signal. The task is executed by asserting the pixel shader unit execution signal.

あるタスクで処理されるスタンプは、次のようにして受信されたスタンプである。すなわち、
・タスクを実行出来る状態において受信したスタンプ、すなわちタスク実行命令がアサートされてから受信したスタンプのうち、タスク同期信号がアサートされるまでのものであり、更に
・タスクを実行出来る状態より前に受信したスタンプで、前のタスクの終了を示すタスク同期信号がアサートされた後のもの、である。
A stamp processed in a certain task is a stamp received as follows. That is,
-The stamp received in a state where the task can be executed, that is, the stamp received after the task execution instruction is asserted until the task synchronization signal is asserted, and
A stamp received before the task can be executed, after the task synchronization signal indicating the end of the previous task is asserted.

従って、データ振り分け部30からタスク同期信号のアサートを受けると、それ以降のスタンプは次のタスクのものだと判定される。この際のメモリ54の様子を図59に示す。例えばエントリ9にタスク1の最初のスタンプが保持され、エントリ12にタスク2の最初のスタンプが保持されたとする。するとエントリ9、12にスタンプが保持される際には信号NewTがアサートされるので、これらのエントリの同期ビットSyncが“1”となる。従って、エントリ9〜11がタスク1に属することが分かる。   Therefore, when the task synchronization signal is asserted from the data distribution unit 30, it is determined that the subsequent stamps belong to the next task. The state of the memory 54 at this time is shown in FIG. For example, it is assumed that the first stamp of task 1 is held in entry 9 and the first stamp of task 2 is held in entry 12. Then, when the stamps are held in the entries 9 and 12, since the signal NewT is asserted, the synchronization bit Sync of these entries becomes “1”. Therefore, it can be seen that the entries 9 to 11 belong to the task 1.

<クアッドマージ>
以上のようにしてスタンプデータが各レジスタ及びバッファへ書き込まれた後、XYタグが生成され、クアッドマージが行われる(ステップS15)。クアッドマージが行われる条件は下記の通りである。
(1)クアッドマージするスタンプは2個以下であること。
(2)2つのスタンプが時間的に連続していること
(3)2つのスタンプのXY座標が同じこと
(4)マージされるスタンプ(古い方のスタンプ)の残ったピクセルとマージする新規スタンプのピクセルバリッドに重複がないこと。
(5)2つのスタンプが同一タスクに属すること。
クアッドマージが行われなかった場合は、スタンプがそのままスレッドとなる。
<Quad merge>
After stamp data is written to each register and buffer as described above, an XY tag is generated and quad-merge is performed (step S15). The conditions for performing the quad merge are as follows.
(1) The number of stamps to be quad-merged is two or less.
(2) Two stamps are continuous in time
(3) The two stamps must have the same XY coordinates
(4) The pixel valid of the new stamp to be merged with the remaining pixels of the stamp to be merged (the older stamp) is not duplicated.
(5) Two stamps belong to the same task.
If the quad merge is not performed, the stamp becomes a thread as it is.

クアッドマージにあたって、オーバーラップ検出部45はクアッドマージ動作に必要な情報であるXY座標の同一性を検出する。またスレッド保持部47に必要な、XY座標の一致比較を簡略化するためのXY座標のハッシュ(XYタグ)を生成する。そして、内部に有するXYテーブルにXY座標値を保持させる。XYタグとは、XYテーブルのエントリ番号であり、例えば3ビットである。XYテーブルの各エントリには各スタンプのXY座標と、そのスタンプ番号StNが保持される。XYテーブルのエントリを新規に使用する際は、空いているエントリの内で最もエントリ番号の小さいエントリが選択される。スタンプ処理が終了し、そのXY座標が現在どのスレッドでも使用されていないとき、XYテーブルの対応するエントリは開放される。   In quad merge, the overlap detection unit 45 detects the identity of XY coordinates, which is information necessary for the quad merge operation. In addition, an XY coordinate hash (XY tag) for simplifying the XY coordinate matching comparison necessary for the thread holding unit 47 is generated. Then, the XY coordinate values are held in the XY table included therein. The XY tag is an entry number of the XY table, and is 3 bits, for example. Each entry in the XY table holds the XY coordinates of each stamp and its stamp number StN. When a new entry in the XY table is used, the entry with the smallest entry number is selected from the free entries. When stamping is finished and the XY coordinates are not currently used by any thread, the corresponding entry in the XY table is released.

また、オーバーラップ検出部45のスレッド保持部選択部63が、新規スレッドを生成される際に使用すべきスレッド保持部エントリを決定する。スレッド保持部選択部63は、スレッド保持部47のバリッドビットEnVを参照して空いているエントリを探し、空いている最も小さいエントリ番号を選択する。選択したエントリ番号をスレッドライトエントリ番号として出力する。このエントリが新規スレッドの書き込み先となる。また、エントリフル信号を生成する。すなわち、スレッド保持部47に空きエントリが無くなればエントリフル信号がアサートされる。   In addition, the thread holding unit selection unit 63 of the overlap detection unit 45 determines a thread holding unit entry to be used when a new thread is generated. The thread holding unit selection unit 63 refers to the valid bit EnV of the thread holding unit 47, searches for a free entry, and selects the smallest available entry number. The selected entry number is output as the thread write entry number. This entry becomes the write destination of the new thread. Also, an entry full signal is generated. That is, when there is no empty entry in the thread holding unit 47, the entry full signal is asserted.

次に、スレッド生成部46がクアッドマージを行うか否かを決定する。すなわち、スレッド生成部46は、如何にして2つのスタンプをマージするかにつき決定し、更に実際にマージ処理を行う。   Next, the thread generation unit 46 determines whether or not to perform a quad merge. That is, the thread generation unit 46 determines how to merge two stamps, and actually performs a merge process.

クアッドマージにあたって、クアッドマージで残ったスタンプデータは、次の新規スタンプがピクセルシェーダユニットに到達するまでマージバッファ84に保持される。また、2つのスタンプの全クアッドを新規スレッドに含めることが出来ない場合がある。この際、マージバッファ84に残されるクアッドは必ず新規スタンプ内のクアッドであり、古いスタンプのクアッドはスレッドとして出力される。マージバッファ84にクアッドが存在しない場合、新規スタンプの全てのクアッドはマージバッファ84に残される。この時スレッドは生成されない。クアッドマージは、出来るだけクアッド位置がオリジナルと変わらないようにして行われる。クアッドの位置にオーバーラップがある場合はマージバッファのクアッド位置は変えず、新規スタンプの位置をずらす。それでもマージできない場合はマージバッファのクアッドの方もずらす。   In the quad merge, the stamp data remaining in the quad merge is held in the merge buffer 84 until the next new stamp reaches the pixel shader unit. In addition, all quads of two stamps may not be included in a new thread. At this time, the quads remaining in the merge buffer 84 are always quads in the new stamp, and the quads of the old stamp are output as threads. If there are no quads in merge buffer 84, all quads of the new stamp are left in merge buffer 84. At this time, no thread is created. The quad merge is performed so that the quad position is not changed from the original. If there is an overlap in the quad position, the quad position of the merge buffer is not changed, and the position of the new stamp is shifted. If you still can't merge, move the quad in the merge buffer.

スレッド生成部46は、クアッドマージを行った際、マージ後のクアッドバリッドと、どのようにマージされたかの情報であるStNum0〜StNum3、QNum0〜QNum3を生成する。また、マージされる2つのスタンプのスタンプ番号StN0、StN1を出力する。StN0の方が古いスタンプである。更にスレッド生成部46は、StN1に相当するスタンプが2スレッドに分割された場合、Divideフラグをアサートする。これをスタンプ保持部44のStN1のエントリに書き込む。   When quad merge is performed, the thread generation unit 46 generates StNum0 to StNum3 and QNum0 to QNum3, which are information about the quad valid after merging and how the merge is performed. Further, the stamp numbers StN0 and StN1 of the two stamps to be merged are output. StN0 is an older stamp. Furthermore, when the stamp corresponding to StN1 is divided into two threads, the thread generation unit 46 asserts the Divide flag. This is written in the entry of StN1 of the stamp holding unit 44.

上記の処理を具体的に説明する。スレッド生成部46内のマージバッファ84に残っているスタンプと、新たに入力されたスタンプとが、例えば図60に示すようであったとする。すなわち、マージバッファ84が保持するスタンプは、クアッドQ1がインバリッドで、クアッドQ1〜Q3がバリッドであり、スタンプ番号StNは“4”である。また新規に入力されたスタンプは、クアッドQ0、Q1がバリッドで、クアッドQ2、Q3がインバリッドであり、スタンプ番号StNは“5”である。なお、StN=4のスタンプのクアッドQ1〜Q3、及びStN=5のスタンプのクアッドQ0、Q1を、それぞれクアッド1〜5と呼ぶことにする。   The above processing will be specifically described. Assume that the stamp remaining in the merge buffer 84 in the thread generation unit 46 and the newly input stamp are as shown in FIG. 60, for example. That is, in the stamp held by the merge buffer 84, the quad Q1 is invalid, the quads Q1 to Q3 are valid, and the stamp number StN is “4”. In the newly input stamp, quads Q0 and Q1 are valid, quads Q2 and Q3 are invalid, and the stamp number StN is “5”. The quads Q1 to Q3 of the stamp with StN = 4 and the quads Q0 and Q1 of the stamp with StN = 5 are referred to as quads 1 to 5, respectively.

この時、書き込み制御部40内のメモリ54の内容は図61のようであったとする。すなわち、2つのスタンプがメモリ54のエントリ9、10にそれぞれ保持されるとする。すると、エントリ9、10にそれぞれスタンプ番号“4”、“5”が保持される。また、それぞれのエントリの同期ビットSyncは“0”、“1”である。同期ビットSyncから、エントリ9、10に対応する2つのスタンプは同一タスクであることが分かる(2つのエントリの同期ビットSyncが“0”、“0”でも同様)。また、2つのスタンプのXY座標は同一であり、その座標値を“C”と仮定する。   At this time, it is assumed that the contents of the memory 54 in the write control unit 40 are as shown in FIG. That is, two stamps are held in the entries 9 and 10 of the memory 54, respectively. Then, the stamp numbers “4” and “5” are held in the entries 9 and 10, respectively. Further, the synchronization bit Sync of each entry is “0” or “1”. It can be seen from the synchronization bit Sync that the two stamps corresponding to the entries 9 and 10 are the same task (even if the synchronization bits Sync of the two entries are “0” and “0”). Further, it is assumed that the XY coordinates of the two stamps are the same, and the coordinate value is “C”.

図62は、StN=4のスタンプが入力された際における、オーバーラップ検出部45の備えるXYテーブルである。StN=4のスタンプが入力された時点で、XYテーブルのエントリ0、1、3、4、6が使用中であり、エントリ2、5、7が空いていたとする。また、使用中のエントリには、XY座標“C”は登録されていなかったとする。すると、オーバーラップ検出部45のエントリ部60−0〜60−7において、XY比較結果信号は全てゼロとなり、新たなエントリが割り当てられることになる。新たなエントリは、最もエントリ番号の小さい空きエントリであるから、ここではエントリ2が割り当てられる。すなわち、エントリ割り当て部62は、エントリ2に関するXY割り当て信号をアサートする。新たなエントリが割り当てられたことにより、XY座標テーブル選択部61は、次に使用すべきXYテーブルエントリ信号をアサートする。これにより、XYテーブルのエントリ2のバリッドビットEnVがアサートされ、XY座標値として“C”が書き込まれ、スタンプ番号StN=4が書き込まれる。また、StN=4のスタンプに対して、XYテーブルのエントリ番号と同一の番号“2”がXYタグとして与えられる。   FIG. 62 is an XY table provided in the overlap detection unit 45 when a stamp of StN = 4 is input. Assume that when the stamp of StN = 4 is input, entries 0, 1, 3, 4, and 6 in the XY table are in use and entries 2, 5, and 7 are free. Further, it is assumed that the XY coordinate “C” is not registered in the entry in use. Then, in the entry units 60-0 to 60-7 of the overlap detection unit 45, the XY comparison result signals are all zero, and a new entry is assigned. Since the new entry is an empty entry with the smallest entry number, entry 2 is assigned here. That is, the entry allocation unit 62 asserts an XY allocation signal related to the entry 2. When a new entry is assigned, the XY coordinate table selection unit 61 asserts an XY table entry signal to be used next. As a result, the valid bit EnV of entry 2 of the XY table is asserted, “C” is written as the XY coordinate value, and the stamp number StN = 4 is written. For the stamp with StN = 4, the same number “2” as the entry number in the XY table is given as the XY tag.

次にStN=5のスタンプが入力された際のXYテーブルについて図63を用いて説明する。StN=5のスタンプはStN=4のスタンプと同一XY座標を有する。従って、エントリ部60−2において、XY比較結果信号がアサートされる。また、同一XY座標であるので新たなエントリは割り当てられないから、エントリ割り当て部62はXY割り当て信号の全てをゼロとする。この結果、XYテーブルのエントリ2には新たにスタンプ番号StN=5が書き込まれる。従って、StN=5のスタンプのXYタグも、StN=4と同じ“2”である。   Next, the XY table when the stamp of StN = 5 is input will be described with reference to FIG. The stamp with StN = 5 has the same XY coordinates as the stamp with StN = 4. Accordingly, the XY comparison result signal is asserted in the entry unit 60-2. In addition, since new entries are not assigned because they are the same XY coordinates, the entry assigning unit 62 sets all the XY assignment signals to zero. As a result, stamp number StN = 5 is newly written in entry 2 of the XY table. Therefore, the XY tag of the stamp with StN = 5 is also “2”, which is the same as StN = 4.

次に、オーバーラップ検出部45のXYテーブル選択部61が、新規スレッドを生成される際に使用すべきスレッド保持部エントリを決定する。例えばスレッド保持部47は、エントリ0〜3が使用中で、エントリ4〜(N−1)が未使用であったとする。すると、XYテーブル選択部61の優先度エンコーダ73が各エントリのバリッドビットEnVを参照し、最も番号の若い空きエントリ4を選択し、スレッドライトエントリ番号=“4”を出力する。また、スレッド保持部47のエントリにはまだ空きがあるので、XYテーブル選択部61の比較器81はスレッドフル信号をアサートしない。   Next, the XY table selection unit 61 of the overlap detection unit 45 determines a thread holding unit entry to be used when a new thread is generated. For example, the thread holding unit 47 assumes that entries 0 to 3 are in use and entries 4 to (N−1) are unused. Then, the priority encoder 73 of the XY table selection unit 61 refers to the valid bit EnV of each entry, selects the empty entry 4 with the smallest number, and outputs the thread write entry number = “4”. Further, since there is still an empty entry in the thread holding unit 47, the comparator 81 of the XY table selection unit 61 does not assert the thread full signal.

そして、スレッド生成部46がクアッドマージを決定する。スレッド生成部46は、マージバッファ内のスタンプデータと新規スタンプデータとの関係から、マージ後のスタンプをどのように構成するかについての情報をテーブル(真理値表)として保持する。そのテーブルの一部を図64に示す。図中における各数字0〜3はバリッドなクアッドQ0〜Q3を示しており、横棒(−)はその他のクアッドがインバリッドであることを示す。また、マージ前の欄における“MgBuf”は、クアッドマージを行う前のマージバッファ内のスタンプデータを示し、“NewSt”はクアッドマージを行う前の新規入力スタンプデータを示す。マージ後の欄における「残り」は、クアッドマージ後にマージバッファに残されるスタンプデータを示し。“MgBuf”及び“NewSt”は新規スレッドに含まれるスタンプデータを示す。例えばMgBuf=(0‐‐‐‐)、NewSt=(0123)の場合は次のような意味である。マージバッファ内のスタンプはクアッドQ0のみがバリッドであり、新規入力スタンプはクアッドQ0〜Q3の全てがバリッドである。そしてマージした結果発生されるスレッドのクアッドQ0はマージバッファ内スタンプのクアッドQ0であり、クアッドQ1〜Q3はそれぞれ新規入力スタンプのクアッドQ1〜Q3として形成される。そして新規入力スタンプのクアッドQ0がマージバッファに残される。   Then, the thread generation unit 46 determines quad merge. The thread generation unit 46 holds, as a table (truth table), information on how to configure the merged stamp from the relationship between the stamp data in the merge buffer and the new stamp data. A part of the table is shown in FIG. Numbers 0 to 3 in the figure indicate valid quads Q0 to Q3, and horizontal bars (-) indicate that other quads are invalid. Further, “MgBuf” in the column before merging indicates stamp data in the merge buffer before performing the quad merge, and “NewSt” indicates new input stamp data before performing the quad merge. “Remaining” in the column after merging indicates stamp data remaining in the merge buffer after quad merging. “MgBuf” and “NewSt” indicate stamp data included in the new thread. For example, when MgBuf = (0 −−−−) and NewSt = (0123), the following meanings are obtained. For the stamp in the merge buffer, only the quad Q0 is valid, and for the new input stamp, all of the quads Q0 to Q3 are valid. The quad Q0 of the thread generated as a result of merging is quad Q0 of the stamp in the merge buffer, and quads Q1 to Q3 are formed as quads Q1 to Q3 of new input stamps, respectively. Then, the new input stamp quad Q0 is left in the merge buffer.

図60の場合には、スレッド生成部46、マージバッファ内のスタンプのクアッドバリッドQV及び新規スタンプのクアッドバリッドQVと、真理値表とから図65に示すようにクアッドマージを行うように決定する。すなわち、新規スレッドのクアッドQ0〜Q3が、それぞれStN=5のスタンプのクアッド4及びStN=4のスタンプのクアッド1〜3となるようにマージを行う。そして、位置がクアッド1と同じクアッド5をマージバッファ84に残す。この情報は、第1乃至第3スレッド情報として発生される。   In the case of FIG. 60, it is determined to perform quad merge as shown in FIG. 65 from the thread generation unit 46, the quad valid QV of the stamp in the merge buffer, the quad valid QV of the new stamp, and the truth table. That is, the merge is performed so that the quads Q0 to Q3 of the new thread become the quad 4 of the stamp with StN = 5 and the quads 1 to 3 of the stamp with StN = 4, respectively. Then, the quad 5 whose position is the same as the quad 1 is left in the merge buffer 84. This information is generated as first to third thread information.

そしてスレッド生成部46は、第1乃至第3スレッド情報に基づいてクアッドマージを実行する。そして、StNum0〜StNum3、QNum0〜QNum3、新規スレッドのクアッドバリッドQVを生成する。また、マージされる2つのスタンプのスタンプ番号StN0、StN1、XYタグが、スレッド生成部46からスレッド保持部47へ出力される。そして、これらの情報がスレッド保持部47のエントリ4に書き込まれる。エントリ4は、オーバーラップ検出部45のスレッド保持部選択部63によって選択されたエントリである。この時のスレッド保持部47の様子を図66に示す。   Then, the thread generation unit 46 performs quad merge based on the first to third thread information. Then, StNum0 to StNum3, QNum0 to QNum3, and quad valid QV of a new thread are generated. Further, the stamp numbers StN0, StN1, and XY tags of the two stamps to be merged are output from the thread generation unit 46 to the thread holding unit 47. These pieces of information are written in entry 4 of the thread holding unit 47. The entry 4 is an entry selected by the thread holding unit selection unit 63 of the overlap detection unit 45. The state of the thread holding unit 47 at this time is shown in FIG.

図示するように、XYテーブル選択部61により選択されたエントリ4のバリッドビットEnVがセットされる。更にエントリ4には、XYタグ、StN0、StN1として、それぞれ“2”、“4”、“5”がセットされる。StN0、StN1はそれぞれマージバッファ内のスタンプ及び新規入力スタンプのスタンプ番号である。また、新規スレッドのクアッドバリッドQVがエントリ4に書き込まれる。新規スレッドのクアッドバリッドQVは4ビットの信号で、それぞれのビットがスレッドのクアッドQ0〜Q3に対応する。従って、図65の場合にはスレッドの全てのクアッドがバリッドであるので、QVとして“1111”がセットされる。また新規スレッドは、クアッドQ0だけが新規入力スタンプのクアッドであるので、StNum0〜StNum3はそれぞれ“1”、“0”、“0”、“0”である。更に新規スレッド内の各クアッドの位置は、クアッドマージ前と同じであるので、QNum0〜QNum3はそれぞれ“00”、“01”、“10”、“11”である。   As shown in the figure, the valid bit EnV of the entry 4 selected by the XY table selection unit 61 is set. Furthermore, “2”, “4”, and “5” are set in the entry 4 as the XY tag, StN0, and StN1, respectively. StN0 and StN1 are stamp numbers of the stamp in the merge buffer and the new input stamp, respectively. Also, the quad valid QV of the new thread is written in entry 4. The quad valid QV of the new thread is a 4-bit signal, and each bit corresponds to the quads Q0 to Q3 of the thread. Therefore, in the case of FIG. 65, since all quads of the thread are valid, “1111” is set as the QV. Further, since only the quad Q0 is a quad of a new input stamp, StNum0 to StNum3 are “1”, “0”, “0”, and “0”, respectively. Furthermore, since the position of each quad in the new thread is the same as before the quad merge, QNum0 to QNum3 are “00”, “01”, “10”, and “11”, respectively.

またスレッド生成部46のディバイドビット発生器87は、クアッドマージの情報に基づいて、新規入力スタンプ(StN=5のスタンプ)の少なくとも一部がマージバッファに残されるか否かを検出する。本例であると、新規入力スタンプのクアッド5がマージバッファに残される。従って、ディバイドビットDivideが“1”にセットされる。ディバイドビットDivideは、スタンプ保持部44においてStN=5のスタンプが保持されるエントリ4に書き込まれる。   The divide bit generator 87 of the thread generation unit 46 detects whether or not at least a part of the new input stamp (StN = 5 stamp) is left in the merge buffer based on the quad merge information. In this example, the quad 5 of the new input stamp is left in the merge buffer. Therefore, the divide bit Divide is set to “1”. The divide bit Divide is written in the entry 4 in which the stamp holding unit 44 holds the stamp of StN = 5.

<実行スレッド、サブパスの実行管理>
以上のようにしてクアッドマージが終了すると、次に実行スレッド及びサブパスの実行管理を行う(ステップS16)。画像描画処理はスレッド単位で行われ、命令制御部35はスレッドの起動、停止を管理する。また、各スレッドはサブパスという実行単位に分割されて実行される。サブパスの実行終了時には、スレッドの動作を停止し、別の実行可能なスレッドを起動することによって、タイムシェアリングにより複数のスレッドを切り替えながら実行することが出来る。またロック/ロッククリア命令によるサブパスの実行可否を判定して、実行可能なスレッドだけを起動する。
<Execution thread and subpath execution management>
When quad merging is completed as described above, execution management of execution threads and sub-paths is performed (step S16). The image drawing process is performed in units of threads, and the instruction control unit 35 manages the start and stop of threads. Each thread is divided into execution units called sub-passes and executed. At the end of execution of the sub-pass, by stopping the operation of the thread and starting another executable thread, it is possible to execute while switching a plurality of threads by time sharing. Further, it is determined whether or not the sub-pass can be executed by the lock / lock clear instruction, and only the executable thread is activated.

命令制御部35は、次のようにしてスレッド及びサブパスを管理する。すなわち、各ピクセルシェーダユニット34では最大で1つのスレッドについて処理出来る。命令制御部35は、スレッドの処理のためにスレッドを発行する。スレッドが全く発行されていなければ、スレッド保持部47から発行可能ないずれかのスレッドが1つ選択される。イールド命令を実行した際には、そのスレッドの処理は停止され、その時点で発行可能な他のスレッドが起動される。エンド命令が実行され、且つ未取得のテクスチャロード命令が無いことが確認された場合、スレッド保持部47のエントリのバリッドビットEnVがクリアされ、スレッドはデキューされる。発行可能なスレッドがスレッド保持部47に複数ある場合には、古いスレッドから順に発行される。   The instruction control unit 35 manages threads and subpaths as follows. That is, each pixel shader unit 34 can process a maximum of one thread. The instruction control unit 35 issues a thread for processing the thread. If no thread is issued, one thread that can be issued is selected from the thread holding unit 47. When the yield instruction is executed, the processing of the thread is stopped and another thread that can be issued at that time is started. When it is confirmed that the end instruction is executed and there is no unacquired texture load instruction, the valid bit EnV of the entry of the thread holding unit 47 is cleared, and the thread is dequeued. When there are a plurality of threads that can be issued in the thread holding unit 47, the threads are issued in order from the oldest thread.

スレッドは以下のようにして起動される。スレッドは、他のスレッドが実行されておらず、データキャッシュのプリロード要求が発行済みであり、テクスチャデータのロードが終了しており、同一XY座標の他スレッドがロックを取っておらず、且つ実行していないスレッドの中で、自分が最もスレッドIDが小さい場合に発行される。実行可能なスレッドが複数存在した場合は、最も早い時期にプリロード要求を発行したスレッドが発行される。プリロードとは、タスクを実行するために必要なデータを、ローカルメモリ26から読み出し、描画処理部36に転送することである。そして、起動されたスレッドのランビットがセットされる。   A thread is started as follows: The thread is not executed by another thread, the data cache preload request has been issued, the texture data has been loaded, and another thread with the same XY coordinates has not locked and executed. This is issued when the thread ID is the smallest among the threads that have not been used. If there are multiple executable threads, the thread that issued the preload request at the earliest time is issued. Preloading refers to reading data necessary for executing a task from the local memory 26 and transferring the data to the drawing processing unit 36. Then, the run bit of the activated thread is set.

スレッドが起動されると、描画処理部36でそのスレッドについてのタスクが実行される。スレッドについてタスクが実行されている間、命令制御部35はそのスレッドのステートを管理する。すなわち、ロック命令が実行された際には、スレッド保持部47のロックビットLckをセットする。またロッククリア命令が実行された際には、スレッド保持部47のロックビットLckをクリアする。テクスチャロード命令群を実行した際には、未取得のテクスチャロード命令数を+1する。   When a thread is activated, the drawing processing unit 36 executes a task for the thread. While a task is being executed for a thread, the instruction control unit 35 manages the state of the thread. That is, when the lock instruction is executed, the lock bit Lck of the thread holding unit 47 is set. When the lock clear command is executed, the lock bit Lck of the thread holding unit 47 is cleared. When a texture load instruction group is executed, the number of unacquired texture load instructions is incremented by one.

スレッドついてイールド命令が実行された際には、命令制御部35はイールド命令の、次の命令のプログラムカウンタをスレッド保持部47に保存する。そして停止したスレッドのサブパス番号を+1する。更に停止したスレッドのプリロード要求ステートを「未要求」とし、PRELDTIMEを内部カウンタにセットする。そして停止したスレッドのランビットRunをクリアする。   When a yield instruction is executed for a thread, the instruction control unit 35 stores the program counter of the next instruction of the yield instruction in the thread holding unit 47. Then, the subpath number of the stopped thread is incremented by one. Further, the preload request state of the stopped thread is set to “unrequested”, and PRELDTIME is set in the internal counter. Then, the ranbit Run of the stopped thread is cleared.

エンド命令が実行されると、命令制御部35はスレッドの停止処理を行う。更に次の処理を行う。エンド命令が実行されると、スレッド保持部47のEndビットをセットしてスレッドが終了したことを記録する。また実行していた(最大2つの)スタンプに対するスタンプ保持部のディバイドビットDivideを参照し、“1”であれば“0”にセットし、“0”ならそのスタンプの処理は終了したと認識してスタンプ保持部からデキューすると共に、外部に対してスタンプを1つ処理したことを示す信号AckEmptyをアサートする。なお、同時に2つのスタンプが終了することがあるので、その場合は2回アサートする。Endビットがセットされており、且つ未取得のテクスチャロード命令が無いとき、スレッド保持部47の当該エントリを無効にする。   When the end instruction is executed, the instruction control unit 35 performs a thread stop process. Further, the following processing is performed. When the end instruction is executed, the End bit of the thread holding unit 47 is set to record the end of the thread. Also, referring to the divide bit Divide of the stamp holding unit for the stamps that have been executed (maximum of two), if it is “1”, it is set to “0”, and if it is “0”, it is recognized that the processing of the stamp has been completed. The signal AckEmpty indicating that one stamp has been processed is asserted to the outside. Since two stamps may end simultaneously, in that case, assert twice. When the End bit is set and there is no unacquired texture load instruction, the entry in the thread holding unit 47 is invalidated.

また命令制御部35は、ロックの制御を行う。実行可能なスレッドの中には同一XY座標のスタンプの処理を行っているものがある。そこで命令制御部35は、ロック/ロッククリア命令に対応して、同一XYを有するスレッドの排他制御を行う。すなわち、ロックを取っているスレッドと同一XY座標を有するその他のスレッドは発行できなくなる。なお異なるXY座標のスレッド間ではロックは機能しない。   The instruction control unit 35 controls the lock. Some executable threads are processing stamps with the same XY coordinates. Therefore, the instruction control unit 35 performs exclusive control of threads having the same XY in response to the lock / lock clear instruction. In other words, other threads having the same XY coordinates as the thread that is locking cannot be issued. Note that the lock does not function between threads with different XY coordinates.

更に命令制御部35は、プリロード命令の発行タイミングを制御する。スレッドがサブパスの実行を終了すると、そのスレッドは「休止状態」となる。休止してから指定された時間が経過すると、命令制御部35はそのスレッドに対するデータ領域のプリフェッチをデータキャッシュに対して要求することが出来る。更にプリフェッチを要求した順番を内部に保持し、その順序が早いものについて、プリロード要求を優先的に起動する。但し、あるタスクに属する最初のスレッドの場合には、スレッドが発行された後、即座にプリロード命令を発行する。   Further, the instruction control unit 35 controls the issue timing of the preload instruction. When the thread finishes executing the sub-pass, the thread is in a “sleep state”. When the specified time has elapsed since the suspension, the instruction control unit 35 can request the data cache to prefetch the data area for the thread. Further, the order in which the prefetch is requested is held inside, and the preload request is preferentially activated for the earlier order. However, in the case of the first thread belonging to a certain task, a preload instruction is issued immediately after the thread is issued.

以上の命令制御部35の処理について、命令管理部48とスレッド保持部47とに着目して、以下具体的に説明する。図67のように、3つのスレッド1〜3が処理される場合を仮定する。各スレッド1〜3のスレッドIDはそれぞれTdId=1〜3である。そしてスレッド2、3が同一XY座標である。   The above-described processing of the instruction control unit 35 will be specifically described below with attention paid to the instruction management unit 48 and the thread holding unit 47. Assume that three threads 1 to 3 are processed as shown in FIG. The thread IDs of the threads 1 to 3 are TdId = 1 to 3, respectively. The threads 2 and 3 have the same XY coordinates.

スレッド3についてサブパス3が発行される直前のスレッド保持部47を図68に示す。図示するように、スレッド保持部47のエントリ0〜3に、各スレッド1〜3が登録されている。この時点で、スレッド1〜3のサブパスIDはそれぞれ3、3、4である。またスレッド2について、プリロードステートが“10(PLDON)”で、テクスチャロードカウンタTlCがゼロであるので、レディビットRdyが“1”にセットされている。その他のスレッド0、1は、スレッド発行可能な状態にない。   FIG. 68 shows the thread holding unit 47 immediately before the subpass 3 is issued for the thread 3. As illustrated, the threads 1 to 3 are registered in entries 0 to 3 of the thread holding unit 47. At this time, the subpath IDs of the threads 1 to 3 are 3, 3, and 4, respectively. For thread 2, since the preload state is “10 (PLDON)” and the texture load counter TLC is zero, the ready bit Rdy is set to “1”. The other threads 0 and 1 are not in a state where threads can be issued.

この時点での命令管理部の備えるレディキューテーブルを図69に示す。命令管理部48では、エントリ0〜2にそれぞれスレッドエントリ番号0〜2が保持されている。その他のエントリ3〜(M−1)は未使用である。従って書き込みポインタWrPtrはエントリ3を指している。またエントリ1、2に対応するスレッド2、3は同一XY座標であり、且つサブパスIDが同一である。従って、エントリ2の(スレッド3の)SpRdyビットはゼロであり、サブパスの発行が禁止されている。   FIG. 69 shows a ready queue table included in the instruction management unit at this time. In the instruction management unit 48, thread entry numbers 0 to 2 are held in the entries 0 to 2, respectively. Other entries 3 to (M-1) are unused. Therefore, the write pointer WrPtr points to the entry 3. The threads 2 and 3 corresponding to the entries 1 and 2 have the same XY coordinates and the same subpath ID. Therefore, the SpRdy bit of entry 2 (of thread 3) is zero, and issuance of subpaths is prohibited.

従って、スレッド2が最初に発行されて、サブパス3が実行される。スレッド2についてサブパス3が実行されている間のスレッド保持部47を図70に示す。図示するように、この期間にスレッド1のプリロードステートは“10”に遷移する。すなわち、プリロードの発行を終了させる。また、テクスチャロードが完了して、テクスチャロードカウンタがゼロになる。従って、レディビットRdyが“1”にセットされる。スレッド2に関しては、サブパス3をスタートさせると共に、ランビットRunが“1”にセットされ、プリロードステートが“11(PLRUN)”に遷移し、テクスチャロードカウンタTlCがカウントアップを始める。サブパス3が終了してイールド命令を実行すると、スレッド2に関してレディビットRdyがゼロになり、ランビットRunもゼロになる。またサブパスIDが+1されて4になり、プログラムカウンタも+1される。プリロードステートPLは“00(PLWAT)”に遷移する。また、サブパス3の実行中にロック命令が実行され、ロックビットLckが“1”にセットされたとする。   Therefore, thread 2 is issued first and subpass 3 is executed. FIG. 70 shows the thread holding unit 47 while the subpass 3 is being executed for the thread 2. As shown in the figure, the preload state of the thread 1 transits to “10” during this period. That is, the preload issue is terminated. Also, the texture load is completed and the texture load counter becomes zero. Therefore, the ready bit Rdy is set to “1”. For the thread 2, the sub-pass 3 is started, the run bit Run is set to “1”, the preload state is changed to “11 (PLRUN)”, and the texture load counter TLC starts counting up. When subpass 3 ends and the yield instruction is executed, ready bit Rdy is zero for thread 2 and run bit Run is also zero. Also, the subpath ID is incremented by 1 to 4, and the program counter is incremented by 1. The preload state PL transits to “00 (PLWAT)”. Further, it is assumed that a lock instruction is executed during the execution of the subpass 3 and the lock bit Lck is set to “1”.

イールド命令が実行された後の命令管理部の様子を図71に示す。図示するように、エントリ1のサブパスIDが3から4にセットされ、ロックビットSptLckも“1”にセットされる。また、スレッド1の処理がスレッド2よりも進んでいるため、エントリ2のSpRdyビットが“0”から“1”に変化する。また、スレッド2とスレッド1のサブパスIDが同一であるので、スレッド2(エントリ1)のSpRdyビットが“1”から“0”に変化する。   The state of the instruction management unit after the yield instruction is executed is shown in FIG. As shown in the figure, the subpath ID of entry 1 is set from 3 to 4, and the lock bit SptLck is also set to “1”. Further, since the process of thread 1 is more advanced than that of thread 2, the SpRdy bit of entry 2 changes from “0” to “1”. Further, since the sub path IDs of the thread 2 and the thread 1 are the same, the SpRdy bit of the thread 2 (entry 1) changes from “1” to “0”.

スレッド2に関するサブパス3の実行が完了すると、次にスレッド1が発行される。これは図70に示すように、エントリ0のレディビットRdyが“1”であり、エントリ2のレディビットRdyが“0”であるから、更にスレッド2がロックを取っているためスレッド3が発行不可とされているからである。   When the execution of the subpass 3 related to the thread 2 is completed, the thread 1 is issued next. As shown in FIG. 70, the ready bit Rdy of the entry 0 is “1” and the ready bit Rdy of the entry 2 is “0”. This is because it is impossible.

従って、スレッド1が最初に発行されて、サブパス4が実行される。スレッド1についてサブパス4が実行されている間のスレッド保持部47を図72に示す。図示するように、この期間にスレッド2のプリロードステートは“00”→“01”→“10”に遷移する。すなわち、プリロードの発行を終了させる。また、テクスチャロードが完了して、テクスチャロードカウンタがゼロになる。従って、レディビットRdyが“1”にセットされる。スレッド2に関しては、サブパス4をスタートさせると共に、ランビットRunが“1”にセットされ、プリロードステートが“11”に遷移し、テクスチャロードカウンタTlCがカウントアップを始める。サブパス4が終了してイールド命令が実行されると、スレッド2関してレディビットRdyがゼロになり、ランビットRunもゼロになり、プリロードステートPLは“00(PLWAT)”に遷移する。またサブパスIDが+1されて5になり、プログラムカウンタも+1される。   Therefore, thread 1 is issued first and subpass 4 is executed. FIG. 72 shows the thread holding unit 47 while the subpass 4 is being executed for the thread 1. As shown in the figure, the preload state of the thread 2 transits from “00” → “01” → “10” during this period. That is, the preload issue is terminated. Also, the texture load is completed and the texture load counter becomes zero. Therefore, the ready bit Rdy is set to “1”. For the thread 2, the sub-pass 4 is started, the run bit Run is set to “1”, the preload state is changed to “11”, and the texture load counter TLC starts counting up. When the sub-pass 4 ends and the yield instruction is executed, the ready bit Rdy becomes zero, the run bit Run becomes zero, and the preload state PL transitions to “00 (PLWAT)”. Also, the subpath ID is incremented by 1 to 5, and the program counter is incremented by 1.

イールド命令が実行された後の命令管理部の様子を図73に示す。図示するように、エントリ0のサブパスIDが4から5にセットされる。   The state of the instruction management unit after the yield instruction is executed is shown in FIG. As shown in the figure, the subpath ID of entry 0 is set from 4 to 5.

スレッド1に関するサブパス4の実行が完了すると、次にスレッド2が発行される。これは図72に示すように、エントリ1のレディビットRdyが“1”であり、エントリ2のレディビットRdyが“0”であるからである。これは、エントリ2のスレッド3がエントリ1と同一XY座標であり、エントリ1がロックをとっているからである。   When the execution of the subpass 4 related to the thread 1 is completed, the thread 2 is issued next. This is because the ready bit Rdy of the entry 1 is “1” and the ready bit Rdy of the entry 2 is “0” as shown in FIG. This is because the thread 3 of the entry 2 has the same XY coordinates as the entry 1 and the entry 1 is locked.

従って、スレッド2が発行されて、サブパス4が実行される。スレッド2についてサブパス4が実行されている間のスレッド保持部47を図74に示す。図示するように、この期間にスレッド3のプリロードステートは“10”に遷移する。また、テクスチャロードが完了して、テクスチャロードカウンタがゼロになる。従って、レディビットRdyが“1”にセットされる。スレッド2に関しては、サブパス4をスタートさせると共に、ランビットRunが“1”にセットされ、プリロードステートが“11”に遷移し、テクスチャロードカウンタTlCがカウントアップを始める。サブパス4が終了してイールド命令が実行されると、スレッド2に関してレディビットRdyがゼロになり、ランビットRunもゼロになる。またサブパスIDが+1されて5になり、プログラムカウンタも+1される。プリロードステートPLは“00(PLWAT)”に遷移する。またサブパス4の実行中にアンロック命令がアサートされて、エントリ1のロックビットLckがゼロにセットされる。   Therefore, thread 2 is issued and subpass 4 is executed. FIG. 74 shows the thread holding unit 47 while the subpass 4 is being executed for the thread 2. As shown in the figure, the preload state of the thread 3 changes to “10” during this period. Also, the texture load is completed and the texture load counter becomes zero. Therefore, the ready bit Rdy is set to “1”. For the thread 2, the sub-pass 4 is started, the run bit Run is set to “1”, the preload state is changed to “11”, and the texture load counter TLC starts counting up. When subpass 4 ends and the yield instruction is executed, ready bit Rdy is zero for thread 2 and run bit Run is also zero. Also, the subpath ID is incremented by 1 to 5, and the program counter is incremented by 1. The preload state PL transits to “00 (PLWAT)”. Further, the unlock instruction is asserted during the execution of the sub-pass 4, and the lock bit Lck of the entry 1 is set to zero.

イールド命令が実行された後の命令管理部の様子を図75に示す。図示するように、エントリ1のサブパスIDが4から5にセットされ、ロックビットSptLockがゼロにセットされる。   FIG. 75 shows the state of the instruction management unit after the yield instruction is executed. As shown, the subpath ID of entry 1 is set from 4 to 5, and the lock bit SptLock is set to zero.

スレッド2に関するサブパス4の実行が完了すると、次にスレッド3が発行される。これは図74に示すように、エントリ3のレディビットRdyが“1”であり、エントリ0のレディビットRdyが“0”であるからである。更に、エントリ2がアンロック命令を実行したためにロックビットLckが“0”となり、それと同一XY座標のエントリ3のSpRdyが“1”であるためである。   When the execution of the subpass 4 related to the thread 2 is completed, the thread 3 is issued next. This is because the ready bit Rdy of entry 3 is “1” and the ready bit Rdy of entry 0 is “0” as shown in FIG. Furthermore, because entry 2 has executed the unlock instruction, the lock bit Lck becomes “0”, and the SpRdy of entry 3 with the same XY coordinates is “1”.

従って、スレッド3が発行されて、サブパス3が実行される。スレッド3についてサブパス3が実行されている間のスレッド保持部47を図76に示す。スレッド2に関しては、ランビットRunが“1”にセットされ、プリロードステートが“11”に遷移し、テクスチャロードカウンタTlCがカウントアップを始める。サブパス3が終了してイールド命令が実行されると、スレッド3に関してレディビットRdyがゼロになり、ランビットRunもゼロになる。またサブパスIDが+1されて4になり、プログラムカウンタも+1される。プリロードステートPLは“00(PLWAT)”に遷移する。またサブパス3の実行中にロック命令がアサートされて、エントリ2のロックビットLckが“1”にセットされる。   Therefore, the thread 3 is issued and the subpass 3 is executed. FIG. 76 shows the thread holding unit 47 while the subpass 3 is being executed for the thread 3. For thread 2, the run bit Run is set to “1”, the preload state transitions to “11”, and the texture load counter TLC starts counting up. When subpass 3 ends and the yield instruction is executed, ready bit Rdy is zero and thread bit Run is zero for thread 3. Also, the subpath ID is incremented by 1 to 4, and the program counter is incremented by 1. The preload state PL transits to “00 (PLWAT)”. Further, the lock instruction is asserted during the execution of the sub-pass 3, and the lock bit Lck of the entry 2 is set to “1”.

イールド命令が実行された後の命令管理部の様子を図77に示す。図示するように、エントリ2のサブパスIDが3から4にセットされ、ロックビットSptLockが“1”にセットされる。   FIG. 77 shows the state of the instruction management unit after the yield instruction is executed. As shown in the figure, the sub-path ID of entry 2 is set from 3 to 4, and the lock bit SptLock is set to “1”.

以下上記処理を全てのスレッドがエンド命令を実行するまで継続する。エンド命令が実行され、且つテクスチャロードが完了すると、スレッド保持部47の当該エントリは空きエントリとされる。   Thereafter, the above processing is continued until all threads execute the end instruction. When the end instruction is executed and the texture loading is completed, the entry in the thread holding unit 47 is an empty entry.

以上の処理に従って、描画処理部36が描画処理を行い、また必要に応じてテクスチャマッピングを行う(ステップS17)。テクスチャの読み出しに関して以下説明する。描画処理部36においてテクスチャロード命令Tldが発行されると、テクスチャユニット33に対してテクスチャ取得の要求がなされる。この際命令制御部35は、対応するスレッドのスレッドIDをテクスチャユニット33に送付する。テクスチャユニット33はその処理を終えると、取得したテクスチャデータをテクスチャレジスタに書き込むので、描画処理部36はそのレジスタからテクスチャデータを取得出来る。但し取得できるタイミングは、テクスチャロード命令を発行した次のサブパスである。   In accordance with the above processing, the drawing processing unit 36 performs drawing processing, and performs texture mapping as necessary (step S17). The texture reading will be described below. When the texture loading instruction Tld is issued in the drawing processing unit 36, a texture acquisition request is made to the texture unit 33. At this time, the instruction control unit 35 sends the thread ID of the corresponding thread to the texture unit 33. When the texture unit 33 finishes the process, it writes the acquired texture data into the texture register, so that the drawing processing unit 36 can acquire the texture data from the register. However, the timing that can be acquired is the next sub-pass that issued the texture load instruction.

テクスチャユニット33はテクスチャロード命令を受け取ると、パイプラインでテクスチャの取得を行う。テクスチャロード命令の処理がパイプラインの最後まで到達すると処理が終了し、テクスチャレジスタにデータが格納される。その後、テクスチャユニット33は命令制御部35に対してアクノリッジ信号を返す。テクスチャロード命令の個数はテクスチャユニット33のパイプラインに依存し、例えば最大で63個である。   When the texture unit 33 receives the texture load instruction, the texture unit 33 acquires the texture in the pipeline. When the processing of the texture load instruction reaches the end of the pipeline, the processing ends and data is stored in the texture register. Thereafter, the texture unit 33 returns an acknowledge signal to the instruction control unit 35. The number of texture load instructions depends on the pipeline of the texture unit 33, and is 63 at the maximum, for example.

命令制御部35は、テクスチャロード命令が発行されたとき、その発行数をカウントする。そしてテクスチャロード命令を終了するたびにカウント数をカウントダウンする。すなわちテクスチャユニット33からアクノリッジ信号が返ってくるたびカウントダウンする。全てのテクスチャロード命令の処理を終了した(カウント数=0)後に、同一スレッドの次のサブパスの実行が許可される。   When the texture load command is issued, the command control unit 35 counts the number of issues. Each time the texture load instruction is completed, the count is counted down. That is, the countdown is performed every time an acknowledge signal is returned from the texture unit 33. After all texture load instructions have been processed (count = 0), execution of the next sub-pass of the same thread is permitted.

そして、描画処理部36で描画処理されたスタンプデータは、ローカルメモリ28−0〜28−3のいずれかに格納されて、描画処理が完了する。 The stamp data drawn by the drawing processing unit 36 is stored in one of the local memories 28-0 to 28-3, and the drawing process is completed.

上記のように、この発明の第1の実施形態に係るグラフィックプロセッサであると、下記の効果(1)乃至(6)を得ることが出来る。
(1)入力信号を容易に同期させることが出来る。
本実施形態に係るグラフィックプロセッサであると、受信したスタンプデータにそれぞれ固有のスタンプ番号StNを付与している。そして、スタンプデータを受信した際、そのスタンプ番号StNを、書き込み制御部40のメモリ54のエントリに格納している。更に、メモリ54の各エントリには同期ビットSyncが設けられ、タスクの最初のスタンプに対して同期ビットSyncがセット(“1”)される。従って、各エントリに対応するスタンプとタスクとを容易に同期させることが出来る。すなわち、メモリ54の同期ビットSyncを参照することで、各スタンプがどのタスクに属するかを容易に把握出来る。より具体的には、同期ビットSyncがセットされたエントリから、次に同期ビットSyncがセットされたエントリの直前のエントリまでが、同一のタスクに属する。よって、新たに同期ビットSyncがセットされたエントリ以降は、それ以前のエントリとは異なるタスクに属することが分かる。
As described above, the graphic processor according to the first embodiment of the present invention can obtain the following effects (1) to (6).
(1) The input signal can be easily synchronized.
In the graphic processor according to the present embodiment, a unique stamp number StN is assigned to each received stamp data. When the stamp data is received, the stamp number StN is stored in the entry of the memory 54 of the write control unit 40. Further, each entry of the memory 54 is provided with a synchronization bit Sync, and the synchronization bit Sync is set (“1”) for the first stamp of the task. Therefore, the stamp and task corresponding to each entry can be easily synchronized. That is, by referring to the synchronization bit Sync of the memory 54, it is possible to easily grasp which task each stamp belongs to. More specifically, an entry from which the synchronization bit Sync is set to an entry immediately before the next entry in which the synchronization bit Sync is set belongs to the same task. Therefore, it can be understood that the entry after the entry in which the synchronization bit Sync is newly set belongs to a task different from the previous entry.

また、Wデータと、それ以外のデータとの同期も容易となる。書き込み制御部40は、第2データを、それ以外のデータより一定サイクルだけ遅れて受信する。そこで、第2データは、第2データ保持部43においてスタンプ番号StNと同一番号のエントリに保持される。例えばStN=4の第2データは、第2データ保持部43のエントリ4に保持される。従って、第2データがどのスタンプのものであるかを容易に認識できる。また第2データに関しても、メモリ54の同期ビットSyncを参照することで、いずれのタスクに属するのか認識できる。
以上のように、複数の入力信号とタスクとの同期を容易に取ることが出来るため、グラフィックプロセッサの描画信頼性を向上できる。
In addition, it becomes easy to synchronize the W data with other data. The write control unit 40 receives the second data with a delay of a certain cycle from the other data. Therefore, the second data is held in the entry having the same number as the stamp number StN in the second data holding unit 43. For example, the second data of StN = 4 is held in entry 4 of the second data holding unit 43. Therefore, it can be easily recognized which stamp the second data belongs to. Also, with respect to the second data, it can be recognized which task it belongs to by referring to the synchronization bit Sync of the memory 54.
As described above, since it is possible to easily synchronize a plurality of input signals and tasks, it is possible to improve the drawing reliability of the graphic processor.

(2)描画処理に関する処理量を削減出来る。
本実施形態に係るグラフィックプロセッサであると、2つのスタンプのクアッドバリッドを参照して、いずれかのクアッドがインバリッドである場合、これら2つのスタンプをマージしている。従って、インバリッドなクアッドに関する処理を省き、バリッドなクアッドに対してのみ描画処理行うことが出来、処理量を削減できる。その結果、グラフィックプロセッサの不可を軽減すると共に、描画速度を向上できる。
(2) The processing amount related to the drawing process can be reduced.
In the graphic processor according to the present embodiment, referring to a quad valid of two stamps, if any of the quads is invalid, the two stamps are merged. Accordingly, the processing related to the invalid quad can be omitted, and the rendering process can be performed only for the valid quad, and the processing amount can be reduced. As a result, it is possible to reduce the impossibility of the graphic processor and improve the drawing speed.

(3)描画処理を効率化出来る(その1)。
本実施形態に係るグラフィックプロセッサであると、オーバーラップ検出部45がXYテーブルを備えている。そして、XYテーブルに保持されるXY座標値と、マージバッファ84に保持されるスタンプのXY座標値とを比較し、一致した場合、当該スタンプをそのエントリに登録している。このようにXYテーブルを保持し、更にエントリ番号をXYタグとして管理することにより、スレッド発行時の処理を簡略化出来ると共に、描画処理を効率化出来る。
(3) The drawing process can be made efficient (part 1).
In the graphic processor according to the present embodiment, the overlap detection unit 45 includes an XY table. Then, the XY coordinate value held in the XY table is compared with the XY coordinate value of the stamp held in the merge buffer 84. If they match, the stamp is registered in the entry. By holding the XY table and managing the entry numbers as XY tags in this way, it is possible to simplify the process at the time of thread issuance and to make the drawing process more efficient.

また、2つのスタンプが完全にマージされ、スタンプがマージバッファ84に残らなかった場合、2つのスタンプを連続してXYテーブルに登録する。この様子を図78及び図79を用いて説明する。図78はクアッドマージの様子を示す概念図であり、図79はその際のスレッド生成部46及びオーバーラップ検出部45の処理の様子を示すフローチャートである。   Further, when the two stamps are completely merged and the stamp does not remain in the merge buffer 84, the two stamps are continuously registered in the XY table. This will be described with reference to FIGS. 78 and 79. FIG. 78 is a conceptual diagram showing a state of quad-merge, and FIG. 79 is a flowchart showing a state of processing of the thread generation unit 46 and the overlap detection unit 45 at that time.

図78に示すように、マージバッファにスタンプ番号StN=4のスタンプが保持されている状態において、スタンプ番号StN=5のスタンプが新規入力された場合をステージ1とする。ステージ1では、マージバッファのスタンプはクアッド1のみがバリッドで、新規入力スタンプは全てのクアッド2〜5がバリッドである。従って、これらのスタンプをマージすると、クアッド1、3〜5を含むスレッド(TdID=7)が生成される。そして新規入力スタンプのクアッド2がマージバッファに残される。   As shown in FIG. 78, in a state where the stamp with the stamp number StN = 4 is held in the merge buffer, the case where the stamp with the stamp number StN = 5 is newly input is referred to as stage 1. In stage 1, only the quad 1 is valid in the merge buffer stamp, and all quads 2 to 5 are valid in the new input stamp. Therefore, when these stamps are merged, a thread (TdID = 7) including quads 1 and 3 to 5 is generated. Then, quad 2 of the new input stamp is left in the merge buffer.

次にマージバッファにStN=5のスタンプのクアッド2が保持されている状態において、StN=6のスタンプが新規入力された場合をステージ2とする。ステージ2では、新規入力スタンプは3つのクアッド6〜8がバリッドである。従ってこれらのスタンプをマージすると、クアッド2、6〜8を含むスレッド(TdID=8)が生成される。ステージ2では、2つのスタンプが完全にマージされ、マージバッファにスタンプデータは残されない。   Next, in a state where the quad 2 of the stamp with StN = 5 is held in the merge buffer, a stage 2 is set when a stamp with StN = 6 is newly input. In stage 2, the new input stamp has three quads 6 to 8 as valid. Therefore, when these stamps are merged, a thread (TdID = 8) including quads 2 and 6 to 8 is generated. In stage 2, the two stamps are completely merged and no stamp data is left in the merge buffer.

以上のステージ1、2におけるスレッド生成部46及びオーバーラップ検出部45の処理について図79を用いて説明する。まず第1ステージについて説明する。第1ステージは、Aステージ、Bステージ、Cステージの3つの処理ステージを含む。まずAステージにおいて、スレッド生成部46がマージ検出を行う(ステップS20)。これにより2つのスタンプをどのようにマージするかが決定される。またスレッド生成部46はマージバッファのデータをオーバーラップ検出部45に転送する(ステップS30)。そしてオーバーラップ検出部45はXY座標の比較を行う(ステップS40)。   The processing of the thread generation unit 46 and the overlap detection unit 45 in the above stages 1 and 2 will be described with reference to FIG. First, the first stage will be described. The first stage includes three processing stages: an A stage, a B stage, and a C stage. First, in the A stage, the thread generation unit 46 performs merge detection (step S20). This determines how the two stamps are merged. The thread generation unit 46 transfers the merge buffer data to the overlap detection unit 45 (step S30). The overlap detection unit 45 compares the XY coordinates (step S40).

次にBステージでは、スレッド生成部46がステップS20の結果に基づいてクアッドマージを行う(ステップS31)。またオーバーラップ検出部45は、ステップS40の結果に基づいて、XYテーブルのエントリの割り当てを行い、XYタグを生成する。   Next, in the B stage, the thread generation unit 46 performs quad merging based on the result of step S20 (step S31). The overlap detection unit 45 assigns entries in the XY table based on the result of step S40, and generates an XY tag.

次にCステージでは、スレッド生成部46がスレッド保持部47へクアッドマージに関する情報を転送する(ステップS32)。以上でステージ1についての処理が終了する。   Next, in the C stage, the thread generation unit 46 transfers information related to quad merge to the thread holding unit 47 (step S32). Thus, the process for stage 1 is completed.

次にステージ2に関する処理について説明する。ステージ2は、A〜Cステージだけでなく、更にDステージを含む。すなわち、ステージ2でもステージ1と同様に、ステップS20、S31〜S32、S40、S41の処理を行う。しかしステージ2では2つのスタンプの全クアッドがマージされる。従ってオーバーラップ検出部45は、Cステージにおいて新規入力スタンプに関してもXY座標の比較を行う(ステップS42)。そしてDステージにおいて、新規入力スタンプに対して、XYテーブルのエントリの割り当てを行う。   Next, processing related to stage 2 will be described. Stage 2 includes not only the A to C stages but also a D stage. That is, the process of steps S20, S31 to S32, S40, and S41 is performed in the stage 2 similarly to the stage 1. However, in stage 2, all quads of the two stamps are merged. Therefore, the overlap detection unit 45 compares the XY coordinates for the newly input stamp in the C stage (step S42). In the D stage, an entry in the XY table is assigned to the new input stamp.

以上のように、全てのクアッドがマージされた場合には、2つのスタンプに関して連続してハッシュ登録することで、描画処理を効率化出来る。   As described above, when all the quads have been merged, the drawing process can be made more efficient by successively registering the hash for the two stamps.

(4)画像描画の信頼性を向上できる(その1)。
本実施形態に係るグラフィックプロセッサでは、新規入力スタンプの一部のクアッドがマージバッファに保持された場合、スレッド生成部46がDivideフラグを立てる。この様子を、図80を用いて説明する。図80はクアッドマージの様子を示す概念図である。
(4) The reliability of image drawing can be improved (part 1).
In the graphic processor according to this embodiment, when a quad of a new input stamp is held in the merge buffer, the thread generation unit 46 sets the Divide flag. This will be described with reference to FIG. FIG. 80 is a conceptual diagram showing a state of quad-merge.

図78に示すように、マージバッファにスタンプ番号StN=4のスタンプが保持されている状態において、スタンプ番号StN=5のスタンプが新規入力された場合をステージ1とする。ステージ1では、マージバッファのスタンプはクアッド1のみがバリッドで、新規入力スタンプは全てのクアッド2〜5がバリッドである。従って、これらのスタンプをマージすると、クアッド1、3〜5を含むスレッド(TdID=7)が生成される。そして新規入力スタンプのクアッド2がマージバッファに残される。よって、スレッド生成部46はディバイドビットを“1”とする。   As shown in FIG. 78, in a state where the stamp with the stamp number StN = 4 is held in the merge buffer, the case where the stamp with the stamp number StN = 5 is newly input is referred to as stage 1. In stage 1, only the quad 1 is valid in the merge buffer stamp, and all quads 2 to 5 are valid in the new input stamp. Therefore, when these stamps are merged, a thread (TdID = 7) including quads 1 and 3 to 5 is generated. Then, quad 2 of the new input stamp is left in the merge buffer. Therefore, the thread generation unit 46 sets the divide bit to “1”.

次にマージバッファにStN=5のスタンプのクアッド2が保持されている状態において、StN=6のスタンプが新規入力された場合をステージ2とする。また、StN=6のスタンプが当該タスクにおける最終スタンプであったとする。ステージ2では、新規入力スタンプは全てのクアッド6〜9がバリッドである。従ってこれらのスタンプをマージすると、クアッド2、7〜9を含むスレッド(TdID=8)が生成される。そして新規入力スタンプのクアッド6がマージバッファに残される。よって、スレッド生成部46はディバイドビットを“1”とする。   Next, in a state where the quad 2 of the stamp with StN = 5 is held in the merge buffer, a stage 2 is set when a stamp with StN = 6 is newly input. Further, it is assumed that the stamp of StN = 6 is the final stamp in the task. In stage 2, the new input stamp is valid for all quads 6-9. Therefore, when these stamps are merged, a thread (TdID = 8) including quads 2 and 7 to 9 is generated. The quad 6 of the new input stamp is left in the merge buffer. Therefore, the thread generation unit 46 sets the divide bit to “1”.

次に続くステージ3では、新規入力スタンプは無いので、マージバッファに残ったクアッド6により、スレッド(TdID=9)が生成される。   In the next stage 3, since there is no new input stamp, a thread (TdID = 9) is generated by the quad 6 remaining in the merge buffer.

上記のように、ディバイドビットが“1”にセットされることにより、マージバッファにスタンプデータが残っているかどうかを容易に認識できる。そのため、特に入力スタンプが最終スタンプの場合でも、マージバッファに残されたスタンプデータを新規スレッドとして生成することが出来、クアッドマージ処理の信頼性を向上できる。   As described above, by setting the divide bit to “1”, it can be easily recognized whether or not the stamp data remains in the merge buffer. Therefore, even when the input stamp is the final stamp, the stamp data remaining in the merge buffer can be generated as a new thread, and the reliability of the quad merge process can be improved.

(5)描画処理を効率化出来る(その2)
本実施形態に係るグラフィックプロセッサであると、プリロード発行後のスレッド保持部47のPLCntレジスタはエイジレジスタとして機能する。エイジレジスタにより、プリロード発行要求されたスレッドの順序を把握される。そして、エイジレジスタ内の順序に従ってスレッドが発行される。このように、発行可能なスレッドうち、プリロード発行要求の早いものから順番にスレッドが発行されるので、古いスレッドが停滞することを防止し、描画処理を効率化出来る。
(5) Drawing process can be made more efficient (part 2)
In the graphic processor according to the present embodiment, the PLCnt register of the thread holding unit 47 after issuing the preload functions as an age register. The order of threads requested to issue a preload is grasped by the age register. Then, threads are issued according to the order in the age register. In this way, threads that can be issued are issued in order from the preload issue request in order, so that the old thread can be prevented from stagnation and the rendering process can be made more efficient.

(6)描画処理を効率化出来る(その3)
本実施形態に係るグラフィックプロセッサであると、図47を用いて説明したように、各スレッドに対して実行される命令を複数のサブパスに分割している。そして図48に示すように、ピクセルシェーダユニットはスレッドIDにかかわらず、実行可能なスレッドから順にサブパス毎に処理を行う。サブパスを実行した後にはテクスチャロードが行われるので、そのスレッドに関しては次のサブパスを即座に実行することはできない。しかし、その期間を別のスレッドのサブパスを実行しているので、無駄時間が発生することを抑制し、描画処理の効率を向上できる。
(6) Drawing process can be made more efficient (part 3)
In the graphic processor according to the present embodiment, as described with reference to FIG. 47, an instruction to be executed for each thread is divided into a plurality of subpaths. As shown in FIG. 48, the pixel shader unit performs processing for each sub-pass in order from the executable thread regardless of the thread ID. Since the texture load is performed after executing the sub-pass, the next sub-pass cannot be executed immediately for the thread. However, since the sub-pass of another thread is executed during that period, it is possible to suppress the occurrence of dead time and improve the efficiency of the drawing process.

また、上記のようにサブパス単位でスレッドを発行するために、プリロードステートが各種のステートを持ち、スレッド保持部47がランビットRun及びレディビットRdyを備えている。そして、これらの条件が揃った場合にのみ、スレッドが発行される。また命令管理部48は、新しいスレッドが、同一XY座標を有する古いスレッドを追い越さないように、スレッド発行順序を制御している。これにより、画像描画信頼性を向上できる。   Further, as described above, in order to issue a thread in units of subpaths, the preload state has various states, and the thread holding unit 47 includes a run bit Run and a ready bit Rdy. A thread is issued only when these conditions are met. The instruction management unit 48 controls the thread issue order so that the new thread does not overtake the old thread having the same XY coordinates. Thereby, image drawing reliability can be improved.

更に命令制御部35は、ロックビットをセットすることにより、必要に応じて指定するスレッドの発行を強制的に禁止することも出来る。   Furthermore, the instruction control unit 35 can forcibly prohibit the issuing of a designated thread as necessary by setting a lock bit.

また命令制御部35は、描画処理部36によりテクスチャロード命令が発行されると、テクスチャユニット33はテクスチャの取得を開始する。そしてテクスチャユニット33は、テクスチャの取得を終了すると、命令制御部35に対してアクノリッジ信号を返す。命令制御部35は、テクスチャロード命令が発行された際、テクスチャユニット33に対して対応するスレッドのスレッドIDを送付する。従って、テクスチャユニット33はどのスレッドに関してアクノリッジ信号を返すべきかを把握することが出来る。   In addition, when the texture control command is issued by the drawing processing unit 36, the command control unit 35 starts the texture acquisition. Then, the texture unit 33 returns an acknowledge signal to the command control unit 35 when the texture acquisition is completed. The instruction control unit 35 sends the thread ID of the corresponding thread to the texture unit 33 when the texture load instruction is issued. Therefore, the texture unit 33 can grasp which thread should return the acknowledge signal.

次に、この発明の第2の実施形態に係るグラフィックプロセッサについて説明する。本実施形態は、上記第1の実施形態においてロックの制御に関するものである。従って、グラフィックプロセッサの構成は上記第1の実施形態と同様であるので説明は省略し、第1の実施形態と異なる点についてのみ以下説明する。   Next explained is a graphic processor according to the second embodiment of the invention. This embodiment relates to lock control in the first embodiment. Accordingly, since the configuration of the graphic processor is the same as that of the first embodiment, description thereof will be omitted, and only differences from the first embodiment will be described below.

本実施形態に係るグラフィックプロセッサが備える命令制御部35は、ロック命令を強制的に無効化させる機能を備えている。すなわち、複数のスレッドが同一のサブパスの実行を待っている場合であり、且つ古いスレッドがロックを取っていない場合には、そのサブパスの実行を待っている全てのスレッドのロックが無効化される。一旦無効化されたロックは復活することなく、またXY座標に関係なく無効化される。この様子を図81に示す。   The instruction control unit 35 provided in the graphic processor according to the present embodiment has a function of forcibly invalidating a lock instruction. In other words, when multiple threads are waiting for execution of the same subpath, and the old thread is not locked, the locks of all threads waiting for execution of that subpath are invalidated. . Once disabled, the lock is not restored and is disabled regardless of the XY coordinates. This is shown in FIG.

図示するように、同一XY座標のスレッド2、3がサブパスの実行を待っており、次に実行されるサブパスIDは共に3である。この状態で、スレッド3がロックを取っていた場合には、そのロックは強制的に解除される。   As shown in the figure, the threads 2 and 3 having the same XY coordinates are waiting for the execution of the sub-pass, and the sub-pass ID to be executed next is both 3. In this state, when the thread 3 is locked, the lock is forcibly released.

本実施形態に係るグラフィックプロセッサであると、上記第1の実施形態で説明した(1)乃至(6)の効果に加えて、下記(7)の効果を得ることが出来る。   In the graphic processor according to the present embodiment, the following effect (7) can be obtained in addition to the effects (1) to (6) described in the first embodiment.

(7)画像描画の信頼性を向上できる(その2)。
本実施形態に係るグラフィックプロセッサによれば、ロックを強制的に解除する機能を備えている。従って、デッドロックの発生を抑制でき、描画処理の信頼性を向上できる。この点につき図82を用いて説明する。図82は図81と同一の条件で、ロックを無効化する機能を有しない場合について示している。
(7) The reliability of image drawing can be improved (part 2).
The graphic processor according to the present embodiment has a function of forcibly releasing the lock. Therefore, the occurrence of deadlock can be suppressed and the reliability of the drawing process can be improved. This point will be described with reference to FIG. FIG. 82 shows a case where there is no function for invalidating the lock under the same conditions as FIG.

命令制御部35は、同一サブパスの実行を待っている複数のスレッドが存在する場合、古いスレッドだけを実行可能にする。これはスレッドの発行順序を補償するためである。しかし図82の場合、スレッド3がロックを取っているため、同一XY座標のスレッド2は実行できない。他方、スレッド3がサブパス4を実行してしまうと、古いスレッド2のサブパス4を追い越すことになるため、スレッド3のサブパス4も実行できない。このように、実行可能なスレッドが無くなる状態(デッドロック)が生じうる。   When there are a plurality of threads waiting for the execution of the same subpath, the instruction control unit 35 allows only the old thread to be executed. This is to compensate for the thread issue order. However, in the case of FIG. 82, since the thread 3 is locked, the thread 2 having the same XY coordinates cannot be executed. On the other hand, if the thread 3 executes the subpass 4, the subpath 4 of the thread 3 is overtaken, so that the subpath 4 of the thread 3 cannot be executed. As described above, a state (deadlock) in which there is no executable thread may occur.

しかし本実施形態であると、スレッド3のロックを解除できる。従ってデッドロックの発生を抑制出来る。   However, in this embodiment, the lock of the thread 3 can be released. Therefore, the occurrence of deadlock can be suppressed.

なお、上記第1乃至第2の実施形態に係るグラフィックプロセッサは、例えばゲーム機、ホームサーバー、テレビ、または携帯情報端末などに搭載することが出来る。図83は上記第1及び第2の実施形態に係るグラフィックプロセッサを備えたデジタルテレビの備えるデジタルボードのブロック図である。デジタルボードは、画像・音声などの通信情報を制御するためのものである。図示するように、デジタルボード1000は、フロントエンド部1100、画像描画プロセッサシステム1200、デジタル入力部1300、A/Dコンバータ1400、1800、ゴーストリダクション部1500、三次元YC分離部1600、カラーデコーダ1700、LAN処理LSI1900、LAN端子2000、ブリッジメディアコントローラ2100、カードスロット2200、フラッシュメモリ2300、及び大容量メモリ(例えばDRAM)2400を備えている。フロントエンド部1100は、デジタルチューナーモジュール1110、1120、OFDM(Orthogonal Frequency Division Multiplex)復調部1130、QPSK(Quadrature Phase Shift Keying)復調部1140を備えている。   The graphic processor according to the first or second embodiment can be mounted on, for example, a game machine, a home server, a television, or a portable information terminal. FIG. 83 is a block diagram of a digital board provided in a digital television provided with the graphic processor according to the first and second embodiments. The digital board is for controlling communication information such as images and sounds. As shown in the figure, the digital board 1000 includes a front end unit 1100, an image drawing processor system 1200, a digital input unit 1300, A / D converters 1400 and 1800, a ghost reduction unit 1500, a three-dimensional YC separation unit 1600, a color decoder 1700, A LAN processing LSI 1900, a LAN terminal 2000, a bridge media controller 2100, a card slot 2200, a flash memory 2300, and a large capacity memory (for example, DRAM) 2400 are provided. The front end unit 1100 includes digital tuner modules 1110 and 1120, an OFDM (Orthogonal Frequency Division Multiplex) demodulator 1130, and a QPSK (Quadrature Phase Shift Keying) demodulator 1140.

画像描画プロセッサシステム1200は、送受信回路1210、MPEG2デコーダ1220、グラフィックエンジン1230、デジタルフォーマットコンバータ1240、及びプロセッサ1250を備えている。そして、例えばグラフィックエンジン1230及びプロセッサ1250が、上記第1乃至第2の実施形態で説明したグラフィックプロセッサに対応する。   The image drawing processor system 1200 includes a transmission / reception circuit 1210, an MPEG2 decoder 1220, a graphic engine 1230, a digital format converter 1240, and a processor 1250. For example, the graphic engine 1230 and the processor 1250 correspond to the graphic processor described in the first or second embodiment.

上記構成において、地上デジタル放送波、BSデジタル放送波、及び110°CSデジタル放送波は、フロントエンド部1100で復調される。また地上アナログ放送波及びDVD/VTR信号は、3次元YC分離部1600及びカラーデコーダ1700でデコードされる。これらの信号は、画像描画プロセッサシステム1200に入力され、送受信回路1210で、映像・音声・データに分離される。そして、映像に関しては、MPEG2デコーダ1220を介してグラフィックエンジン1230に映像情報が入力される。するとグラフィックエンジン1230は、上記実施形態で説明したようにして図形を描画する。   In the above configuration, the terrestrial digital broadcast wave, the BS digital broadcast wave, and the 110 ° CS digital broadcast wave are demodulated by the front end unit 1100. The terrestrial analog broadcast wave and the DVD / VTR signal are decoded by a three-dimensional YC separation unit 1600 and a color decoder 1700. These signals are input to the image drawing processor system 1200 and separated into video / audio / data by the transmission / reception circuit 1210. As for the video, video information is input to the graphic engine 1230 via the MPEG2 decoder 1220. Then, the graphic engine 1230 draws a graphic as described in the above embodiment.

図84は、上記第1及び第2の実施形態に係るグラフィックプロセッサを備えた録画再生機器のブロック図である。図示するように、録画再生機器3000はヘッドアンプ3100、モータードライバ3200、メモリ3300、画像情報制御回路3400、ユーザI/F用CPU3500、フラッシュメモリ3600、ディスプレイ3700、ビデオ出力部3800、及びオーディオ出力部3900を備えている。   FIG. 84 is a block diagram of a recording / playback apparatus including the graphic processor according to the first and second embodiments. As shown in the figure, the recording / playback device 3000 includes a head amplifier 3100, a motor driver 3200, a memory 3300, an image information control circuit 3400, a user I / F CPU 3500, a flash memory 3600, a display 3700, a video output unit 3800, and an audio output unit. 3900.

画像情報制御回路3400は、メモリインターフェース3410、デジタル信号プロセッサ3420、プロセッサ3430、映像処理用プロセッサ3440、及びオーディオ処理用プロセッサ3450を備えている。そして、例えば映像処理用プロセッサ3440及びデジタル信号プロセッサ3420が、上記第1及び第2の実施形態で説明したグラフィックプロセッサに対応する。   The image information control circuit 3400 includes a memory interface 3410, a digital signal processor 3420, a processor 3430, a video processing processor 3440, and an audio processing processor 3450. For example, the video processing processor 3440 and the digital signal processor 3420 correspond to the graphic processor described in the first and second embodiments.

上記構成において、ヘッドアンプ3100で読み出された映像データが画像情報制御回路3400に入力される。そして、デジタル信号処理プロセッサ3420から映像情報用プロセッサに図形情報が入力される。すると映像情報用プロセッサ3450は、上記実施形態で説明したようにして図形を描画する。   In the above configuration, video data read by the head amplifier 3100 is input to the image information control circuit 3400. Then, graphic information is input from the digital signal processor 3420 to the video information processor. Then, the video information processor 3450 draws a graphic as described in the above embodiment.

なお、本願発明は上記実施形態に限定されるものではなく、実施段階ではその要旨を逸脱しない範囲で種々に変形することが可能である。更に、上記実施形態には種々の段階の発明が含まれており、開示される複数の構成要件における適宜な組み合わせにより種々の発明が抽出されうる。例えば、実施形態に示される全構成要件からいくつかの構成要件が削除されても、発明が解決しようとする課題の欄で述べた課題が解決でき、発明の効果の欄で述べられている効果が得られる場合には、この構成要件が削除された構成が発明として抽出されうる。   Note that the present invention is not limited to the above-described embodiment, and various modifications can be made without departing from the scope of the invention in the implementation stage. Furthermore, the above embodiments include inventions at various stages, and various inventions can be extracted by appropriately combining a plurality of disclosed constituent elements. For example, even if some constituent requirements are deleted from all the constituent requirements shown in the embodiment, the problem described in the column of the problem to be solved by the invention can be solved, and the effect described in the column of the effect of the invention Can be extracted as an invention.

23…グラフィックプロセッサ、24…ラスタライザ、25−0〜25−3…ピクセルシェーダ、26…ローカルメモリ、30…データ振り分け部、31…同期回路、33…テクスチャユニット、34…ピクセルシェーダユニット、35…命令制御部、36…描画処理部、37…データ制御部、40…書き込み制御部、41…コンフィギュレーションレジスタ、42…第1データ保持部、43…第2データ保持部、44…スタンプ保持部、45…オーバーラップ検出部、46…スレッド生成部、47…スレッド保持部、48…命令管理部、49…パフォーマンスモニタ、50…第1ステートマシーン、51…第2ステートマシーン、52…クアッドバリッド発生器、53−0〜53−4…シフトレジスタ、54、57、58…メモリ、60−0〜60−(M−1)…エントリ部、61…XYテーブル選択部、62…エントリ割り当て部、63…スレッド保持部選択部、84…マージバッファ、85…イネーブル信号発生器、86…QV発生器、87…ディバイドビット発生器、88…スレッドID発生器、94…スレッドレジスタ群、95…プリロードブロック、96…アップデート部、97…スレッド発行制御部、151−0〜151−(M−1)…比較回路、159…エントリ回路、170…読み出し回路、171…書き込み回路   DESCRIPTION OF SYMBOLS 23 ... Graphic processor, 24 ... Rasterizer, 25-0-25-3 ... Pixel shader, 26 ... Local memory, 30 ... Data distribution part, 31 ... Synchronization circuit, 33 ... Texture unit, 34 ... Pixel shader unit, 35 ... Instruction Control unit 36 ... Drawing processing unit 37 ... Data control unit 40 ... Write control unit 41 ... Configuration register 42 ... First data holding unit 43 ... Second data holding unit 44 ... Stamp holding unit 45 ... overlap detection unit, 46 ... thread generation unit, 47 ... thread holding unit, 48 ... instruction management unit, 49 ... performance monitor, 50 ... first state machine, 51 ... second state machine, 52 ... quad valid generator, 53-0 to 53-4 ... shift register, 54, 57, 58 ... memory, 60- -60- (M-1)... Entry section, 61... XY table selection section, 62... Entry allocation section, 63... Thread holding section selection section, 84 ... merge buffer, 85 ... enable signal generator, 86. , 87 ... Divide bit generator, 88 ... Thread ID generator, 94 ... Thread register group, 95 ... Preload block, 96 ... Update part, 97 ... Thread issue control part, 151-0 to 151- (M-1) ... Comparison circuit, 159 ... entry circuit, 170 ... read circuit, 171 ... write circuit