EP1 REFRACT
Light Refraction Notes光線折射整理光線屈折まとめ

A complete write-up of the problem statement, the derivation, the numerical check and the submission rules. The surface and ray pictures are taken from the assignment handout; every other figure is plotted directly from the formulas in the handout (RI = 5 unless noted otherwise).題目解析、公式推導、數值驗算與作業規範的完整整理。附圖中的曲面與光線圖取自題目文件,其餘圖表由題目公式直接計算繪製(除特別註明外皆以 RI = 5 計算)。問題の読み解き、式の導出、数値検算、提出規定までをまとめたものである。曲面と光線の図は課題資料から引用し、それ以外の図はすべて課題の式から直接計算して描いた(特に断らない限り RI = 5 で計算)。

Part I — Reading the problem第一部分 題目解析第一部 問題の読み解き
1

The scene: light through curved glass問題情境:光線穿過曲面玻璃問題の場面:曲面ガラスを透過する光

A square tile of glass: the top surface bulges into a curve, the bottom is the flat plane $Z=0$. Light shines straight down from above, refracts at the curved surface and finally lands on the bottom face. The task is to compute the landing point $(zx, zy)$ of every ray.一塊像方形馬賽克磚的玻璃,上表面是凸起曲面,底面是 $Z=0$ 的平面。光線從正上方垂直往下照,在曲面上折射,最後落在底面。要求算出每條光線的落點 $(zx, zy)$。正方形のモザイクタイルのようなガラスで、上面は盛り上がった曲面、底面は $Z=0$ の平面である。光は真上から垂直に入射し、曲面で屈折して最後に底面に達する。各光線の落下点 $(zx, zy)$ を求めるのが課題である。

3-D view of the curved glass: black dashed lines are the vertical incident rays, red lines the refracted rays
The curved glass and the refraction曲面玻璃及折射示意圖曲面ガラスと屈折の模式図

The black dashed lines are the rays coming straight down from above; the red lines are their paths after refraction inside the glass. The surface is flat in the middle at a height of about 6, falls away ever more steeply towards the edges, and drops to about 2 at the corners.黑色虛線是從上方垂直入射的光線,紅線是進入玻璃後折射的路徑。曲面中央平坦、高度約 6,越靠近邊緣下降越陡,角落掉到約 2。黒い破線は上方から垂直に入射する光線、赤線はガラスに入って屈折した後の経路である。曲面は中央が平坦で高さは約 6、縁に近づくほど急に下がり、角では約 2 まで落ちる。

Projections onto the XZ and YZ planes
Projection onto the XZ plane and onto the YZ planeXZ 平面投影及 YZ 平面投影XZ 平面投影と YZ 平面投影

Right (YZ projection): the rays at $Y = 5 \sim 11$ hit the flat region and fall almost straight down; $Y=3$ and $13$ tilt slightly; the outermost rays at $Y=1$ and $15$ land on the steep slope and bend strongly towards the centre.右圖(YZ 投影):$Y = 5 \sim 11$ 的光線打在平坦區,幾乎直直落下;$Y=3$、$13$ 略微偏斜;最外側的 $Y=1$、$15$ 打在陡坡上,大幅往中心方向偏折。右図(YZ 投影):$Y = 5 \sim 11$ の光線は平坦な領域に当たるため、ほぼ真下に落ちる。$Y=3$ と $13$ はわずかに傾き、最も外側の $Y=1$ と $15$ は急斜面に当たって中心方向へ大きく曲がる。

Left (XZ projection): all of these rays have $X$ = 15, hit the right-hand slope and likewise bend inwards. Only two red lines are visible on the left; Section 8 explains why.左圖(XZ 投影):這些光線的 $X$ 都是 15,打在右側斜坡上,同樣往內偏。左圖只看得到兩條紅線,原因在第 8 節說明。左図(XZ 投影):これらの光線は $X$ がすべて 15 で、右側の斜面に当たり、同じく内側へ曲がる。左図では赤線が 2 本しか見えないが、その理由は第 8 節で説明する。

Key point: the steeper the surface, the more the normal tilts and the more the ray bends; where the surface is flat the normal is vertical and the ray is not deflected at all.重點:曲面越陡,法線越傾斜,光線偏折越大;平坦區域法線垂直,光線就不會偏折。要点:曲面が急なほど法線が傾き、光線の曲がりも大きくなる。平坦な領域では法線が垂直なので光線は曲がらない。
2

The surface formula曲面公式曲面の式

$$Z = 6 - 2\left(\frac{X-8}{8}\right)^{8} - 2\left(\frac{Y-8}{8}\right)^{8},\qquad 0 \le X \le 15,\; 0 \le Y \le 15$$

Let $u = \dfrac{X-8}{8}$, which ranges from $-1$ to $\tfrac{7}{8}$. Because the exponent is 8, any $|u|<1$ is squashed to almost nothing, so the middle is essentially flat and the height only drops sharply near the edges — a flat-topped, steep-sided shape.令 $u = \dfrac{X-8}{8}$,範圍是 $-1$ 到 $\tfrac{7}{8}$。因為是 8 次方,$|u|<1$ 時數值被壓得非常小,所以中央幾乎完全平坦,只有接近邊緣才急速下降,形成「平頂、陡邊」的形狀。$u = \dfrac{X-8}{8}$ とおくと、範囲は $-1$ から $\tfrac{7}{8}$ までになる。8 乗なので $|u|<1$ の値は極端に小さく押しつぶされ、中央はほぼ完全に平坦で、縁に近づいたところだけ急激に下がる。つまり「平らな頂面と急な側面」という形になる。

Height of the Y = 8 cross-section and the slope gx plotted against X
Left: the surface height along the $Y = 8$ cross-section. Right: the slope $g_x$ used later for the normal vector. The dots mark the integer positions the rays actually hit.左:Y = 8 截面的曲面高度;右:之後求法向量用的斜率 $g_x$。圓點為光線實際打到的整數位置。左:$Y = 8$ 断面における曲面の高さ。右:後で法線ベクトルを求めるのに使う傾き $g_x$。丸印は光線が実際に当たる整数位置を示す。
Xu = (X−8)/82u⁸gx = 2u⁷
0−12.00000−2.00000
1−7/80.68722−0.78539
2−6/80.20023−0.26697
3−5/80.04657−0.07451
4−4/80.00781−0.01562
5−3/80.00078−0.00209
6−2/80.00003−0.00012
7−1/8≈ 0≈ 0
8000
9 ~ 141/8 ~ 6/8Mirror image of X = 7 ~ 2 (gx has the opposite sign)與 X = 7 ~ 2 對稱(gx 正負號相反)X = 7 ~ 2 と対称(gx の符号が反転)
157/80.687220.78539

