EP2: Image Convolutional Circuit (CONV) Design圖像卷積電路 (CONV) 設計画像畳み込み回路 (CONV) 設計

The Project EP2 announcement plus the full 2019 IC Design Contest preliminary specification (graduate division, cell-based digital circuit design), with every figure from the original PDFs.EP2 專題公告,加上 2019 IC 設計競賽初賽(研究所類標準元件數位電路設計)的完整題目規格,並收錄原始 PDF 的所有圖。EP2 課題の告知と、2019 年 IC 設計コンテスト予選(大学院部門・セルベース デジタル回路設計)の完全な仕様を、元の PDF のすべての図とともに 1 ページにまとめたもの。

Project EP2 Guideline.pdf (1 page頁ページ) related file/B_ICC2019_priliminary_grad_cell_based.pdf (16 pages頁ページ)

A. Project EP2 AnnouncementA. EP2 專題公告A. EP2 課題の告知

The following are the requirements and instructions for Project EP2:以下為 EP2 專題的要求與說明:EP2 課題の要件と手順は以下のとおりである。

  1. EP2 must be synthesized using the ADF_n16 process.EP2 必須使用 ADF_n16 製程進行合成。EP2 は ADF_n16 プロセスで合成しなければならない。
    Before launching Design Compiler, please enter snsd and select ADFP_n16.啟動 Design Compiler 前,請先輸入 snsd 並選擇 ADFP_n16。Design Compiler を起動する前に snsd を入力し、ADFP_n16 を選択すること。
  2. Simulation commands模擬指令シミュレーションコマンド (xrun can be replaced with ncverilog).(xrun 可以用 ncverilog 取代。)(xrun は ncverilog に置き換えてもよい。)

    RTL Simulation:RTL 模擬:RTL シミュレーション:

    xrun testfixture.v CONV.v +access+r -clean

    Gate-Level Simulation (after synthesis):閘級模擬(合成後):ゲートレベル・シミュレーション(合成後):

    xrun testfixture.v CONV_syn.v +access+r -v N16ADFP_StdCell.v +define+SDF -clean
  3. No timing violations are allowed in the Gate-Level Simulation.閘級模擬中不允許任何時序違規。ゲートレベル・シミュレーションでタイミング違反があってはならない。
  4. If you modify the Period, please remember to update the corresponding settings in both CONV.sdc and testfixture.v.若修改 Period,請記得同時更新 CONV.sdc 與 testfixture.v 中對應的設定。Period を変更する場合は、CONV.sdc と testfixture.v の両方で対応する設定を更新すること。
  5. Please fill in the Summary_Table_for_EP2 with the circuit information of your best design, including Area, Period, Power, and Latency, and indicate whether the simulations pass.請在 Summary_Table_for_EP2 填入最佳設計的電路資訊,包括 Area、Period、Power 與 Latency,並註明模擬是否通過。Summary_Table_for_EP2 に最良設計の回路情報(Area・Period・Power・Latency)を記入し、シミュレーションが通ったかどうかを明記すること。
  6. Please upload the following files:請上傳以下檔案:次のファイルをアップロードすること。
    • PPT presentationPPT 簡報PPT プレゼン資料
    • Summary_Table_for_EP2
    • CONV_syn.ddc
    • RTL code (all RTL modules must be combined into a single file)RTL 程式碼(所有 RTL 模組必須合併成單一檔案)RTL コード(すべての RTL モジュールを 1 つのファイルにまとめること)

Example folder structure資料夾結構範例フォルダ構成の例

G01_VerificationCode/
├── EP2_G01.ppt
├── Summary_Table_for_EP2.xlsx
├── CONV_syn.ddc
└── ep2_g01.v        (RTL Code)
The contest spec below (Part B) was written for the TSMC 0.13 µm flow (tsmc13_neg.v, ncverilog). For EP2 the process is ADFP_n16 and the gate-level cell library is N16ADFP_StdCell.v; the functional spec, I/O ports, memory maps and timing are unchanged.下方的競賽題目(B 部分)原本是針對 TSMC 0.13 µm 流程(tsmc13_neg.v、ncverilog)撰寫。EP2 改用 ADFP_n16 製程,閘級元件庫為 N16ADFP_StdCell.v;功能規格、輸出入埠、記憶體對應與時序皆不變。以下のコンテスト仕様(B 部)は TSMC 0.13 µm フロー(tsmc13_neg.v、ncverilog)向けに書かれたものである。EP2 ではプロセスが ADFP_n16、ゲートレベルのセルライブラリが N16ADFP_StdCell.v になるが、機能仕様・入出力ポート・メモリ対応・タイミングは変わらない。

B. 2019 IC Design Contest Preliminary: Graduate Division, Cell-Based Digital Circuit DesignB. 2019 IC 設計競賽初賽:研究所類標準元件數位電路設計B. 2019 年 IC 設計コンテスト予選:大学院部門 セルベース デジタル回路設計
Image Convolutional Circuit Design

1. Problem description1. 問題描述1. 問題の説明

Design an image convolutional circuit (hereafter the CONV circuit). The input to CONV is a grayscale image, and the circuit must carry out a three-layer processing flow in the order Convolutional (Layer 0) → Max-pooling (Layer 1) → Flatten (Layer 2), as shown in Figure 1.本題請完成一圖像卷積電路設計(Image Convolutional Circuit Design,以下稱 CONV 電路),CONV 電路輸入為一灰階圖像,電路需完成 3 層(Layer)的運算流程,其順序為 Convolutional(Layer 0) → Max-pooling(Layer 1) → Flatten(Layer 2) 等共 3 層的運算處理流程,如下圖 1 所示。画像畳み込み回路(以下 CONV 回路)を設計せよ。CONV の入力はグレースケール画像であり、回路は図 1 に示すように Convolutional(Layer 0)→ Max-pooling(Layer 1)→ Flatten(Layer 2)の 3 層の処理を順に実行しなければならない。

In Layer 0 the input grayscale image (64 wide × 64 high pixels) is first zero-padded, then convolved with two filters (also called kernels) of size 3×3, and finally passed through ReLU. The result of Layer 0 is therefore two images of 64 × 64 pixels.首先在 Layer 0 中,輸入灰階圖像(尺寸為 64(寬)x64(高) pixels)需先經 zero-padding,接著進行採用 2 個濾鏡(或稱「核(Kernel)」)的圖像卷積(Convolutional)運算,其 Kernel 尺寸為 3x3,接著再經過 ReLU 運算後方為 Layer 0 的結果,故其結果為 2 張尺寸為 64(寬)x64(高) pixels 的圖。まず Layer 0 では、入力グレースケール画像(幅 64 × 高さ 64 ピクセル)にゼロパディングを施し、サイズ 3×3 の 2 つのフィルタ(カーネル)で畳み込みを行い、さらに ReLU を通したものが Layer 0 の結果となる。したがって結果は 64 × 64 ピクセルの画像 2 枚である。

Layer 1 performs max-pooling with a 2×2 window and a stride of 2, giving two images of 32 × 32 pixels.Layer 1 要進行最大池化(max-pooling)運算,須採用 2x2 的 max-pooling 視窗及步幅(stride)為 2 的規格進行。故結果將呈現 2 張尺寸為 32(寬) x 32(高) pixels 的圖。Layer 1 では 2×2 のウィンドウ、ストライド 2 で最大プーリングを行う。結果は 32 × 32 ピクセルの画像 2 枚となる。

Finally, Layer 2 flattens the two 32 × 32 images from Layer 1 into a single sequence of 2048 (32×32×2) values, in the order specified below, and outputs it.最後 Layer 2 則是進行平坦化(Flatten)處理,將 Layer 1 輸出的 2 張 32(寬) x 32(高) pixels 的圖依規格排序成一個 2048 (32x32x2)個訊號值的序列並輸出即可完成。最後に Layer 2 では、Layer 1 が出力した 32 × 32 ピクセルの画像 2 枚を規定の順序で 2048(32×32×2)個の値の系列に並べ替えて出力すれば完了である。

