本頁是 python_simu/relay_feedback2_gui.py 的位元精確 JS 移植。
RTL 本身是無因次的每取樣運算,因此 fclk 只會重新縮放時間/頻率座標軸
(f0 ≈ √kg / (1024π)·fclk)。
相關頁面:hilbert_90 I/Q 示範。Bit-accurate JS port of python_simu/relay_feedback2_gui.py.
The RTL is dimensionless per-sample, so fclk only rescales the time/frequency axes
(f0 ≈ √kg / (1024π)·fclk).
Companion page: hilbert_90 I/Q demo.本ページは python_simu/relay_feedback2_gui.py のビット精度 JS 移植です。
RTL は無次元のサンプル単位演算なので、fclk は時間/周波数軸を再スケールするだけです
(f0 ≈ √kg / (1024π)·fclk)。
関連ページ:hilbert_90 I/Q デモ。
relay_feedback2.v 是定點 RTL 振盪器,負責產生 DSIL(雙自我注入鎖定)
超音波雷達前端所用的載波。它是一個繼電器回授迴路:對狀態 f
取一位元符號,驅動 ±256 的方波經兩級串接的累加器回授,迴路最後穩定在一個極限環上。
裡面完全沒有乘法器,也沒有查表 — 迴路增益 kg 是以一連串算術右移相加來實現的,
這也是整個振盪器只需要幾個加法器的原因。relay_feedback2.v is the fixed-point RTL oscillator that generates the
carrier for the DSIL (dual self-injection-locked) ultrasonic radar front-end. It is a
relay-feedback loop: a one-bit sign detector on the state
f drives a ±256 square wave back through two cascaded
accumulators, and the loop settles into a limit cycle. There is no multiplier and no
lookup table anywhere in it — the loop gain kg is applied as a sum
of arithmetic right-shifts, which is why the whole oscillator costs a handful of adders.relay_feedback2.v は、DSIL(デュアル自己注入同期)超音波レーダー
フロントエンドのキャリアを生成する固定小数点 RTL 発振器です。リレー帰還
ループであり、状態 f の 1 ビット符号判定が ±256 の方形波を駆動し、
2 段縦続の積分器を通して帰還することでリミットサイクルに落ち着きます。乗算器もルックアップ
テーブルも一切ありません — ループ利得 kg は算術右シフトの和として
与えられており、これが発振器全体を数個の加算器で済ませている理由です。
本頁上的一切都是由 RTL 的位元精確 JavaScript 移植算出來的,
而不是浮點近似。18、24 與 28 位元的二補數溢位都被完全重現,kg 的移位分解也是
(kg = 166 展開成 (f>>3)+(f>>5)+(f>>8)+(f>>9),
逐位元一致)。這點很重要:這個設計最有趣的失效模式就是溢位,而浮點模型會把它藏起來。
把增益滑桿推過大約 216,就可以看到累加器溢位而不再起振。Everything on this page is computed by a bit-accurate JavaScript port
of the RTL, not by a floating-point approximation. The two's-complement wrap at 18, 24
and 28 bits is reproduced exactly, as is the shift-decomposition of kg
(kg = 166 becomes (f>>3)+(f>>5)+(f>>8)+(f>>9),
bit for bit). That matters: the interesting failure of this design is overflow, and a
floating-point model hides it. Push the gain slider past roughly 216 and you can watch
the accumulator wrap instead of oscillate.このページの内容はすべて、浮動小数点近似ではなく RTL のビット精度
JavaScript 移植で計算しています。18・24・28 ビットの 2 の補数の桁あふれも、kg
のシフト分解も厳密に再現しています(kg = 166 は
(f>>3)+(f>>5)+(f>>8)+(f>>9) にビット単位で一致)。
これは重要です。この設計で興味深い故障モードはまさにオーバーフローであり、
浮動小数点モデルではそれが見えません。利得スライダを 216 付近より上げると、
積分器が発振せずに桁あふれする様子を観察できます。
迴路中有兩個串接的積分器,因此極限環的頻率落在迴路相位達到 180° 之處, 並隨迴路增益的平方根變化:The loop contains two integrators in cascade, so the limit-cycle frequency lands where the loop phase reaches 180°, and it moves with the square root of the loop gain:ループには積分器が 2 段縦続に入っているため、リミットサイクル周波数はループ位相が 180° に達する点に決まり、ループ利得の平方根に従って動きます:
f0 ≈ √kg / (1024π) 週期/取樣 cycles per sample サイクル/サンプル
RTL 是無因次、純粹以取樣為單位的,所以 fclk 根本不出現在這個式子裡
— 移動時鐘滑桿只會重新縮放兩張圖的時間與頻率座標軸。在出貨設定 kg = 166 下
比值為 0.004005 週期/取樣,因此 10 MHz 的時鐘會把載波放在大約
40.05 kHz:正是換能器所設計的 40 kHz 超音波頻段,也是頂層模組叫做
new40kHz4.v 的原因。The RTL is dimensionless and purely per-sample, so fclk does not appear in
that expression — moving the clock slider only rescales the time and frequency
axes of the two charts. With the shipped kg = 166 the ratio is
0.004005 cycles/sample, so a 10 MHz clock puts the carrier at about
40.05 kHz: the 40 kHz ultrasonic band the transducer is built for, and
the reason the top-level module is called new40kHz4.v.RTL は無次元で完全にサンプル単位なので、この式に fclk は現れません
— クロックスライダを動かしても、2 つのグラフの時間軸と周波数軸が再スケールされるだけです。
出荷値 kg = 166 では比が 0.004005 サイクル/サンプルなので、10 MHz のクロックで
キャリアは約 40.05 kHz になります。これはトランスデューサが対象とする
40 kHz 超音波帯であり、トップモジュールが new40kHz4.v と呼ばれる理由でもあります。
f_inj / f0 與注入振幅兩個滑桿會在 y_in 埠注入一個方波。
振幅為零時振盪器自由振盪;把振幅拉高並讓注入頻率偏離,振盪器就不再以自己的頻率運行,
而是跟隨被注入的頻率 — 這正是典型的 Adler 注入鎖定。維持鎖定的頻率比範圍會隨注入振幅
而變寬,而這個鎖定範圍就是自我注入鎖定雷達的整個量測原理:目標的運動以注入訊號的形式進來,
振盪器的頻率偏移就是讀值。滑桿上標出兩個振幅,因為它們是硬性限制而非偏好:
192 LSB 是 3 位元 u_inj 埠所能承載的極限,300 LSB 則是仍然不會溢位的最大振幅。The f_inj / f0 and inj amp sliders inject a square wave on
the y_in port. With the amplitude at zero the oscillator free-runs. Raise
the amplitude and detune the injection, and the oscillator stops running at its own
frequency and follows the injected one instead — classic Adler injection locking.
The width of the ratio band over which it stays locked grows with the injection
amplitude, and that lock range is the whole measurement principle of a
self-injection-locked radar: the target's motion arrives as the injected signal, and the
oscillator's frequency shift is the readout. Two amplitudes are marked on the slider
because they are hard limits, not preferences: 192 LSB is all the 3-bit
u_inj port can carry, and 300 LSB is the largest amplitude that still
avoids a wrap.f_inj / f0 と注入振幅のスライダは、y_in ポートに方形波を
注入します。振幅がゼロなら発振器は自走します。振幅を上げて注入周波数をずらすと、発振器は
自身の周波数で動くのをやめ、注入された周波数に追従します — 典型的な Adler の注入同期です。
同期が保たれる周波数比の幅は注入振幅とともに広がり、この同期範囲こそが自己注入同期レーダーの
測定原理そのものです。ターゲットの動きが注入信号として入り、発振器の周波数偏移が読み値になります。
スライダ上に 2 つの振幅が示されているのは、好みではなく硬い制限だからです。192 LSB は 3 ビットの
u_inj ポートが運べる限界、300 LSB は桁あふれを起こさない最大振幅です。
← 回到雜項筆記back to Misc Ideas技術ノートに戻る · 昭群科技有限公司AkiraGather Technology昭群科技有限公司 AkiraGather Technology