Three things follow from the table and the plot. First, the height is 6 in the middle, 4 at an edge such as $X=0, Y=8$, and $6-2-2=2$ at the corner $(0,0)$. Second, the range is not symmetric: $u=-1$ at $X=0$ but only $7/8$ at $X=15$, so the $X=0$ side is the steepest ($g_x=-2$) while the $X=15$ side is much gentler ($g_x \approx 0.785$). Third, the X term depends only on $X$ and the Y term only on $Y$, so the two directions can be treated separately.從圖表可以看出三件事。第一,中央高度 6,邊緣(如 $X=0, Y=8$)高度 4,角落 $(0,0)$ 高度 $6-2-2=2$。第二,範圍不對稱:$X=0$ 時 $u=-1$,$X=15$ 時 $u$ 只有 $7/8$,所以 $X=0$ 那側最陡($g_x=-2$),$X=15$ 那側緩和得多($g_x \approx 0.785$)。第三,X 部分只跟 $X$ 有關、Y 部分只跟 $Y$ 有關,兩個方向可以分開看。図と表から三つのことが読み取れる。第一に、中央の高さは 6、縁(例えば $X=0, Y=8$)では 4、角 $(0,0)$ では $6-2-2=2$ である。第二に、範囲は非対称で、$X=0$ では $u=-1$ だが $X=15$ では $u$ は $7/8$ にしかならない。したがって $X=0$ 側が最も急($g_x=-2$)で、$X=15$ 側はかなり緩やかである($g_x \approx 0.785$)。第三に、X の項は $X$ だけ、Y の項は $Y$ だけに依存するので、二つの方向を分けて考えてよい。

3

System block diagram and I/O系統方塊圖與輸入/輸出システムブロック図と入出力

System block diagram
System block diagram系統方塊圖システムブロック図

The host supplies the clock, the reset and the refractive index RI. When REFRACT has finished computing it writes 512 words into the host's SRAM through the SRAM interface, and finally raises DONE.Host 提供時脈、reset 和折射率 RI;REFRACT 算完後透過 SRAM 介面把 512 筆資料寫進 Host 的 SRAM,最後拉高 DONE。Host がクロック、reset、屈折率 RI を供給する。REFRACT は計算が終わると SRAM インタフェース経由で 512 ワードを Host の SRAM に書き込み、最後に DONE を立てる。

Signal訊號信号Dir方向方向Width寬度ビット幅Description說明説明
CLKI1Clock; the design is synchronous and positive-edge triggered時脈,正緣觸發的同步設計クロック。正エッジトリガの同期設計
RSTI1Active-high asynchronous reset高位準有效的非同步 resetハイアクティブの非同期 reset
RII4Refractive index of the glass; an integer from 2 to 15玻璃折射率,整數 2 ~ 15ガラスの屈折率。2 ~ 15 の整数
DONEO1Raised when everything is finished全部完成時拉高すべて完了したときに立てる
SRAM_AO9SRAM address (0 ~ 511)SRAM 位址(0 ~ 511)SRAM アドレス(0 ~ 511)
SRAM_DO16Write data, in Q4.12 format寫入資料,Q4.12 格式書き込みデータ。Q4.12 形式
SRAM_QI16SRAM read data; normally not neededSRAM 讀出資料,正常不需使用SRAM の読み出しデータ。通常は使わない
SRAM_WEO1Write enable寫入致能ライトイネーブル
4

Input and output timing資料輸入與輸出時序データ入出力のタイミング

Timing diagram for the data input and output
Data input and output timing資料輸入輸出時序データ入出力のタイミング

When RST goes high, RI is presented at the same time and then stays unchanged for the whole computation.RST 拉高時,RI 同時送入,之後整個運算期間保持不變。RST が立ち上がるときに RI も同時に与えられ、以後は計算が終わるまで変化しない。

When the results are written SRAM_WE goes high. Each ray produces two consecutive words: zx at address 0, zy at address 1, and so on — zx first, then zy. The "⋯⋯" between two write bursts means any number of cycles may pass between one ray and the next.寫入結果時 SRAM_WE 拉高,每條光線連續寫兩筆:位址 0 寫 zx、位址 1 寫 zy,依此類推,先 zx 後 zy。兩組寫入之間的「⋯⋯」代表不同光線之間可以間隔任意多個 cycle。結果を書き込むときに SRAM_WE を立てる。光線 1 本につき連続して 2 ワードを書き、アドレス 0 に zx、アドレス 1 に zy、以下同様に、zx が先、zy が後である。書き込みの間にある「⋯⋯」は、光線と光線の間に何サイクル空けてもよいことを表す。

Only after all 256 rays have been written is DONE raised; the host then starts checking the contents of the SRAM.256 條光線全部寫完後拉高 DONE,Host 才開始比對 SRAM 內容。256 本の光線をすべて書き終えてから DONE を立てる。Host はそれを受けて SRAM の内容の照合を始める。

5

The law of refraction折射定律屈折の法則

Diagram of the incident ray, the normal and the refracted ray
Both the angle of incidence θ1 and the angle of refraction θ2 are measured from the normal入射角 θ1 與折射角 θ2 都是和法線的夾角入射角 θ1 も屈折角 θ2 も法線からの角度である
$$n_1 \sin\theta_1 = n_2 \sin\theta_2$$

$\theta_1$ and $\theta_2$ are the angles that the incident and the refracted ray make with the normal (the handout mislabels the second one as θ1). Glass has a larger refractive index than air, so the refracted ray leans towards the normal. Trigonometric functions are awkward in hardware, so the vector form is used instead:$\theta_1$、$\theta_2$ 分別是入射光、折射光和法線的夾角(題目文件中第二個符號誤植為 θ1)。玻璃折射率比空氣大,折射光會往法線方向靠攏。三角函數不利硬體實現,所以改用向量形式:$\theta_1$、$\theta_2$ はそれぞれ入射光、屈折光が法線となす角である(課題資料では二つ目の記号が θ1 と誤記されている)。ガラスの屈折率は空気より大きいので、屈折光は法線の方向に寄る。三角関数はハードウェア化に向かないため、ベクトル形式に書き換える。