Every layer may write its results, layer by layer and in several passes, back into the memories built into the testfixture (L0_MEM0, L0_MEM1, L1_MEM0, L1_MEM1 and L2_MEM in Figure 2). Each layer has its own dedicated memory for its output.上述所有 Layer,均可分層分次將處理結果寫回 testfixture 內建的記憶體內(如圖 2 之 L0_MEM0、L0_MEM1、L1_MEM0、L1_MEM1 及 L2_MEM)中,每一 Layer 的輸出結果都有各自對應的記憶體存放空間用於放置輸出結果。上記の各層は、処理結果を層ごと・複数回に分けて testfixture 内蔵のメモリ(図 2 の L0_MEM0、L0_MEM1、L1_MEM0、L1_MEM1、L2_MEM)に書き戻すことができる。各層の出力には専用のメモリ領域が用意されている。

For grading, the organizer uses the memory contents corresponding to each layer in the testfixture, and awards points according to how many layers pass.主辦單位評分時使用 testfixture 中各 Layer 所對應的記憶體資料來作為評分標準,並採用可通過的多少層級給予分數。採点では testfixture 内の各層に対応するメモリ内容を基準とし、何層まで正しく通過したかに応じて得点が与えられる。

The contest runs from 08:30 to 20:30.本次競賽比賽時間為上午 08:30 到下午 08:30。コンテストの実施時間は午前 8:30 から午後 8:30 までである。

After the contest ends, TSRI grades the entries according to the criteria in Section 3. To make grading easier, each team should attach the files listed in Appendix C. See Appendix A and Appendix B for the software environment and the design files.當 IC 設計競賽結束後,TSRI 會根據第 3 節中的評分標準進行評分。為了評分作業的方便,各參賽隊伍應參考附錄 C 中所列的要求,附上評分所需要的檔案。軟體環境及設計檔案說明請參考附錄 A 與附錄 B。コンテスト終了後、TSRI は第 3 節の採点基準に従って採点する。採点作業を円滑にするため、各チームは付録 C に挙げたファイルを添付すること。ソフトウェア環境と設計ファイルの説明は付録 A・付録 B を参照。

Figure 1: system architecture, input image through zero-padding, convolution, ReLU, max-pooling and flatten
Figure 1. System architecture of the image convolutional circuit圖 1. 圖像卷積電路系統架構図 1. 画像畳み込み回路のシステム構成

2. Design specification2. 設計規格2. 設計仕様

2.1 System block diagram2.1 系統方塊圖2.1 システムブロック図

Figure 2: block diagram of testfixture memories and CONV pipeline with all port names and widths
Figure 2. System block diagram圖 2. 系統方塊圖図 2. システムブロック図

2.2 I/O signals and memory description2.2 輸出入訊號和記憶體描述2.2 入出力信号とメモリの説明

Table 1. Input/output signals表一、輸入/輸出信號表 1. 入出力信号

Signal NameI/OWidthDescription說明説明
clkI1System clock. The design is synchronous to the rising edge of the clock.系統時脈訊號。本系統為同步於時脈正緣之同步設計。システムクロック。本設計はクロックの立ち上がりエッジに同期する。
resetI1Active-high asynchronous system reset.高位準「非」同步(active high asynchronous)之系統重置信號。ハイアクティブの非同期システムリセット。
readyI1Grayscale-image-ready indicator. When High, the grayscale image is ready and CONV may start sending addresses to the testfixture to fetch input pixels.灰階圖像準備完成指示訊號。當訊號為 High 時,表示灰階圖像準備完成,此時 CONV 才可以開始向 testfixture 發送輸入灰階圖像資料索取位址。グレースケール画像の準備完了を示す信号。High のとき画像の準備が完了しており、CONV は testfixture に入力画素のアドレスを送り始めてよい。
busyO1System busy indicator. When CONV sees ready High and is about to start, it must drive busy High to show that it is beginning to fetch the input image. After all processing is finished and the results have been written back to the testfixture, it must drive busy Low to signal completion.系統忙碌指示訊號。當 CONV 接收到 ready 訊號為 High,且 CONV 準備開始動作時,需將此訊號設為 High,表示準備開始進行輸入灰階圖像資料索取;待所有運算處理完成且輸出結果寫回 testfixture 後,需再將訊號設為 Low 表示動作結束。システムビジー信号。CONV が ready の High を受け取り動作を開始するとき、この信号を High にして入力画像の取得開始を示す。すべての処理が完了し結果を testfixture に書き戻した後、Low に戻して動作終了を示す。
iaddrO12Input image address. Selects which grayscale pixel to fetch.輸入灰階圖像位址訊號。指示欲索取哪個灰階圖像像素(pixel)資料的位址。入力画像アドレス。取得したいグレースケール画素のアドレスを示す。
idataI20Input pixel data: a signed number with 4 integer bits (MSB) and 16 fraction bits (LSB). The testfixture returns the pixel at the address given by iaddr on this signal.輸入灰階圖像像素資料訊號,由 4 bits 整數(MSB)加上 16 bits 小數(LSB)組成,為有號數。testfixture 將 iaddr 所指示的位址之像素資料用此訊號送給 CONV。入力画素データ。整数 4 ビット(MSB)+小数 16 ビット(LSB)の符号付き数。testfixture は iaddr で指定されたアドレスの画素をこの信号で CONV に送る。
crdO1Output-memory read enable. If High at a rising clock edge, a read is performed: the testfixture places the data at caddr_rd on cdata_rd.CONV 運算輸出記憶體讀取致能訊號。當時脈正緣觸發時,若此訊號為 High,表示要進行讀取動作。testfixture 會將 caddr_rd 位址指示之資料讀取到 cdata_rd 上。出力メモリの読み出しイネーブル。クロック立ち上がり時に High なら読み出しを行い、testfixture は caddr_rd のデータを cdata_rd に出力する。
cdata_rdI20Output-memory read data: signed, 4 integer bits (MSB) + 16 fraction bits (LSB). The testfixture sends memory contents to CONV on this signal.CONV 運算結果記憶體讀取訊號,由 4 bits 整數(MSB)加上 16 bits 小數(LSB)組成,為有號數。Testfixture 將記憶體資料傳送至 CONV 電路。出力メモリの読み出しデータ。整数 4 ビット(MSB)+小数 16 ビット(LSB)の符号付き数。testfixture がメモリ内容を CONV に送る。
caddr_rdO12Output-memory read address. Selects which address of the layer's result memory in the testfixture to read.CONV 運算結果記憶體讀取位址。CONV 電路各層的運算結果利用此訊號指示將要讀取 testfixture 中所內建各層輸出結果之記憶體的哪個位址。出力メモリの読み出しアドレス。testfixture 内の各層結果メモリのどのアドレスを読むかを示す。
cwrO1Output-memory write enable. If High at a rising clock edge, a write is performed: the testfixture stores cdata_wr at caddr_wr.CONV 運算輸出記憶體寫入致能訊號。當時脈正緣觸發時,若此訊號為 High,表示要進行寫入動作。testfixture 會將 cdata_wr 內容寫到 caddr_wr 所指示之位址。出力メモリの書き込みイネーブル。クロック立ち上がり時に High なら書き込みを行い、testfixture は cdata_wr を caddr_wr のアドレスに格納する。
cdata_wrO20Output-memory write data: signed, 4 integer bits (MSB) + 16 fraction bits (LSB). CONV outputs each layer's results to the testfixture on this signal.CONV 運算結果記憶體寫出訊號,由 4 bits 整數(MSB)加上 16 bits 小數(LSB)組成,為有號數。CONV 電路各層的運算結果利用此訊號輸出至 testfixture。出力メモリの書き込みデータ。整数 4 ビット(MSB)+小数 16 ビット(LSB)の符号付き数。CONV は各層の結果をこの信号で testfixture に出力する。
caddr_wrO12Output-memory write address. Selects which address of the layer's result memory in the testfixture to write.CONV 運算結果記憶體寫入位址。CONV 電路各層的運算結果利用此訊號指示將要寫入到 testfixture 中所內建各層輸出結果之記憶體的哪個位址。出力メモリの書き込みアドレス。testfixture 内の各層結果メモリのどのアドレスに書くかを示す。
cselO3Memory select for result write/read. Indicates which layer's result memory is being written or read:CONV 運算處理結果寫入/讀取記憶體選擇訊號。此訊號指示目前寫入/讀取資料為 CONV 電路中哪一層的運算結果。說明如下:結果の書き込み/読み出し先メモリの選択信号。どの層の結果メモリを対象にしているかを示す。
3'b000No memory selected.表示沒有選擇記憶體。メモリを選択しない。
3'b001Layer 0, Kernel 0 convolution result (L0_MEM0).寫入/讀取 Layer 0,Kernel 0 執行 Convolutional 的結果。(L0_MEM0)Layer 0、Kernel 0 の畳み込み結果(L0_MEM0)。
3'b010Layer 0, Kernel 1 convolution result (L0_MEM1).寫入/讀取 Layer 0,Kernel 1 執行 Convolutional 的結果。(L0_MEM1)Layer 0、Kernel 1 の畳み込み結果(L0_MEM1)。
3'b011Layer 1, max-pooling of the Kernel 0 convolution result (L1_MEM0).寫入/讀取 Layer 1,將 Kernel 0 執行 Convolutional 後再進行 Max-pooling 運算的結果。(L1_MEM0)Layer 1、Kernel 0 の畳み込み結果に最大プーリングを行った結果(L1_MEM0)。
3'b100Layer 1, max-pooling of the Kernel 1 convolution result (L1_MEM1).寫入/讀取 Layer 1,將 Kernel 1 執行 Convolutional 後再進行 Max-pooling 運算的結果。(L1_MEM1)Layer 1、Kernel 1 の畳み込み結果に最大プーリングを行った結果(L1_MEM1)。
3'b101Layer 2, flatten result (L2_MEM).表示寫入/讀取 Layer 2,Flatten 層的運算結果。(L2_MEM)Layer 2、フラット化の結果(L2_MEM)。