$$\mathbf{T} = \eta\,\mathbf{I} + \left(\eta\,(-\mathbf{N}\cdot\mathbf{I}) - \sqrt{1-\eta^2\left(1-(\mathbf{N}\cdot\mathbf{I})^2\right)}\right)\mathbf{N}$$
$\mathbf{I}$Unit incident vector單位入射向量単位入射ベクトル
$\mathbf{N}$Unit normal vector單位法向量単位法線ベクトル
$\mathbf{T}$Unit refracted vector單位折射向量単位屈折ベクトル
$\eta$Ratio of refractive indices $n_1/n_2$; here $n_1=1$ and $n_2=RI$, so $\eta = 1/RI$折射率比 $n_1/n_2$;本題 $n_1=1$、$n_2=RI$,所以 $\eta = 1/RI$屈折率の比 $n_1/n_2$。本問では $n_1=1$、$n_2=RI$ なので $\eta = 1/RI$
6

Deriving the refraction formula for the surface曲面折射公式推導曲面屈折の式の導出

The plan: find the normal vector at the point of incidence, substitute it into the vector refraction formula to get the refracted direction, then intersect that ray with the plane $Z=0$.思路:先求入射點的法向量,代入向量折射公式求折射方向,再求折射光與 $Z=0$ 平面的交點。方針:まず入射点の法線ベクトルを求め、ベクトル形式の屈折公式に代入して屈折方向を得る。次にその屈折光と $Z=0$ 平面との交点を求める。

①
Write the surface as an implicit function把曲面寫成隱函數曲面を陰関数で表す
$$f(X,Y,Z) = Z - 6 + 2\left(\frac{X-8}{8}\right)^{8} + 2\left(\frac{Y-8}{8}\right)^{8} = 0$$

The gradient $\nabla f$ of an implicit function is perpendicular to the surface, so it gives the direction of the normal.隱函數的梯度 $\nabla f$ 垂直於曲面,就是法向量方向。陰関数の勾配 $\nabla f$ は曲面に垂直であり、そのまま法線の向きを与える。

②
Partial derivatives give the normal vector g偏微分求法向量 g偏微分で法線ベクトル g を求める
$$g_x = 2\cdot 8 \left(\frac{X-8}{8}\right)^{7}\cdot\frac{1}{8} = 2\left(\frac{X-8}{8}\right)^{7},\qquad g_y = 2\left(\frac{Y-8}{8}\right)^{7},\qquad g_z = 1$$

The factor 8 from differentiating the eighth power cancels the $\tfrac{1}{8}$ from the chain rule. The unit normal is $\mathbf{N} = \mathbf{g}/\sqrt{g^2}$, where $g^2 = g_x^2 + g_y^2 + 1$.8 次方微分產生的係數 8 和連鎖律的 $\tfrac{1}{8}$ 抵銷。單位法向量 $\mathbf{N} = \mathbf{g}/\sqrt{g^2}$,其中 $g^2 = g_x^2 + g_y^2 + 1$。8 乗の微分で出る係数 8 と、連鎖律の $\tfrac{1}{8}$ が打ち消し合う。単位法線ベクトルは $\mathbf{N} = \mathbf{g}/\sqrt{g^2}$ であり、ここで $g^2 = g_x^2 + g_y^2 + 1$ である。

③
Substitute the incident vector I = (0, 0, −1)代入入射向量 I = (0, 0, −1)入射ベクトル I = (0, 0, −1) を代入する
$$\mathbf{N}\cdot\mathbf{I} = \frac{g_x\cdot 0 + g_y\cdot 0 + 1\cdot(-1)}{\sqrt{g^2}} = -\frac{1}{\sqrt{g^2}},\qquad (\mathbf{N}\cdot\mathbf{I})^2 = \frac{1}{g^2}$$
④
Define k and put it back into the refraction formula定義 k,代回折射公式k を定義して屈折公式に戻す
$$k = 1 - \eta^2\left(1 - \frac{1}{g^2}\right),\qquad \mathbf{T} = \eta\,\mathbf{I} + \left(\frac{\eta}{\sqrt{g^2}} - \sqrt{k}\right)\frac{\mathbf{g}}{\sqrt{g^2}}$$
⑤
Move √g² inside the bracket to save a square root把 √g² 搬進括號,減少開根號√g² を括弧の中へ移し、平方根の回数を減らす

Since $\sqrt{k}\cdot\tfrac{1}{\sqrt{g^2}} = \tfrac{\sqrt{k\,g^2}}{g^2}$, what used to need two square roots now needs only one:$\sqrt{k}\cdot\tfrac{1}{\sqrt{g^2}} = \tfrac{\sqrt{k\,g^2}}{g^2}$,原本要開兩次根號,現在只需要一次:$\sqrt{k}\cdot\tfrac{1}{\sqrt{g^2}} = \tfrac{\sqrt{k\,g^2}}{g^2}$ であるから、もともと 2 回必要だった平方根が 1 回で済む。

$$\mathbf{T} = \eta\,\mathbf{I} + coef\cdot\mathbf{g},\qquad coef = \frac{\eta - \sqrt{k\,g^2}}{g^2}$$
⑥
Write it out in components展開成分量成分に展開する
$$\mathbf{T} = \left(coef\cdot g_x,\; coef\cdot g_y,\; -\eta + coef\right)$$
⑦
Intersect with the plane Z = 0求與 Z = 0 平面的交點Z = 0 平面との交点を求める
$$Z + t\,(-\eta + coef) = 0 \;\Rightarrow\; t = \frac{-Z}{-\eta + coef}$$ $$zx = X + t\cdot coef\cdot g_x,\qquad zy = Y + t\cdot coef\cdot g_y$$
Why the signs work out: $\sqrt{k\,g^2} \ge 1 > \eta$, so $coef$ is always negative and $t$ is positive. The sign of $zx - X$ is therefore opposite to that of $g_x$: rays on the right-hand slope ($g_x>0$) move left, rays on the left-hand slope move right — every ray bends towards the centre.符號直覺:$\sqrt{k\,g^2} \ge 1 > \eta$,所以 $coef$ 一定是負數,$t$ 為正。$zx - X$ 的正負號和 $g_x$ 相反:右側斜坡($g_x>0$)的光往左偏、左側斜坡往右偏,全部都往中心偏。符号の直観:$\sqrt{k\,g^2} \ge 1 > \eta$ なので $coef$ は必ず負、$t$ は正になる。したがって $zx - X$ の符号は $g_x$ と逆になり、右側の斜面($g_x>0$)の光は左へ、左側の斜面の光は右へ、つまりすべて中心へ向かって曲がる。
7

A worked example and the effect of RI數值驗算與 RI 的影響数値検算と RI の影響

Take $(X, Y) = (15, 8)$ with $RI = 5$ (so $\eta = 0.2$) and follow the steps above:以 $(X, Y) = (15, 8)$、$RI = 5$($\eta = 0.2$)為例,依上面的步驟計算:$(X, Y) = (15, 8)$、$RI = 5$($\eta = 0.2$)を例に、上の手順どおりに計算する。

Quantity量量Calculation計算計算Value數值値
$Z$$6 - 2(7/8)^8 - 0$5.31278
$g_x$$2(7/8)^7$0.78539
$g_y$$Y=8$0
$g^2$$g_x^2 + 0 + 1$1.61684
$k$$1 - 0.04\,(1 - 1/g^2)$0.98474
$\sqrt{k\,g^2}$1.26181
$coef$$(0.2 - 1.26181)/g^2$−0.65672
$t$$-Z/(-0.2 + coef)$6.20131
$zx$$15 + t\cdot coef\cdot g_x$11.80148
$zy$$8 + 0$8.00000
Entry point (X, Y)入射點 (X, Y)入射点 (X, Y)zxzyRemark說明説明
(8, 8)8.0008.000Dead centre: the normal is vertical, so there is no deflection at all正中央,法線垂直,完全不偏折ちょうど中央。法線が垂直なのでまったく曲がらない
(15, 8)11.8018.000Only the X direction has a slope, so the ray shifts only in X只有 X 方向有斜率,只在 X 方向偏X 方向にだけ傾きがあるので、ずれも X 方向だけ
(1, 15)3.69212.308Shifts towards the centre in both directions兩個方向都往中心偏両方向とも中心へずれる
(0, 0)2.4162.416The steepest corner, but Z is only 2, so the shift is not that large最陡的角落,但 Z 只有 2,偏移量反而不大最も急な角だが Z が 2 しかないため、ずれはかえって小さい
zx of the landing point against RI, and the distribution of all 256 landing points for three values of RI
Left: how the landing point of $(15, 8)$ moves with RI. Right: the distribution of all 256 landing points at RI = 2, 5 and 15; the grey crosses mark the entry points.左:(15, 8) 的落點隨 RI 變化;右:RI = 2、5、15 時 256 個落點的分布,灰色十字為入射點。左:$(15, 8)$ の落下点が RI によってどう動くか。右:RI = 2、5、15 における 256 個の落下点の分布。灰色の十字は入射点を示す。

The larger RI is, the more the ray bends. A higher refractive index pulls the refracted ray closer to the normal, and here the normal leans towards the centre, so the landing point moves inwards: for $(15,8)$, $zx \approx 13.05$ at RI = 2, 11.80 at RI = 5 and about 11.17 at RI = 15. The right-hand plot also shows that in the central region the landing points almost coincide with the entry points, the displacement being concentrated in the outer two rings.RI 越大,偏折越多。折射率越大,光線越往法線靠攏,而這裡的法線往中心傾斜,所以落點更靠近中心:$(15,8)$ 在 RI = 2 時 $zx \approx 13.05$,RI = 5 時 11.80,RI = 15 時約 11.17。右圖也可以看到中央區域的落點幾乎與入射點重合,偏移集中在外圍兩圈。RI が大きいほど曲がりも大きい。屈折率が大きいほど光線は法線に寄り、ここでの法線は中心へ傾いているので、落下点はより中心に近づく。$(15,8)$ の場合、RI = 2 で $zx \approx 13.05$、RI = 5 で 11.80、RI = 15 で約 11.17 となる。右図を見ると、中央付近では落下点が入射点とほぼ重なり、ずれは外側 2 周に集中していることも分かる。

Working through all 14 values of RI and all 256 rays, the landing points lie roughly between 1.29 and 14.05, comfortably inside the 0 ~ 16 range that Q4.12 can represent.14 種 RI、256 條光線全部算過,落點約在 1.29 到 14.05 之間,都在 Q4.12 可表示的 0 ~ 16 以內。14 種類の RI と 256 本の光線をすべて計算すると、落下点はおよそ 1.29 から 14.05 の範囲に収まり、いずれも Q4.12 で表現できる 0 ~ 16 の中に入る。

Interactive 3-D view互動式 3D 視圖インタラクティブ 3D ビュー

An interactive version of the figures above. Drag to rotate and scroll to zoom; moving the RI slider recomputes all 256 rays live. Colour encodes how far the landing point has moved from the entry point, with the top of the scale fixed at 7 cm (the largest value over RI 2 ~ 15), so colours can be compared directly between different values of RI.上面幾張圖的互動版。拖曳可旋轉、滾輪縮放,拉動 RI 會即時重算 256 條光線;顏色代表落點相對入射點的偏移量,色階上限固定在 7 cm(RI 2 ~ 15 之間的最大值),所以不同 RI 之間可以直接比顏色。上の図のインタラクティブ版である。ドラッグで回転、ホイールで拡大縮小でき、RI を動かすと 256 本の光線がその場で再計算される。色は落下点が入射点からどれだけずれたかを表し、色スケールの上限は 7 cm(RI 2 ~ 15 の範囲での最大値)に固定してあるので、RI が違っても色をそのまま比較できる。

RI 5
Preset快選プリセット
Surface曲面曲面
View視角視点

Check points驗算點検算点

Entry (X, Y)入射 (X, Y)入射 (X, Y)zxzyzx addresszx 位址zx アドレス

Landing points of all 256 rays256 條光線落點256 本の光線の落下点

RI 5
Surface曲面曲面
#XYZzxzyShift (cm)偏移 (cm)ずれ (cm)zx addrzx 位址zx アドレスzy addrzy 位址zy アドレスzx Q4.12zy Q4.12

Statistics統計比較統計比較

RIzx (15, 8)Max shift最大偏移最大ずれzx rangezx 範圍zx の範囲Farthest from centre離中心最遠中心から最も遠い点

Hovering over any point in the landing-point plots shows its zx / zy, its displacement, and the SRAM address and Q4.12 encoding from Section 10. Switching "Surface" to Symmetric moves both the centre and the normalising half-width to 7.5 (the midpoint of the 0 ~ 15 sampling range), which makes all four edges 4 high and all four corners 2. The version in the handout puts the centre at 8, half a grid step off, which is why the X = 0 side reaches u = −1 and is the steepest while the X = 15 side only reaches u = 7/8. The answers to be submitted follow the version in the handout.落點圖上滑過任一點,會顯示它的 zx / zy、偏移量,以及第 10 節的 SRAM 位址與 Q4.12 編碼。「曲面」切到四邊對稱是把中心與正規化半寬都改成 7.5(取樣範圍 0 ~ 15 的中點),四個邊高度全變成 4、四角全是 2;題目原版的中心在 8,偏了半格,所以 X = 0 那側 u = −1 最陡、X = 15 那側只有 u = 7/8。作業答案以題目原版為準。落下点の図で任意の点にマウスを乗せると、その zx / zy、ずれの大きさ、さらに第 10 節の SRAM アドレスと Q4.12 符号が表示される。「曲面」を四辺対称に切り替えると、中心と正規化半幅をどちらも 7.5(サンプリング範囲 0 ~ 15 の中点)に変え、四辺の高さはすべて 4、四隅はすべて 2 になる。課題どおりの版は中心が 8 で半目盛ずれているため、X = 0 側は u = −1 で最も急、X = 15 側は u = 7/8 にしかならない。提出する答えは課題どおりの版を基準とする。