2.3 System function, timing and memory mapping2.3 系統功能、時序及記憶體對應方式描述2.3 システム機能・タイミング・メモリ対応

The block diagram is shown in Figure 2. After reset is released, the testfixture drives ready High to indicate that the grayscale image and the kernel data for every layer are ready. CONV must then drive busy High to start (t1 in Figure 3). When the testfixture sees busy High it drives ready Low and waits for CONV to carry out the required operations (t2 in Figure 3). Once all required layers have been completed, or as many layers as the design implements, CONV drives busy Low again to signal that everything is done (t3 in Figure 3). The testfixture then prepares the next grayscale image and sets ready High again. As soon as the testfixture sees busy go Low it immediately verifies the data, so for each input image busy may be set High only once when CONV starts and Low only once when CONV finishes. While busy is High, CONV may read and write L0_MEM0, L0_MEM1, L1_MEM0, L1_MEM1 and L2_MEM any number of times.系統方塊圖如圖 2 所示。當 reset 啟動結束後,testfixture 會將 ready 訊號設為 High 表示灰階圖像資料及各層 Kernel 資料都已經準備完畢,接著 CONV 電路須將 busy 訊號設為 High 表示開始動作(如圖 3. t1 時間點),而 testfixture 偵測到 busy 訊號為 High 後就會將 ready 訊號設為 Low 表示等待 CONV 電路處理題目所要求的動作(如圖 3. t2 時間點)。待各層所要求的動作都實現完成或已經將欲實現的 Layer 動作處理完成後,CONV 電路就可將 busy 訊號再次設為 Low 表示所有動作已經完成(如圖 3. t3 時間點),此時 testfixture 就會準備下一張灰階圖像並將 ready 訊號設定為 High;並且 testfixture 一偵測到 busy 訊號再次被設定為 Low 就會立刻進行資料驗證比對,因此針對每一張輸入灰階圖像的運算處理,busy 訊號只允許在 CONV 電路開始動作時被設定為 High 一次,CONV 運算處理結束時設定為 Low 一次。在 busy 為 High 的過程中,CONV 電路可重複不限次數對 L0_MEM0、L0_MEM1、L1_MEM0、L1_MEM1 及 L2_MEM 進行讀取及寫入動作。ブロック図を図 2 に示す。reset が解除されると、testfixture は ready を High にしてグレースケール画像と各層のカーネルデータの準備完了を示す。続いて CONV は busy を High にして動作開始を示す(図 3 の t1)。testfixture は busy の High を検出すると ready を Low にし、CONV が要求された処理を行うのを待つ(図 3 の t2)。各層の処理がすべて完了するか、実装した層の処理が終わったら、CONV は busy を再び Low にしてすべての動作の完了を示す(図 3 の t3)。testfixture は次の画像を用意して ready を再び High にする。testfixture は busy が Low になった瞬間にデータの照合を開始するため、1 枚の入力画像に対して busy は開始時に 1 回だけ High、終了時に 1 回だけ Low にすることが許される。busy が High の間、CONV は L0_MEM0、L0_MEM1、L1_MEM0、L1_MEM1、L2_MEM を何度でも読み書きできる。

Figure 3: start and end timing of clk, reset, ready and busy with markers t1, t2, t3
Figure 3. System start and end timing圖 3. 系統啟動及結束時序図 3. システムの開始・終了タイミング

Only one grayscale image is currently provided for testing; the organizer may add more sample images when grading.本題目前只提供一張灰階圖像作為測試驗證,評分時將視情況決定是否增加灰階圖像樣本數進行測試。現在テスト用に提供されるグレースケール画像は 1 枚のみであるが、採点時には必要に応じてサンプル画像を追加する場合がある。

The operation of each layer of CONV is described below; the overall flow is shown in Figure 4.關於 CONV 電路各層之動作說明如下,整體流程如圖 4 所示:CONV 各層の動作を以下に説明する。全体の流れは図 4 のとおりである。