8

Why the projection shows only two refracted rays投影圖為何只有兩條折射線投影図に屈折光が 2 本しかない理由

In the XZ projection, why does a single incident ray appear to produce two refracted rays?XZ 投影圖中,為什麼一條入射線會有兩條折射線?XZ 投影図では、なぜ 1 本の入射光に屈折光が 2 本あるように見えるのか。

One ray does not split into two. What you see is eight separate rays that all have X = 15 but different Y (Y = 1, 3, 5, …, 15) drawn on top of one another. The XZ projection looks along the Y axis, so the Y coordinate is invisible and rays with different Y are drawn in the same place.不是一條光線分成兩條,而是 X 都是 15、但 Y 不同的 8 條光線(Y = 1, 3, 5, …, 15)疊在一起。XZ 投影是沿 Y 方向看過去,看不到 Y 座標,所以 Y 不同的光線會畫在同一個位置。1 本の光線が 2 本に分かれるのではない。見えているのは X がすべて 15 で Y が異なる 8 本の光線(Y = 1, 3, 5, …, 15)が重なったものである。XZ 投影は Y 方向から見ているため Y 座標が見えず、Y の違う光線が同じ位置に描かれる。

The eight rays at X = 15 projected onto the XZ and YZ planes
The same eight rays (X = 15, RI = 5). On the left only two are visible; on the right they fan out into eight.同一組 8 條光線(X = 15,RI = 5)。左邊只看得到兩條,右邊展開成 8 條。同じ 8 本の光線(X = 15、RI = 5)。左では 2 本しか見えず、右では 8 本に分かれる。
YEntry height Z入射點高度 Z入射点の高さ ZLanding zx落點 zx落下点 zxIn the left plot在左圖中左図では
5, 7, 9, 115.31311.80blue line, 6 rays overlapping藍線,6 條重疊青線、6 本が重なる
3, 135.26611.83
1, 154.62612.31red line, 2 rays overlapping紅線,2 條重疊赤線、2 本が重なる

On the way in, all eight rays have X = 15, so the black dashed lines coincide exactly into one.入射時,8 條光線的 X 都是 15,所以黑色虛線完全重疊成一條。入射時は 8 本とも X = 15 なので、黒い破線は完全に重なって 1 本になる。

After refraction, the six rays at Y = 3 ~ 13 sit in the flat region in the Y direction, where $2\left(\frac{Y-8}{8}\right)^8$ is almost 0; their entry heights and their deflections are nearly identical, so they pile up into one line. The rays at Y = 1 and 15 land on the slope in the Y direction too, so an extra $2(7/8)^8 \approx 0.687$ is subtracted from Z; they start lower, closer to the bottom face, and reach it before bending as far inwards, which makes zx larger. The two are exact mirror images, so they pile up into a second line.折射後,Y = 3 ~ 13 這 6 條在 Y 方向位於平坦區,$2\left(\frac{Y-8}{8}\right)^8$ 幾乎為 0,入射高度和偏折量幾乎一樣,疊成一條;Y = 1、15 在 Y 方向也打在斜坡上,Z 多扣了 $2(7/8)^8 \approx 0.687$,起點較低、離底面較近,還沒往內偏那麼多就落地,zx 較大,兩者又剛好對稱,疊成另一條。屈折後は、Y = 3 ~ 13 の 6 本が Y 方向で平坦な領域にあり、$2\left(\frac{Y-8}{8}\right)^8$ がほぼ 0 になる。入射高さも曲がり方もほとんど同じなので、重なって1 本に見える。Y = 1、15 は Y 方向でも斜面に当たるため、Z から $2(7/8)^8 \approx 0.687$ だけ余分に引かれる。出発点が低く底面に近いので、内側へそれほど曲がらないうちに底面に達し、zx が大きくなる。この 2 本はちょうど対称なので、重なってもう 1 本になる。

Seen from the YZ plane the Y coordinate is unfolded and the eight rays separate. The landing points at X = 15 therefore fall into two groups, around 11.8 and 12.3 (RI = 5).改從 YZ 面看,Y 座標展開,8 條光線就各自分開了。所以 X = 15 的落點其實分成兩群:約 11.8 和 12.3(RI = 5)。YZ 面から見れば Y 座標が展開され、8 本の光線はそれぞれ分かれる。つまり X = 15 の落下点は、約 11.8 と 12.3(RI = 5)の 2 つのグループに分かれている。

9

Is curvature data for the glass surface needed?需要玻璃曲面的曲度資料嗎ガラス曲面の曲率データは必要か

To solve this problem, is the curvature of the glass surface needed?要算這題,需不需要玻璃的曲面曲度資料?この問題を解くのに、ガラス曲面の曲率データは必要か。

No. The surface is completely determined by the formula in Section 2, and computing the landing point of one ray needs only two pieces of information about the point of entry.不需要。曲面已經由第 2 節的公式完全決定,算一條光線的落點只需要入射點的兩個資訊。必要ない。曲面は第 2 節の式で完全に決まっており、1 本の光線の落下点を求めるのに必要なのは入射点に関する 2 つの情報だけである。

The height Z: because the ray travels straight down, the point of entry is simply $(X, Y, Z(X,Y))$ — substitute into the formula, with no ray-surface intersection to solve. Z fixes how far the ray is from the bottom face.高度 Z:光線垂直往下,入射點就是 $(X, Y, Z(X,Y))$,直接代公式即可,不用解光線與曲面的交點。Z 決定光線離底面多遠。高さ Z:光線は垂直に下りるので、入射点はそのまま $(X, Y, Z(X,Y))$ である。式に代入するだけでよく、光線と曲面の交点を解く必要はない。Z は光線が底面からどれだけ離れているかを決める。

The normal $(g_x, g_y, 1)$: the direction of refraction depends only on how the tangent plane at the entry point is tilted, that is, on the first derivative (the slope).法向量 $(g_x, g_y, 1)$:折射方向只取決於入射點的切平面傾斜程度,也就是一次微分(斜率)。法線ベクトル $(g_x, g_y, 1)$:屈折方向は入射点における接平面の傾き、すなわち 1 階微分(傾き)だけで決まる。

Curvature in the usual sense is a second derivative and describes how sharply the surface bends; the law of refraction only looks at the local direction of the normal, which has nothing to do with that bending, so it is never needed. Besides, X and Y are integers from 0 to 15, only 16 cases per direction, and every height and slope required can be computed straight from the formula.一般說的曲度(curvature)是二次微分,描述曲面彎曲的程度;但折射定律只看局部法線方向,跟曲面怎麼彎無關,所以用不到。另外 X、Y 都是 0 ~ 15 的整數,每個方向只有 16 種情況,所需的高度和斜率都能直接從公式算出。一般にいう曲率(curvature)は 2 階微分であり、曲面の曲がり具合を表す。しかし屈折の法則が見るのは局所的な法線の向きだけで、曲面がどう曲がっているかとは無関係なので、曲率は使わない。さらに X、Y はいずれも 0 ~ 15 の整数で各方向 16 通りしかなく、必要な高さと傾きはすべて式から直接計算できる。

10

SRAM contents and formatSRAM 內容與格式SRAM の内容とフォーマット

The SRAM holds 512 words of 16 bits each, in unsigned Q4.12: the top 4 bits are the integer part and the lower 12 bits the fraction. The real value is the stored integer ÷ 4096 — for example $11.80148$ is stored as $\lfloor 11.80148 \times 4096 \rfloor = 48338$ (0xBCD2).SRAM 共 512 個 word,每個 16 bits,採無號 Q4.12:最高 4 bits 是整數部分,後 12 bits 是小數部分。實際數值 = 存入的整數 ÷ 4096,例如 $11.80148$ 約存成 $\lfloor 11.80148 \times 4096 \rfloor = 48338$(0xBCD2)。SRAM は 16 bit の word を 512 個もち、符号なし Q4.12 を用いる。上位 4 bit が整数部、下位 12 bit が小数部である。実際の値は格納された整数 ÷ 4096 で、例えば $11.80148$ は $\lfloor 11.80148 \times 4096 \rfloor = 48338$(0xBCD2)として格納される。

Order in which the data is stored in the SRAM
Order in which the data is stored in the SRAMSRAM 資料儲存順序SRAM へのデータ格納順序

Each ray occupies two words, zx first and zy second. Within one row $Y$ the entries run $X = 0 \sim 15$ in order, then the next row follows:每條光線佔兩個 word,先 zx 後 zy;同一列 $Y$ 依序排 $X = 0 \sim 15$,再換下一列:光線 1 本につき 2 word を使い、zx が先、zy が後である。同じ行 $Y$ の中では $X = 0 \sim 15$ の順に並び、その後に次の行が続く。

$$\text{zx 位址} = 32Y + 2X,\qquad \text{zy 位址} = 32Y + 2X + 1$$

Checking the example in the figure: for $X=1, Y=15$ the zx address is $32\times15 + 2 = 482$.驗證圖中的例子:$X=1, Y=15$ 時,zx 位址 $= 32\times15 + 2 = 482$。図中の例で確認すると、$X=1, Y=15$ のとき zx のアドレスは $32\times15 + 2 = 482$ である。

11

Error tolerance誤差容忍誤差の許容範囲

A landing point counts as correct if it is within 1/256 of the reference answer. The least significant step of Q4.12 is 1/4096, sixteen times finer than that tolerance, but if the intermediate operations (the eighth power, the division, the square root) are truncated to too few bits the accumulated error can still exceed it.落點與標準答案的距離小於 1/256 即算正確。Q4.12 的最小刻度是 1/4096,比容忍範圍細 16 倍,但中間運算(8 次方、除法、開根號)的位元數截得太短,誤差累積起來仍可能超標。落下点と模範解答との距離が 1/256 未満であれば正解とみなされる。Q4.12 の最小刻みは 1/4096 で許容範囲より 16 倍細かいが、途中の演算(8 乗、除算、平方根)のビット幅を切り詰めすぎると、誤差が積み重なって許容範囲を超えることがある。

12

Implementing the square root in hardware開根號的硬體實作平方根のハードウェア実装

After the rearrangement in Section 6, $coef = \dfrac{\eta - \sqrt{k\,g^2}}{g^2}$ leaves just one square root per ray — but Verilog has no built-in square root. The sqrt_seq below uses the restoring, digit-by-digit method: one result bit per cycle, with only a comparison and a subtraction on the datapath and no multiplier, so it is small and easy to meet timing with. The latency is $W/2$ cycles after start.第 6 節整理後的 $coef = \dfrac{\eta - \sqrt{k\,g^2}}{g^2}$,每條光線只剩下一次開根號,但 Verilog 沒有內建的平方根。下面這個 sqrt_seq 採逐位還原法(restoring, digit-by-digit),一個 cycle 決定一個結果 bit,資料路徑上只有比較與減法、沒有乘法器,面積小也容易過時序。延遲是 start 之後 $W/2$ 個 cycle。第 6 節で整理した $coef = \dfrac{\eta - \sqrt{k\,g^2}}{g^2}$ では、光線 1 本あたり平方根が 1 回だけ残る。しかし Verilog に平方根は組み込まれていない。次の sqrt_seq は復元型の逐次桁計算(restoring, digit-by-digit)を使い、1 サイクルで結果を 1 bit 決める。データパスには比較と減算しかなく乗算器が要らないので、面積が小さくタイミングも通しやすい。レイテンシは start から $W/2$ サイクルである。

sqrt_seq.v