Figure 4: CONV system flow from 64x64 input through two kernels, ReLU, max-pooling and flatten
Figure 4. CONV system flow圖 4. CONV 電路系統流程圖図 4. CONV 回路の処理フロー
  1. Input image. The input grayscale image is 64 × 64 pixels and is stored in the testfixture's memory. The mapping between pixels and memory is shown in Figure 6. In terms of timing, CONV sends the address of the pixel it wants on iaddr (t1 in Figure 5), and after each falling clock edge the testfixture returns that pixel on idata (t2 in Figure 5).Input image 為本題輸入灰階圖像,其尺寸為 64 pixels(寬) x 64 pixels(高),存放於 testfixture 的記憶體中,灰階圖像各 pixels 與其記憶體的對應方式如下圖 6 說明。動作時序上,CONV 電路需利用 iaddr 發送欲索取圖像資料的位址到 testfixture(如圖 5. t1 時間點),testfixture 在每個時脈負緣後會將 iaddr 所指示位址之 pixel 資料利用 idata 送入 CONV 電路(如圖 5. t2 時間點)。入力画像。入力グレースケール画像は 64 × 64 ピクセルで、testfixture のメモリに格納されている。画素とメモリの対応を図 6 に示す。タイミングとしては、CONV が取得したい画素のアドレスを iaddr で送ると(図 5 の t1)、testfixture はクロックの立ち下がりエッジの後にその画素を idata で返す(図 5 の t2)。

    Figure 5: input image memory timing; iaddr issued at t1, idata returned after the falling clock edge at t2
    Figure 5. Input image memory timing圖 5. 灰階圖像資料記憶體時序図 5. 入力画像メモリのタイミング
    Figure 6: mapping between the 4096-entry 20-bit input memory and the 64x64 grayscale image
    Figure 6. Input grayscale image and its memory mapping圖 6. 輸入灰階圖像及其記憶體對應方式図 6. 入力グレースケール画像とメモリの対応
  2. Layer 0 zero-pads the input image, convolves it with Kernel 0 and Kernel 1 to get two 64 × 64 images, and then applies ReLU to every pixel of both images to produce the Layer 0 result.Layer 0 層所要進行的動作是將 input image 進行 Zero-padding 處理後,再分別與 Kernel 0 及 Kernel 1 作 Convolutional 運算處理後得到 2 張尺寸皆為 64 pixels(寬) x 64 pixels(高)的圖,再將這兩張圖的每個 pixels 分別進行 ReLU 運算後得到 Layer 0 的結果。Layer 0 は入力画像にゼロパディングを施し、Kernel 0 と Kernel 1 でそれぞれ畳み込んで 64 × 64 の画像を 2 枚得た後、両画像の各画素に ReLU を適用して Layer 0 の結果とする。

    A. Convolutional

    The convolution moves the 3×3 kernel across the image one pixel at a time, starting at the top-left corner (red box in Figure 7). Each image pixel is multiplied by the corresponding kernel entry and the products are summed: 1×2 + 2×0 + 3×1 + 0×0 + 1×1 + 2×2 + 3×1 + 0×0 + 1×3 = 16. The kernel then moves one step right (green box in Figure 7) and the same computation gives 18, and so on left to right, top to bottom (light-blue box in Figure 7) until every position has been computed, giving the convolution result (middle of Figure 7). Finally a bias is added to every pixel to produce the final convolution output (rightmost block in Figure 7).本題規定之 Convolutional 處理為針對待處理圖像以固定移動 1 pixel 的間隔,將 3x3 大小的 Kernel 疊到待處理圖上左上角,如圖 7 紅色框為例,圖中每一個 pixel 都跟對應到 Kernel 上面的每個 pixel 相乘,最後全部相加,得到 1x2 + 2x0 + 3x1 + 0x0 + 1x1 + 2x2 + 3x1 + 0x0 + 1x3 = 16,接著 Kernel 往右移動一格,如圖 7 綠色框為例,並做相同的運算得到結果為 18,依此類推依序由左到右,由上到下移動(如圖 7 淺藍色框)計算到所有 pixels 乘積後可得 Convolutional 結果(如圖 7 中間所示)。最後每個 pixel 還要再各自加上 bias 值後才是 Convolutional 運算的最後輸出(如圖 7 最右邊區塊)。畳み込みでは 3×3 のカーネルを画像の左上から 1 画素ずつ移動させる(図 7 の赤枠)。画像の各画素を対応するカーネルの値と掛け合わせ、すべてを足し合わせて 1×2 + 2×0 + 3×1 + 0×0 + 1×1 + 2×2 + 3×1 + 0×0 + 1×3 = 16 を得る。次にカーネルを右に 1 つ移動し(図 7 の緑枠)同じ計算で 18 を得る。以降、左から右、上から下へ(図 7 の水色枠)すべての位置を計算すると畳み込み結果が得られる(図 7 中央)。最後に各画素にバイアスを加えたものが畳み込みの最終出力である(図 7 右端のブロック)。

    Kernel 0 and Kernel 1 are given in Figure 8 and Figure 9. The bias for Kernel 0 is 0.07446326 (decimal) = 0x01310 (hex, 4 integer bits + 16 fraction bits); the bias for Kernel 1 is −0.55241907 (decimal) = 0xF7295 (hex, 4 integer bits + 16 fraction bits).本題給定之 Kernel 0 及 Kernel 1 分別如圖 8 及圖 9 所示,Kernel 0 所對應的 bias 值為 0.07446326 (10 進制) = 0x01310 (16 進制, 4 bits 整數 + 16 bits 小數);Kernel 1 所對應的 bias 值為 -0.55241907 (10 進制) = 0xF7295 (16 進制, 4 bits 整數 + 16 bits 小數)。Kernel 0 と Kernel 1 を図 8・図 9 に示す。Kernel 0 のバイアスは 0.07446326(10 進)= 0x01310(16 進、整数 4 ビット+小数 16 ビット)、Kernel 1 のバイアスは −0.55241907(10 進)= 0xF7295(16 進、整数 4 ビット+小数 16 ビット)である。

    Figure 7: convolution example on a 5x5 image with a 3x3 kernel, result and bias addition
    Figure 7. Convolution example圖 7. Convolutional 運算範例図 7. 畳み込みの計算例
    Figure 8: Kernel 0 and Kernel 1 values in decimal
    Figure 8. Kernel 0 and Kernel 1 (decimal)圖 8. 本題給定 Kernel 0 和 Kernel 1 (10 進制)図 8. Kernel 0 と Kernel 1(10 進)
    Figure 9: Kernel 0 and Kernel 1 values in 20-bit fixed-point hex
    Figure 9. Kernel 0 and Kernel 1 (hex, 4 integer bits + 16 fraction bits)圖 9. 本題給定 Kernel 0 和 Kernel 1 (16 進制) (4 bits 整數 + 16 bits 小數)図 9. Kernel 0 と Kernel 1(16 進、整数 4 ビット+小数 16 ビット)

    Kernel and bias values (copyable):Kernel 與 bias 數值(可複製):カーネルとバイアスの値(コピー可):

    Kernel 0 (decimal10 進制10 進)
    0.6586740.5735720.42681
    0.0625617-0.439696-0.569037
    -0.34829-0.217964-0.327755
    bias = 0.07446326
    Kernel 1 (decimal10 進制10 進)
    -0.1432470.162391-0.212595
    0.316370.1840820.125697
    0.23376-0.174190.368789
    bias = -0.55241907
    Kernel 0 (hex, 4.16 fixed-point16 進制,4.16 定點數16 進、4.16 固定小数点)
    0A89E092D506D43
    01004F8F71F6E54
    FA6D7FC834FAC19
    bias = 01310
    Kernel 1 (hex, 4.16 fixed-point16 進制,4.16 定點數16 進、4.16 固定小数点)
    FDB5502992FC994
    050FD02F200202D
    03BD7FD36905E68
    bias = F7295

    B. Zero-padding

    As the example in Figure 7 shows, convolution shrinks the image. Padding before the convolution keeps the size unchanged. This problem requires the image to be padded with a 1-pixel border of zeros. Figure 10 shows an example of zero-padding by one pixel followed by convolution.如圖 7 範例所示,Convolutional 處理之結果會讓圖片尺寸縮小;但若在 Convolutional 處理前先進行填補(padding)就可讓圖片尺寸維持相同,本題規定須將待處理圖像周圍填補 1 pixel 的 0。如圖 10 所示為先做 zero-padding 補 1 pixel 後進行 Convolutional 處理的例子。図 7 の例のように、畳み込みを行うと画像は小さくなる。畳み込みの前にパディングを行えばサイズを保てる。本問題では画像の周囲に 1 画素分の 0 を詰めることを規定する。図 10 に 1 画素のゼロパディング後に畳み込みを行った例を示す。

    Figure 10: zero-padding example; a 4x4 image padded to 6x6, convolved with a 3x3 kernel, giving a 4x4 output
    Figure 10. Zero-padding example圖 10. Zero-padding 運算範例図 10. ゼロパディングの例

    C. ReLU

    ReLU (Rectified Linear Unit) is defined by the formula below: if the input pixel value x is less than or equal to 0, the output y is 0; if x is greater than 0, y stays x. Every pixel of the convolution output must pass through ReLU to become the final Layer 0 result.ReLU (Rectified Linear Unit) 可以下算式表示,如果輸入 pixel 的值 x 小於或等於 0 則此 pixel 的值須調整成 y 為 0;但如果輸入 pixel 的值 x 大於 0 則此 pixel 的值仍為 x。Convolutional 處理後的每一個 pixel 的值都要經過 ReLU 運算後方為 Layer 0 的最終結果。ReLU(Rectified Linear Unit)は次式で表される。入力画素の値 x が 0 以下なら出力 y は 0、x が 0 より大きければ y は x のままである。畳み込み後のすべての画素に ReLU を適用したものが Layer 0 の最終結果となる。

    y = {x(x > 0)0(x ≤ 0)

    D. CONV must write the two Layer 0 images back to the testfixture memories, using caddr_wr for the address and cdata_wr for the data. Each image has its own memory, so csel must be set to 3'b001 (Kernel 0) or 3'b010 (Kernel 1) to enable the corresponding memory. The mapping between the output image and memory is shown in Figure 11: csel=3'b001 accesses L0_MEM0 and csel=3'b010 accesses L0_MEM1.D. CONV 電路須將 Layer 0 的結果共 2 張圖,分別用 caddr_wr 指定寫回 testfixture 記憶體的位址,運算結果資料用 cdata_wr 送到 testfixture,每張圖有各自獨立記憶體因此須設定 csel 為 3'b001(經 Kernel 0)及 3'b010(經 Kernel 1)來啟動各自的記憶體。其輸出圖與記憶體的對應方式如圖 11 所示。其中 csel=3'b001 所讀寫的記憶體為 L0_MEM0;csel=3'b010 所讀寫的記憶體為 L0_MEM1。D. CONV は Layer 0 の 2 枚の画像を、caddr_wr でアドレスを指定し cdata_wr でデータを送って testfixture のメモリに書き戻す。画像ごとに独立したメモリがあるため、csel を 3'b001(Kernel 0)または 3'b010(Kernel 1)に設定して対応するメモリを有効にする。出力画像とメモリの対応を図 11 に示す。csel=3'b001 は L0_MEM0、csel=3'b010 は L0_MEM1 にアクセスする。

    L0_MEM0 and L0_MEM1 are 20 bits wide (4 integer bits + 16 fraction bits). The true Layer 0 result may exceed 20 bits; contestants must keep 4 integer bits and 16 fraction bits and round using the 17th fraction bit (round half up) before writing the output.以上 L0_MEM0 及 L0_MEM1 之資料寬度 20 bits,且為 4 bits 整數 + 16 bits 小數,Layer 0 實際計算結果可能大於 20 bits,參賽者須取整數 4 bits 及小數點後 16 bits 之後做進位(第 17 個 bit 做四捨五入)作為輸出。L0_MEM0 と L0_MEM1 のデータ幅は 20 ビット(整数 4 ビット+小数 16 ビット)である。Layer 0 の実際の計算結果は 20 ビットを超えることがあるため、整数 4 ビットと小数 16 ビットを取り、小数第 17 ビットで四捨五入したものを出力すること。
    Figure 11: mapping of the 64x64 convolution result to the 4096-entry L0_MEM0 / L0_MEM1
    Figure 11. Mapping between L0_MEM0/L0_MEM1 and the convolution result圖 11. L0_MEM0/L0_MEM1 與 convolutional 結果對應方式図 11. L0_MEM0/L0_MEM1 と畳み込み結果の対応
  3. Layer 1 performs max-pooling, which shrinks the image horizontally and vertically. As shown below, each 2 × 2 block of pixels is merged into one element, so the result is half the size of the input.Layer 1 層要進行 max-pooling 運算,最大池化層(max-pooling)是縮小水平及垂直空間的運算,本題規定以如下圖所示將 2 pixels(寬) X 2 pixels(高)的範圍整合成一元素,縮小空間大小。因此經 max-pooling 後的結果圖之尺寸只會有輸入圖尺寸的 1/2。Layer 1 は最大プーリングを行う。最大プーリングは画像を水平・垂直方向に縮小する演算で、下図のように 2 × 2 画素の範囲を 1 要素にまとめるため、結果は入力の 1/2 のサイズになる。

    The two 64 × 64 images from Layer 0 are each max-pooled into a 32 × 32 image, as shown in Figure 12. The window is 2×2 with a stride of 2, scanned left to right and top to bottom; the maximum of each 2×2 block is the output. The top-left block in Figure 12 (yellow) gives max(5, 7, 0, 1) = 7; moving the window two steps right (light blue) gives max(7, 3, 2, 3) = 7, and so on.將 Layer 0 輸出的 2 張 64 pixels(寬) x 64 pixels(高)的圖,各自經 max-pooling 運算後輸出 2 張 32 pixels(寬) x 32 pixels(高)的結果圖,max-pooling 的過程如圖 12 所示。本題規定 max-pooling 視窗大小為 2x2,將輸入 Layer 1 的目標圖像依序由左到右,由上到下,步幅(stride)為 2,依序取 2x2 大小的 pixels,取最大值為其輸出,因此圖 12 左上角的 2x2 pixels(黃色區域)為 max(5, 7, 0, 1),因此結果為最大值 7;接著往右移動 2 格視窗(淺藍色區域)計算 max(7,3,2,3) 得最大值為 7,其餘依此類推。Layer 0 が出力した 64 × 64 の画像 2 枚をそれぞれ最大プーリングして 32 × 32 の画像 2 枚を出力する(図 12)。ウィンドウは 2×2、ストライド 2 で、左から右、上から下へ走査し、各 2×2 ブロックの最大値を出力とする。図 12 左上のブロック(黄色)は max(5, 7, 0, 1) = 7、ウィンドウを右に 2 つ移動したブロック(水色)は max(7, 3, 2, 3) = 7 となり、以下同様である。

    Figure 12: 2x2 stride-2 max-pooling example on a 6x6 image producing a 3x3 result
    Figure 12. Max-pooling example圖 12. max-pooling 運算說明範例図 12. 最大プーリングの例

    The two max-pooled images are written back to the testfixture using caddr for the address and cdata for the data. Each image has its own memory, so csel must be set to 3'b011 (Kernel 0) or 3'b100 (Kernel 1). The mapping is shown in Figure 13: csel=3'b011 accesses L1_MEM0 and csel=3'b100 accesses L1_MEM1.max-pooling 後的 2 張結果圖結果分別用 caddr 指定寫回 testfixture 記憶體的位址,運算結果資料用 cdata 送到 testfixture,每張圖有各自獨立記憶體因此須設定 csel 為 3'b011(經 Kernel 0)及 3'b100(經 Kernel 1)來啟動各自的記憶體。其輸出圖與記憶體的對應方式如圖 13 所示。其中 csel=3'b011 所讀寫的記憶體為 L1_MEM0;csel=3'b100 所讀寫的記憶體為 L1_MEM1。最大プーリング後の 2 枚の画像は、caddr でアドレスを指定し cdata でデータを送って testfixture に書き戻す。画像ごとに独立したメモリがあるため、csel を 3'b011(Kernel 0)または 3'b100(Kernel 1)に設定する。対応を図 13 に示す。csel=3'b011 は L1_MEM0、csel=3'b100 は L1_MEM1 にアクセスする。

    Figure 13: mapping of the 32x32 max-pooling result to the 1024-entry L1_MEM0 / L1_MEM1
    Figure 13. Mapping between L1_MEM0/L1_MEM1 and the max-pooling result圖 13. L1_MEM0/L1_MEM1 與 max-pooling 結果對應方式図 13. L1_MEM0/L1_MEM1 と最大プーリング結果の対応
  4. Layer 2 is the flatten operation. The two 32×32 images from Layer 1 are arranged into one data vector of 2048 pixels, in "Kernel 0 → Kernel 1" order and pixel by pixel (see Figure 14). With csel set to 3'b101, caddr addresses L2_MEM and the 2048 values are written to the testfixture on cdata starting from address 0.Layer 2 則是平坦化(flatten)運算。將 Layer 1 的輸出結果共 2 張 32x32 pixels 結果圖依序「Kernel 0 → Kernel 1」及「pixels 累加」排列成一長度為 2048 筆的 pixels 的資料向量(如下圖 14 所示),再利用 csel 設定為 3'b101,用 caddr 指定 L2_MEM 的位址,由位址 0 開始依序將 2048 筆資料用 cdata 送出寫到 testfixture。Layer 2 はフラット化の演算である。Layer 1 が出力した 32×32 の画像 2 枚を「Kernel 0 → Kernel 1」の順で画素ごとに並べ、長さ 2048 のデータベクトルにする(図 14 参照)。csel を 3'b101 に設定し、caddr で L2_MEM のアドレスを指定して、アドレス 0 から 2048 個のデータを cdata で順に testfixture に書き込む。

    Figure 14: flatten order; kernel 0 and kernel 1 pooled results interleaved pixel by pixel into L2_MEM
    Figure 14. Flatten example圖 14. Flatten 方式範例図 14. フラット化の例
    Reading from Figure 14: the L2_MEM order is interleaved per pixel, i.e. L2_MEM[2k] = L1_MEM0[k] and L2_MEM[2k+1] = L1_MEM1[k] for k = 0 … 1023.由圖 14 可知,L2_MEM 的順序是逐像素交錯:L2_MEM[2k] = L1_MEM0[k]、L2_MEM[2k+1] = L1_MEM1[k],k = 0 … 1023。図 14 から読み取れるとおり、L2_MEM の順序は画素ごとに交互である。すなわち k = 0 … 1023 について L2_MEM[2k] = L1_MEM0[k]、L2_MEM[2k+1] = L1_MEM1[k] となる。
Note: L0_MEM0, L0_MEM1, L1_MEM0, L1_MEM1 and L2_MEM are all 20 bits wide (4 integer bits as MSB + 16 fraction bits as LSB).特別注意:以上所述之 L0_MEM0、L0_MEM1、L1_MEM0、L1_MEM1 及 L2_MEM 之記憶體寬度皆為 20 bits(由 4 bits 整數(MSB)加上 16 bits 小數(LSB)組成)。注意:上記の L0_MEM0、L0_MEM1、L1_MEM0、L1_MEM1、L2_MEM のメモリ幅はいずれも 20 ビット(整数 4 ビット(MSB)+小数 16 ビット(LSB))である。

2.4 Access timing of L0_MEM0, L0_MEM1, L1_MEM0, L1_MEM1 and L2_MEM2.4 L0_MEM0、L0_MEM1、L1_MEM0、L1_MEM1 及 L2_MEM 之動作時序2.4 L0_MEM0、L0_MEM1、L1_MEM0、L1_MEM1、L2_MEM の動作タイミング

The output memories L0_MEM0, L0_MEM1, L1_MEM0, L1_MEM1 and L2_MEM are all RAM models with identical control and timing, and all support both write and read. Different csel values enable the memory of the corresponding layer; cwr is the write enable and crd is the read enable.各層輸出資料記憶體 L0_MEM0、L0_MEM1、L1_MEM0、L1_MEM1 及 L2_MEM 皆為 RAM model 且控制方式及時序皆相同,都可進行寫入及讀取動作。採用不同的 csel 設定值啟動各層輸出相對應的記憶體,使用 cwr 作為寫入致能訊號,crd 作為讀取致能訊號。各層の出力メモリ L0_MEM0、L0_MEM1、L1_MEM0、L1_MEM1、L2_MEM はいずれも RAM モデルで、制御方式とタイミングは同一であり、書き込みと読み出しの両方が可能である。csel の値で対応する層のメモリを有効にし、cwr を書き込みイネーブル、crd を読み出しイネーブルとして使う。

Read: caddr_rd is the address and cdata_rd is the read data. As Figure 15 shows, if crd is High at a falling clock edge, the data at caddr_rd appears on cdata_rd immediately after that edge (t1 in Figure 15).讀取時,使用 caddr_rd 為記憶體位址,cdata_rd 作為讀取資料訊號。動作時序如下圖 15 說明,當時脈負緣觸發時若 crd 為 High,則會在觸發後立刻將 caddr_rd 所指示位址的資料讀取到 cdata_rd 上(如圖 15. t1 時間點)。読み出し:caddr_rd をアドレス、cdata_rd を読み出しデータとして使う。図 15 のように、クロックの立ち下がりエッジで crd が High なら、その直後に caddr_rd のアドレスのデータが cdata_rd に現れる(図 15 の t1)。

Write: caddr_wr is the address and cdata_wr is the write data. As Figure 16 shows, if cwr is High at a rising clock edge, the value on cdata_wr is written to the address on caddr_wr (t1 in Figure 16).寫入時,使用 caddr_wr 為記憶體位址,cdata_wr 作為寫入資料訊號。動作時序如下圖 16 說明,當時脈正緣觸發時若 cwr 為 High,則會將這時 cdata_wr 的資料寫入到 caddr_wr 所指示位址上(如圖 16. t1 時間點)。書き込み:caddr_wr をアドレス、cdata_wr を書き込みデータとして使う。図 16 のように、クロックの立ち上がりエッジで cwr が High なら、そのときの cdata_wr の値が caddr_wr のアドレスに書き込まれる(図 16 の t1)。

Figure 15: memory read timing; data appears on cdata_rd right after the falling edge when crd is high
Figure 15. Read timing of L0_MEM0, L0_MEM1, L1_MEM0, L1_MEM1 and L2_MEM圖 15. 輸出資料記憶體 L0_MEM0、L0_MEM1、L1_MEM0、L1_MEM1 及 L2_MEM 讀取動作時序圖図 15. L0_MEM0、L0_MEM1、L1_MEM0、L1_MEM1、L2_MEM の読み出しタイミング
Figure 16: memory write timing; cdata_wr is written at the rising edge when cwr is high
Figure 16. Write timing of L0_MEM0, L0_MEM1, L1_MEM0, L1_MEM1 and L2_MEM圖 16. 輸出資料記憶體 L0_MEM0、L0_MEM1、L1_MEM0、L1_MEM1 及 L2_MEM 寫入動作時序圖図 16. L0_MEM0、L0_MEM1、L1_MEM0、L1_MEM1、L2_MEM の書き込みタイミング

3. Grading criteria3. 評分標準3. 採点基準

The graders run RTL simulation or gate-level simulation at the system clock supplied by the contestant to verify correctness. At the clock they define, teams must ensure that the outputs have no setup/hold problems and match the organizer's reference results exactly.主辦單位的評分人員將依照參賽者提供之系統時脈進行 RTL simulation 或 Gate-level simulation,以驗證設計正確性。各參賽隊伍應於參賽者定義的系統時脈下,確保輸出結果無設置與保持時間(setup/hold time)的問題,並完全符合主辦單位所提供的標準設計結果。採点者は参加者が指定したシステムクロックで RTL シミュレーションまたはゲートレベル・シミュレーションを行い、設計の正しさを検証する。各チームは自ら定義したクロックにおいて、出力にセットアップ/ホールドの問題がなく、主催者の基準結果と完全に一致することを保証しなければならない。

Grading item: area評分項目:依「面積」(Area)大小評分採点項目:面積(Area)による評価

After synthesis, the cell area can be obtained with the following commands:各參賽隊伍完成電路合成後,Cell Area 可利用以下指令產生而得知:合成完了後、セル面積は次のコマンドで得られる。

# Design Compiler
report_qor > CONV.qor
# RTL Compiler
report qor > CONV.qor

Graders record the area from CONV.qor as in the example below, e.g. Area = 89727 (rounded to the nearest integer).評分人員會以此 CONV.qor 如下面範例,紀錄成 Area = 89727 (以小數點後做四捨五入)做評分。採点者は下の例のように CONV.qor から Area = 89727(小数点以下を四捨五入)として記録し、採点に用いる。

Sample QoR report with the Cell Area line 89727.959807 highlighted
Sample CONV.qor (the Cell Area line is used for grading)CONV.qor 範例 (Cell Area 列為評分依據)CONV.qor の例(Cell Area の行が採点対象)

Grading method and tiers評分方法及標準採点方法とランク

Entries are classified by completeness into seven tiers, S, A+, A−, B+, B−, C+ and C−, ranked S > A+ > A− > B+ > B− > C+ > C−. Points are awarded according to how complete the design is.評分方式會依設計完成程度,分成 S、A+、A-、B+、B-、C+、C-,共七種等級,排名順序為 S > A+ > A- > B+ > B- > C+ > C-。主辦單位將根據設計內容的完成度給予記分。設計の完成度に応じて S、A+、A−、B+、B−、C+、C− の 7 ランクに分類し、順位は S > A+ > A− > B+ > B− > C+ > C− である。主催者は設計内容の完成度に応じて得点を与える。

SLayers 0–2 fully correct in both RTL and gate-level simulation, and area below 270,000.Layer 0~2 的 RTL 與 Gate-level simulation 結果完全正確,且面積小於 270,000。Layer 0〜2 の RTL とゲートレベル・シミュレーションがすべて正しく、かつ面積が 270,000 未満。 A+Layers 0–2 fully correct in both RTL and gate-level simulation.Layer 0~2 的 RTL 與 Gate-level simulation 結果完全正確。Layer 0〜2 の RTL とゲートレベル・シミュレーションがすべて正しい。 A-Layers 0–2 fully correct in RTL simulation, but gate-level simulation fails.Layer 0~2 的 RTL simulation 結果完全正確;但 Gate-level simulation 驗證失敗。Layer 0〜2 の RTL シミュレーションは正しいが、ゲートレベル・シミュレーションが失敗。 B+Layers 0 and 1 fully correct in both RTL and gate-level simulation.Layer 0 和 1 的 RTL 與 Gate-level simulation 結果完全正確。Layer 0 と 1 の RTL とゲートレベル・シミュレーションが正しい。 B-Layers 0 and 1 fully correct in RTL simulation, but gate-level simulation fails.Layer 0 和 1 的 RTL simulation 結果完全正確;但 Gate-level simulation 驗證失敗。Layer 0 と 1 の RTL シミュレーションは正しいが、ゲートレベル・シミュレーションが失敗。 C+Layer 0 fully correct in both RTL and gate-level simulation.Layer 0 的 RTL 與 Gate-level simulation 結果完全正確。Layer 0 の RTL とゲートレベル・シミュレーションが正しい。 C-Layer 0 fully correct in RTL simulation, but gate-level simulation fails.Layer 0 的 RTL simulation 結果完全正確;但 Gate-level simulation 驗證失敗。Layer 0 の RTL シミュレーションは正しいが、ゲートレベル・シミュレーションが失敗。

Within the same tier, earlier submission ranks higher!同等級中,繳交時間越早者為同級名次越好!同じランク内では提出が早いほど上位になる。

Appendices附錄付録

  • Appendix A describes the software environment for the contest;附錄 A 中說明本次競賽之軟體環境;付録 A はコンテストのソフトウェア環境を説明する。
  • Appendix B describes the design files provided to each contestant;附錄 B 為主辦單位所提供各參賽者的設計檔說明;付録 B は主催者が各参加者に提供する設計ファイルの説明である。
  • Appendix C lists the files for grading, i.e. what contestants must submit;附錄 C 為評分用檔案,亦即參賽者必須繳交的檔案資料;付録 C は採点用ファイル、すなわち参加者が提出しなければならないファイルである。
  • Appendix D explains how to package the design files.附錄 D 則為設計檔整理步驟說明。付録 D は設計ファイルのまとめ方の手順を説明する。

Appendix A: Software environment附錄 A 軟體環境付録 A ソフトウェア環境

The design software environment provided for the contest is listed below. Grading uses the listed software as the reference.競賽所提供的設計軟體環境如下。驗證評分時,係以所列軟體作為驗證依據。コンテストで提供される設計ソフトウェア環境は以下のとおりである。検証・採点はここに挙げたソフトウェアを基準として行う。

Cell-based digital circuit design (graduate and undergraduate divisions):標準元件數位電路設計(含研究所及大學類):セルベース デジタル回路設計(大学院・学部部門共通):

HDL硬體描述語言ハードウェア記述言語Verilog, VHDL
Simulation電路模擬回路シミュレーションNC-Verilog (INCISIVE_15.20.039), ModelSim (V10.5c), QuestaSim (10.5c), VCS-MX (2017.03)
Debug電路除錯デバッグVerdi (2016.06-sp1-1), nLint (2016.06-sp1-1)
Synthesis電路合成論理合成Design Compiler (2017.09-sp2)
Cell library標準元件數位電路程式庫セルライブラリCell-Based Design Kit for IC Contest v2.1

Appendix B: Design files附錄 B 設計檔案說明付録 B 設計ファイルの説明

1. Table 2 lists the design files provided to each contestant:下表二為主辦單位所提供各參賽者的設計檔案:表 2 に主催者が各参加者に提供する設計ファイルを示す。

Table 2. Design files表二、設計檔表 2. 設計ファイル

File檔名ファイル名Description說明説明
testfixture.vTestbench. Defines the clock period and the stimulus and expected outputs.測試樣本檔。此測試樣本檔定義了時脈週期與測試樣本之輸入及預期輸出信號。テストベンチ。クロック周期とテストパターンの入力・期待出力を定義する。
CONV.vThe contestant's design file; the system I/O port declarations are already included.參賽者所使用的設計檔,已包含系統輸/出入埠之宣告参加者が使用する設計ファイル。システムの入出力ポート宣言を含む。
./dat_grad/cnn_sti.datTest stimulus測試樣本檔案テスト入力データ
./dat_grad/cnn_layer0_exp0.datLayer 0 expected result (Kernel 0)Layer 0 比對樣本檔案 (Kernel 0)Layer 0 の期待値(Kernel 0)
./dat_grad/cnn_layer0_exp1.datLayer 0 expected result (Kernel 1)Layer 0 比對樣本檔案 (Kernel 1)Layer 0 の期待値(Kernel 1)
./dat_grad/cnn_layer1_exp0.datLayer 1 expected result (Kernel 0)Layer 1 比對樣本檔案 (Kernel 0)Layer 1 の期待値(Kernel 0)
./dat_grad/cnn_layer1_exp1.datLayer 1 expected result (Kernel 1)Layer 1 比對樣本檔案 (Kernel 1)Layer 1 の期待値(Kernel 1)
./dat_grad/cnn_layer2_exp.datLayer 2 expected resultLayer 2 比對樣本檔案Layer 2 の期待値
report.000Report template結果報告範本レポートのひな形
CONV.sdcDesign Compiler synthesis constraints. Only the cycle may be modified; all other constraints must not be changed.Design Compiler 電路合成規範檔。本規範檔除了 cycle 可修改外,其餘 constraints 皆不可修改。Design Compiler の合成制約ファイル。cycle 以外の制約は変更してはならない。
tsmc13_neg.vCell library file for gate-level simulationGate-level simulation 所需要之 cell library fileゲートレベル・シミュレーション用のセルライブラリ
synopsys_dc.setupSample Design Compiler setup fileDesign Compiler 初始設定範例檔案Design Compiler 初期設定ファイルの例

2. Use CONV.v for the design. The Verilog module name and port declaration are as follows:請使用 CONV.v,進行本題電路之設計。其 Verilog 模組名稱、輸出/入埠宣告如下所示:設計には CONV.v を使用すること。Verilog のモジュール名とポート宣言は次のとおりである。

module CONV(
    input           clk,
    input           reset,
    output          busy,
    input           ready,

    output  [11:0]  iaddr,
    input   [19:0]  idata,

    output          cwr,
    output  [11:0]  caddr_wr,
    output  [19:0]  cdata_wr,

    output          crd,
    output  [11:0]  caddr_rd,
    input   [19:0]  cdata_rd,

    output  [2:0]   csel
    );
Original screenshot of the CONV module port declaration
CONV module declaration as shown in the original document原始文件中的 CONV 模組宣告元の文書に示された CONV モジュール宣言

3. The provided testbench contains a few extra special-purpose lines:本題所提供的 Testbench 檔案,有多增加幾行特別用途的敘述如下:提供されるテストベンチには、特別な用途の記述が数行追加されている。

`define SDFFILE   "./syn/CONV_syn.sdf"        // Modify your sdf file name

`ifdef SDF
    initial $sdf_annotate(`SDFFILE, CONV);
`endif

Notes:註:注:

  1. Change the SDF file name and path to your actual SDF file before simulating.SDF 檔案,請自行修改 SDF 實際檔案名稱及路徑後再模擬。SDF ファイルは実際のファイル名とパスに修正してからシミュレーションすること。
  2. The `ifdef SDF block lets the same testbench serve both RTL and post-synthesis simulation. For post-synthesis simulation you must add the +define+SDF option.在 Testbench 中,本題提供 `ifdef SDF 的描述,目的是讓 Testbench 可做為 RTL 模擬及合成後模擬皆可使用。當參賽者在合成後模擬時,請務必多加上一個參數 +define+SDF,方可順利模擬。テストベンチの `ifdef SDF 記述により、同じテストベンチを RTL シミュレーションと合成後シミュレーションの両方に使える。合成後シミュレーションでは必ず +define+SDF オプションを追加すること。
  3. Example gate-level simulation command after synthesis:合成後的 Gate-Level Simulation 模擬指令範例如下:合成後のゲートレベル・シミュレーションのコマンド例:
    ncverilog Testbench.v CONV_syn.v -v tsmc13_neg.v +define+SDF

4. One set of test patterns is provided; simulate as in the examples below. The organizer may use additional test patterns when grading.比賽共提供一組測試樣本,參賽者可依下面範例來進行模擬。主辦單位於評分時,將可能額外再使用其他組測試樣本進行評分工作。テストパターンは 1 組提供される。以下の例に従ってシミュレーションすること。採点時に主催者が別のテストパターンを追加で用いる場合がある。

RTL simulation:RTL Simulation 時使用指令如下:RTL シミュレーション:

# ncverilog
ncverilog Testbench.v CONV.v
# modelsim (compile step)
vlog Testbench.v

Gate-level simulation (adding SDF to the defines makes the testbench read the SDF timing of the gate-level netlist):Gate-Level Simulation 時使用指令如下 (define 中加上 SDF 可讓測試程式引入 gate level netlist 的 sdf 檔案資訊):ゲートレベル・シミュレーション(define に SDF を加えると、テストベンチがゲートレベル・ネットリストの SDF 情報を読み込む):

ncverilog Testbench.v CONV_syn.v -v tsmc13_neg.v +define+SDF

Appendix C: Files for grading附錄 C 評分用檔案付録 C 採点用ファイル

The files needed for grading fall into three parts: (1) the RTL design, i.e. the team's RTL code for this contest. If the design is modular with several files, all modules used must be written into CONV.v so that the graders can compile it; (2) the gate-level design, i.e. the gate-level netlist produced by the synthesis tool and the matching SDF file; (3) the report file: each team must write a report.000 file describing its design to help the organizer grade, in the format of Figure 17. (The last three digits of the report file name are the version; if updated files are submitted, the new report is named report.001, and so on.)評分所需檔案可分為三部份:(1) RTL design,即各參賽隊伍對該次競賽設計的 RTL code,若設計採模組化而有多個設計檔,請務必將使用到的各 module 檔寫進 CONV.v,以免評審進行評分時,無法進行編譯;(2) gate-level design,即由合成軟體所產生的 gate-level netlist,以及對應的 SDF 檔;(3) report file,參賽隊伍必須依照自己的設計內容,撰寫 report.000 檔,以方便主辦單位進行評分,report.000 的格式如圖 17 所示。(report 檔以後三碼序號表示版本,若繳交檔案更新版本,則新版的 report 檔的檔名為 report.001,依此類推)採点に必要なファイルは 3 つに分かれる。(1) RTL 設計:各チームのこのコンテスト向け RTL コード。モジュール化して複数ファイルになる場合は、使用するすべてのモジュールを CONV.v に書き込み、採点時にコンパイルできるようにすること。(2) ゲートレベル設計:合成ツールが生成したゲートレベル・ネットリストと対応する SDF ファイル。(3) レポートファイル:各チームは自分の設計内容に基づき、図 17 の形式で report.000 を作成して採点を容易にすること。(レポートファイル名の末尾 3 桁は版番号を表す。更新版を提出する場合、新しいレポートは report.001 のように命名する。)

Table 3. Files for grading表三、評分用檔案表 3. 採点用ファイル

Design StageFileDescription
RTL category
N/Areport.xxxdesign report
RTL Simulation*.v or *.vhdVerilog (or VHDL) synthesizable RTL code
Gate-Level category
Pre-layout
Gate-level
Simulation
*_syn.vVerilog gate-level netlist generated by Synopsys Design Compiler
*_syn.sdfSDF timing information generated by Synopsys Design Compiler
*_syn.ddcdesign database generated by Synopsys Design Compiler
Figure 17: report.000 template with FTP account, cell area, clock cycle time, simulator and file names
Figure 17. report.000 template圖 17. report.000 的範本図 17. report.000 のひな形

Appendix D: File upload附錄 D 檔案上傳付録 D ファイルのアップロード

All files listed in Appendix C must be submitted to TSRI, packed together in one folder as follows:所有包含於如附錄 C 中表格所示的檔案,均需要提交至 TSRI。並且,提交的設計檔案,需要經過壓縮於同一個資料夾下,步驟如下:付録 C の表に挙げたすべてのファイルを TSRI に提出すること。提出する設計ファイルは次の手順で 1 つのフォルダにまとめて圧縮する。

  1. Create a folder result_xxx, where "xxx" is the submission version: 000 for the first upload, 001 for the second, 002 for the third, and so on.建立一個 result_xxx 資料夾。其中「xxx」表示繳交版本。例如 000 表示為第一次上傳;001 表示為第二度上傳;002 表示為第三度上傳,以此類推。result_xxx というフォルダを作る。「xxx」は提出の版番号で、初回は 000、2 回目は 001、3 回目は 002 のようにする。
  2. Copy all files listed in Appendix C into result_xxx.參考附錄 C 評分用檔案,將所有繳交檔案複製到 result_xxx 資料夾。付録 C の採点用ファイルをすべて result_xxx にコピーする。
  3. Pack the folder with tar as in the example below (xxx is the version). This produces result_xxx.tar.執行 tar 指令將 result_xxx 資料夾包裝起來,tar 的指令範例如下 (其中 xxx 表示繳交版本)。執行完後應該會得到 result_xxx.tar 的檔案。次の例のように tar でフォルダをまとめる(xxx は版番号)。実行すると result_xxx.tar が得られる。
    tar cvf result_xxx.tar result_xxx
  4. Upload result_xxx.tar and report.xxx together by ftp to the TSRI ftp server. The "xxx" of result_xxx.tar and report.xxx must match; the graders use the last uploaded design and report version.使用 ftp 將 result_xxx.tar 及 report.xxx 一併上傳至 TSRI 提供的 ftp server,result_xxx.tar 與 report.xxx 之「xxx」編號需一致,評審將以最後上傳的設計檔及報告檔編號進行評分作業。result_xxx.tar と report.xxx を ftp で TSRI の ftp サーバにまとめてアップロードする。result_xxx.tar と report.xxx の「xxx」は一致させること。採点には最後にアップロードされた版の設計ファイルとレポートが用いられる。

    Only tar or zip archives are accepted; rar or any other format will not be graded.本題限制上傳之設計檔僅可使用 tar 或 zip 壓縮格式,使用 rar 或其他格式者一律不予計分。アップロードできる圧縮形式は tar または zip のみで、rar など他の形式は採点されない。

    Note: the ftp transfer must be in binary mode, and the port is 21.請注意!! 上傳之 FTP 需切換為二進制模式(binary mode),且傳輸埠均設為 21 (port:21)。注意:ftp はバイナリモードに切り替え、ポートは 21 を使用すること。

    The ftp account and password were emailed to contestants before the contest. Contact TSRI with any questions.ftp 的帳號和密碼在賽前已用 email 寄給各參賽者。若有任何問題,請聯絡 TSRI。ftp のアカウントとパスワードはコンテスト前に各参加者へメールで送付済みである。不明な点は TSRI に問い合わせること。

    • FTP site1 (Hsinchu新竹晶片中心新竹): iccftp.tsri.org.tw (140.126.24.18)
    • FTP site2 (Southern南區晶片中心南部): iccftp2.tsri.org.tw (140.110.117.9)
  5. To submit an updated version, repeat the steps above and remember to change the version number of both the report and the tar file, because previously uploaded files cannot be modified, deleted or overwritten.若你需要繳交更新版本,請重覆以上步驟,並記得修改 report 檔及 tar 檔的版本編號,因為你無法修改或刪除或覆蓋之前上傳的資料。更新版を提出する場合は上記の手順を繰り返し、レポートと tar ファイルの版番号を必ず変更すること。以前にアップロードしたデータは修正・削除・上書きできない。