// Generic bit-serial square root (restoring, digit-by-digit)
// root = floor( sqrt(radicand) ), one result bit per clock cycle
// Latency: W/2 cycles after start
module sqrt_seq #(
    parameter W = 16                     // radicand width (must be even)
)(
    input  wire           clk,
    input  wire           rst,           // active-high asynchronous reset
    input  wire           start,         // pulse to begin
    input  wire [W-1:0]   radicand,
    output reg  [W/2-1:0] root,
    output reg            done
);
    localparam N = W / 2;

    reg [W-1:0]   x;                     // remaining radicand bits (shifted out 2 at a time)
    reg [N+1:0]   rem;                   // partial remainder
    reg [$clog2(N+1)-1:0] cnt;
    reg           busy;

    wire [N+1:0] rem_sh = {rem[N-1:0], x[W-1:W-2]};   // bring down next 2 bits
    wire [N+1:0] trial  = {root, 2'b01};              // 4*root + 1
    wire         ge     = (rem_sh >= trial);

    always @(posedge clk or posedge rst) begin
        if (rst) begin
            x <= 0; rem <= 0; root <= 0; cnt <= 0; busy <= 0; done <= 0;
        end else begin
            done <= 0;
            if (start && !busy) begin
                x <= radicand; rem <= 0; root <= 0; cnt <= N; busy <= 1;
            end else if (busy) begin
                rem  <= ge ? rem_sh - trial : rem_sh;
                root <= {root[N-2:0], ge};
                x    <= x << 2;
                cnt  <= cnt - 1;
                if (cnt == 1) begin busy <= 0; done <= 1; end
            end
        end
    end
endmodule

How the code maps onto the algorithm程式碼對應演算法步驟コードとアルゴリズムの対応

Step步驟手順Code程式碼コードWhat it does說明説明
1. Bring down 2 bits1. 取下 2 bits1. 2 bit 下ろすrem_sh = {rem[N-1:0], x[W-1:W-2]}Shift the remainder left by two and append the top 2 bits of the radicand餘數左移 2 位,接上被開方數最高的 2 bits余りを 2 bit 左シフトし、被開方数の最上位 2 bit を付け加える
2. Trial value2. 試算值2. 試行値trial = {root, 2'b01}Append 01 to the result so far, which equals $4 \times root + 1$在結果後面接 01,等於 $4 \times root + 1$これまでの結果の後ろに 01 を付ける。これは $4 \times root + 1$ に等しい
3. Compare and subtract3. 比較與相減3. 比較して減算ge = (rem_sh >= trial)
rem <= ge ? rem_sh - trial : rem_sh
Subtract if it fits, otherwise keep the remainder as it is夠減就減,不夠就保留引ければ引き、引けなければそのまま残す
3. Decide the bit3. 決定 bit3. bit を決めるroot <= {root[N-2:0], ge}The comparison result ge becomes the next bit directly比較結果 ge 直接成為新的一個 bit比較結果 ge がそのまま次の 1 bit になる
4. Repeat4. 重複4. 繰り返すx <= x << 2、cnt <= cnt - 1Shift out the 2 bits just used; after N iterations raise done移出用過的 2 bits,計數 N 次後拉高 done使い終わった 2 bit を押し出し、N 回数えたら done を立てる

Why the trial value is $4 \times root + 1$為什麼試算值是 $4 \times root + 1$試行値が $4 \times root + 1$ である理由

Suppose the result obtained so far is $r$ and the next bit is tried as a 1, making the new result $2r+1$. The difference between the squares of the new and the old result, after the two-place left shift that aligns them, is:假設目前已求出的結果是 $r$,下一個 bit 想試試看放 1,新的結果就是 $2r+1$。新結果的平方與舊結果平方的差(左移 2 位對齊後)是:これまでに求めた結果を $r$ とし、次の bit に 1 を置いてみると、新しい結果は $2r+1$ になる。新旧の結果の平方の差(2 bit 左シフトで桁を合わせた後)は次のようになる。

$$(2r+1)^2 - (2r)^2 = 4r + 1$$

So asking whether the remainder is $\ge 4r+1$ is enough to decide whether that bit can be a 1 — no multiplication at all.所以只要比較「餘數是否 $\ge 4r+1$」,就知道這個 bit 能不能放 1,完全不需要乘法。したがって「余りが $\ge 4r+1$ かどうか」を比べるだけでその bit に 1 を置けるかが分かり、乗算は一切要らない。

Worked by hand: $\sqrt{10}$手算範例:$\sqrt{10}$手計算の例:$\sqrt{10}$

10 in binary is 00 00 10 10 (with $W=8$, $N=4$):10 的二進位是 00 00 10 10($W=8$、$N=4$):10 の 2 進表現は 00 00 10 10 である($W=8$、$N=4$)。

Round回合回Brought down取下下ろすrem_shtrial$\ge$ ?New rem新 rem新しい remroot
10001No否いいえ00
20001No否いいえ000
31021Yes是はい1001
41065Yes是はい10011

The result is root = 3 with remainder 1, that is $3^2 + 1 = 10$, so $\lfloor\sqrt{10}\rfloor = 3$.結果 root = 3、餘數 1,也就是 $3^2 + 1 = 10$,$\lfloor\sqrt{10}\rfloor = 3$。結果は root = 3、余り 1、すなわち $3^2 + 1 = 10$ であり、$\lfloor\sqrt{10}\rfloor = 3$ となる。

Testbench tb_sqrt_seq.v測試檔 tb_sqrt_seq.vテストベンチ tb_sqrt_seq.v

module tb;
  reg clk=0,rst=1,start=0; reg [15:0] a; wire [7:0] r; wire d;
  sqrt_seq #(16) u(clk,rst,start,a,r,d);
  always #5 clk=~clk;
  integer i,err=0,expv;
  initial begin
    #12 rst=0;
    for(i=0;i<65536;i=i+1) begin
      @(negedge clk) a=i; start=1; @(negedge clk) start=0;
      wait(d); expv=$floor($sqrt(i)); if(r!==expv) begin err=err+1; if(err<5)$display("ERR %d %d %d",i,r,expv); end
    end
    $display("errors=%0d",err); $finish;
  end
endmodule

The command below runs every input from 0 to 65535 and prints errors=0.用以下指令跑完 0 ~ 65535 全部輸入,輸出 errors=0。次のコマンドで 0 ~ 65535 のすべての入力を通すと、errors=0 と出力される。

iverilog -g2012 -o t tb_sqrt_seq.v sqrt_seq.v && vvp t
Two things to watch: W must be even, and $clog2 is Verilog-2005 syntax, supported by both Design Compiler and xrun. To use this on fixed-point fractions (the Q4.12 of Section 10), pad the radicand with zeros to 28 bits and set W = 28; the output is then 14 bits, of which 12 are fractional.兩點注意:W 必須是偶數;$clog2 是 Verilog-2005 語法,Design Compiler 與 xrun 都支援。要用在定點小數(第 10 節的 Q4.12)時,把被開方數補 0 湊成 28 bits、設 W = 28 即可,輸出就是 14 bits、其中 12 bits 為小數。注意点が二つ:W は偶数でなければならない。$clog2 は Verilog-2005 の構文で、Design Compiler も xrun も対応している。固定小数点(第 10 節の Q4.12)に使う場合は、被開方数に 0 を詰めて 28 bits にし、W = 28 と設定すればよい。出力は 14 bits で、そのうち 12 bits が小数部になる。
Part II — EP1 submission rules第二部分 EP1 作業規範第二部 EP1 課題規定
13

Process setup製程設定プロセスの設定

EP1 must be synthesised with the ADFP_n16 process (the TSMC 16 nm academic process kit). Before starting Design Compiler, type the command below in the terminal and then pick ADFP_n16 from the menu.EP1 必須使用 ADFP_n16 製程(TSMC 16nm 學術用製程套件)合成。啟動 Design Compiler 前,先在終端機輸入以下指令,再於選單中選擇 ADFP_n16。EP1 は ADFP_n16 プロセス(TSMC 16nm のアカデミック向けプロセスキット)で合成しなければならない。Design Compiler を起動する前に、端末で次のコマンドを入力し、メニューから ADFP_n16 を選ぶ。

snsd
14

Simulation commands模擬指令シミュレーションコマンド

Every xrun below may be replaced by ncverilog.以下 xrun 皆可替換成 ncverilog。以下の xrun はいずれも ncverilog に置き換えてよい。

RTL simulationRTL 模擬RTL シミュレーション

xrun tb.v REFRACT.v +define+RI=5 +access+r -clean -createdebugdb \
     -input xrun.tcl \
     +incdir+/cad/synopsys/synthesis/cur/dw/sim_ver/ +libext+.v

Gate-level simulationGate-level 模擬ゲートレベルシミュレーション

xrun tb.v REFRACT_syn.v +define+SDF+RI=5 +access+r -clean -createdebugdb \
     -input xrun.tcl -v N16ADFP_StdCell.v
Option參數オプションWhat it does作用働き
+define+RI=5Defines the macro RI=5, choosing the refractive index to simulate; change the number to test another value定義巨集 RI=5,選擇要模擬的折射率;測其他值就改數字マクロ RI=5 を定義し、シミュレーションする屈折率を選ぶ。別の値を試すときは数字を変える
+define+SDFGate-level only; makes the testbench back-annotate the SDF timing file僅用於 gate-level,讓 testbench 反標 SDF 時序檔ゲートレベル専用。テストベンチに SDF タイミングファイルをバックアノテートさせる
+access+rGrants read access to the signals so the waveforms can be viewed開啟訊號讀取權限,才能看波形信号の読み出し権限を有効にし、波形を見られるようにする
-cleanClears the results of the previous compilation清除先前的編譯結果以前のコンパイル結果を消去する
-createdebugdbGenerates the debug database產生除錯資料庫デバッグ用データベースを生成する
-input xrun.tclReads in the simulation control script讀入模擬控制腳本シミュレーション制御スクリプトを読み込む
+incdir+…/dw/sim_ver/Path to the DesignWare simulation models; needed when DW components are usedDesignWare 模擬模型路徑,有用到 DW 元件時需要DesignWare のシミュレーションモデルのパス。DW 部品を使う場合に必要
+libext+.vUse the .v extension when searching for library modules搜尋 library 模組時使用 .v 副檔名library モジュールを探すときに .v という拡張子を使う
-v N16ADFP_StdCell.vVerilog models of the 16 nm standard cell library16nm 標準元件庫的 Verilog 模型16nm 標準セルライブラリの Verilog モデル
Note: the commands in the original specification are missing a few spaces (for example +access+r-clean, xrun.tcl+incdir, RI=5+access); the commands on this page have all been corrected.注意:原始規範中的指令有幾處漏了空格(如 +access+r-clean、xrun.tcl+incdir、RI=5+access),本頁的指令都已修正。注意:元の規定のコマンドには空白の抜けが何か所かある(例えば +access+r-clean、xrun.tcl+incdir、RI=5+access)。このページのコマンドはすべて修正済みである。
15

Timing requirement時序要求タイミング要件

The gate-level simulation must not report any timing violation (setup / hold violation warnings); otherwise the design is treated as failing.Gate-level 模擬結果不能出現任何 timing violation(setup / hold violation 警告),否則視為未通過。ゲートレベルシミュレーションの結果に timing violation が一つも出てはならない(setup / hold violation の警告)。出た場合は不合格とみなされる。

16

Filling in the Excel sheet填寫 ExcelExcel の記入

Enter the circuit figures of your best version into Summary_Table_for_EP1.xlsx: Area (after synthesis), Period (the clock period), Power, Latency (the time or number of cycles from input to output), and whether the simulation passed.將最佳版本設計的電路資訊填入 Summary_Table_for_EP1.xlsx:Area(合成後面積)、Period(時脈週期)、Power(功耗)、Latency(輸入到輸出所需時間或 cycle 數),以及模擬是否通過。最良の版の回路情報を Summary_Table_for_EP1.xlsx に記入する。Area(合成後の面積)、Period(クロック周期)、Power(消費電力)、Latency(入力から出力までの時間またはサイクル数)、そしてシミュレーションに合格したかどうかである。

17

Change the period in both files at once修改 Period 時要同步兩個檔案Period を変更するときは 2 つのファイルを揃える

REFRACT.sdcTiming constraint for synthesis合成時的時序約束合成時のタイミング制約
tb.vClock period in the testbenchtestbench 中的 clock 週期テストベンチ中の clock 周期

The two must agree, or the timing target used for synthesis will not match the clock the simulation actually runs at.兩邊必須一致,否則合成的時序目標和模擬實際使用的時脈會對不上。両者は一致していなければならない。さもないと合成のタイミング目標と、シミュレーションで実際に使うクロックが食い違う。

18

Files to submit繳交檔案提出ファイル

G01_[驗證碼]/
├── EP1_G01.ppt                  簡報
├── Summary_Table_for_EP1.xlsx   電路資訊表
├── REFRACT_syn.ddc              合成後的資料庫檔
└── REFRACT.v                    RTL 原始碼
Note: the RTL must be merged into a single REFRACT.v file.注意:RTL 必須合併成單一個 REFRACT.v 檔案。注意:RTL は単一の REFRACT.v ファイルにまとめる必要がある。

Checklist before submitting繳交前檢查提出前のチェック

✓ Synthesised with the ADFP_n16 process✓ 使用 ADFP_n16 製程合成✓ ADFP_n16 プロセスで合成した
✓ Both the RTL and the gate-level simulation pass✓ RTL 與 gate-level 模擬皆通過✓ RTL とゲートレベルのシミュレーションがどちらも通った
✓ No timing violation in the gate-level simulation✓ gate-level 模擬無任何 timing violation✓ ゲートレベルシミュレーションに timing violation がない
✓ The period in REFRACT.sdc matches the one in tb.v✓ REFRACT.sdc 與 tb.v 的 period 一致✓ REFRACT.sdc と tb.v の period が一致している
✓ The Excel sheet holds the figures of the best version✓ Excel 已填入最佳版本的數據✓ Excel に最良の版のデータを記入した
✓ The RTL is merged into a single REFRACT.v✓ RTL 已合併為單一 REFRACT.v✓ RTL を単一の REFRACT.v にまとめた
✓ The folder and file names follow the required format✓ 資料夾與檔名依規定格式命名✓ フォルダ名とファイル名が規定の形式に従っている