|
5 | 5 | #include "common/parameters.h" |
6 | 6 | #include "ams/rx_ctle.h" |
7 | 7 | #include "ams/rx_vga.h" |
8 | | -#include "ams/rx_dfe.h" |
| 8 | +#include "ams/rx_dfe_summer.h" |
9 | 9 | #include "ams/rx_sampler.h" |
10 | 10 | #include "ams/rx_cdr.h" |
| 11 | +#include "ams/adaption.h" |
11 | 12 |
|
12 | 13 | namespace serdes { |
13 | 14 |
|
14 | 15 | /** |
15 | 16 | * @brief RX Top-level Module |
16 | 17 | * |
17 | 18 | * Integrates the complete RX signal chain: |
18 | | - * Differential Input → CTLE → VGA → DFE_P/DFE_N → Sampler ↔ CDR → Digital Output |
| 19 | + * Differential Input → CTLE → VGA → DFE Summer → Sampler ↔ CDR → Digital Output |
| 20 | + * ↑ ↓ |
| 21 | + * Adaption (DE domain) ←───┘ |
19 | 22 | * |
20 | 23 | * Signal Flow: |
21 | 24 | * - External differential input (from Channel or test source) |
22 | 25 | * - CTLE: Continuous-Time Linear Equalizer for high-frequency boost |
23 | 26 | * - VGA: Variable Gain Amplifier for amplitude adjustment |
24 | | - * - DFE: Decision Feedback Equalizer (dual instances for differential) |
25 | | - * - DFE_P: Positive path with normal taps |
26 | | - * - DFE_N: Negative path with negated taps (for differential symmetry) |
| 27 | + * - DFE Summer: Decision Feedback Equalizer (差分架构,单实例) |
27 | 28 | * - Sampler: Decision circuit with hysteresis |
28 | 29 | * - CDR: Clock and Data Recovery (closed-loop with Sampler) |
| 30 | + * - Adaption: DE domain adaptive control (AGC, DFE tap update, threshold adaptation) |
29 | 31 | * |
30 | 32 | * Key Features: |
31 | | - * - Dual DFE architecture for differential processing |
| 33 | + * - 差分 DFE Summer 架构替代双 DFE 实例 |
| 34 | + * - Adaption 模块集成 (DE 域自适应控制) |
| 35 | + * - DE-TDF 桥接使用 sca_tdf::sca_de::sca_in/out |
32 | 36 | * - CDR closed-loop: Sampler.phase_offset ← CDR.phase_out |
33 | 37 | * - Phase-driven sampling mode (CDR controls sampling phase) |
34 | 38 | * |
@@ -58,9 +62,12 @@ SC_MODULE(RxTopModule) { |
58 | 62 | /** |
59 | 63 | * @brief Construct RX top module |
60 | 64 | * @param nm Module name |
61 | | - * @param rx_params RX parameters (CTLE, VGA, DFE, Sampler, CDR) |
| 65 | + * @param rx_params RX parameters (CTLE, VGA, DFE Summer, Sampler, CDR) |
| 66 | + * @param adaption_params Adaption parameters (DE 域自适应控制) |
62 | 67 | */ |
63 | | - RxTopModule(sc_core::sc_module_name nm, const RxParams& rx_params); |
| 68 | + RxTopModule(sc_core::sc_module_name nm, |
| 69 | + const RxParams& rx_params, |
| 70 | + const AdaptionParams& adaption_params); |
64 | 71 |
|
65 | 72 | /** |
66 | 73 | * @brief Destructor - clean up sub-modules |
@@ -127,38 +134,81 @@ SC_MODULE(RxTopModule) { |
127 | 134 |
|
128 | 135 | private: |
129 | 136 | // ======================================================================== |
130 | | - // Sub-modules |
| 137 | + // Sub-modules (TDF domain) |
131 | 138 | // ======================================================================== |
132 | | - RxCtleTdf* m_ctle; ///< Continuous-Time Linear Equalizer |
133 | | - RxVgaTdf* m_vga; ///< Variable Gain Amplifier |
134 | | - RxDfeTdf* m_dfe_p; ///< DFE for P path (normal taps) |
135 | | - RxDfeTdf* m_dfe_n; ///< DFE for N path (negated taps) |
136 | | - RxSamplerTdf* m_sampler; ///< Decision circuit |
137 | | - RxCdrTdf* m_cdr; ///< Clock and Data Recovery |
| 139 | + RxCtleTdf* m_ctle; ///< Continuous-Time Linear Equalizer |
| 140 | + RxVgaTdf* m_vga; ///< Variable Gain Amplifier |
| 141 | + RxDfeSummerTdf* m_dfe_summer; ///< 差分 DFE Summer (替代双 DFE) |
| 142 | + RxSamplerTdf* m_sampler; ///< Decision circuit |
| 143 | + RxCdrTdf* m_cdr; ///< Clock and Data Recovery |
138 | 144 |
|
139 | 145 | // ======================================================================== |
140 | | - // Internal Signals |
| 146 | + // Sub-modules (DE domain) |
| 147 | + // ======================================================================== |
| 148 | + AdaptionDe* m_adaption; ///< DE 域自适应控制模块 |
| 149 | + |
| 150 | + // ======================================================================== |
| 151 | + // Internal TDF Signals |
141 | 152 | // ======================================================================== |
142 | 153 |
|
143 | 154 | // CTLE output → VGA input |
144 | 155 | sca_tdf::sca_signal<double> m_sig_ctle_out_p; ///< CTLE positive output |
145 | 156 | sca_tdf::sca_signal<double> m_sig_ctle_out_n; ///< CTLE negative output |
146 | 157 |
|
147 | | - // VGA output → DFE input |
| 158 | + // VGA output → DFE Summer input |
148 | 159 | sca_tdf::sca_signal<double> m_sig_vga_out_p; ///< VGA positive output |
149 | 160 | sca_tdf::sca_signal<double> m_sig_vga_out_n; ///< VGA negative output |
150 | 161 |
|
151 | | - // DFE output → Sampler input |
152 | | - sca_tdf::sca_signal<double> m_sig_dfe_out_p; ///< DFE_P output |
153 | | - sca_tdf::sca_signal<double> m_sig_dfe_out_n; ///< DFE_N output |
| 162 | + // DFE Summer output → Sampler input |
| 163 | + sca_tdf::sca_signal<double> m_sig_dfe_out_p; ///< DFE Summer positive output |
| 164 | + sca_tdf::sca_signal<double> m_sig_dfe_out_n; ///< DFE Summer negative output |
154 | 165 |
|
155 | 166 | // Sampler → CDR → Sampler (closed loop) |
156 | 167 | sca_tdf::sca_signal<double> m_sig_sampler_out; ///< Sampler decision output |
157 | 168 | sca_tdf::sca_signal<double> m_sig_cdr_phase; ///< CDR phase output → Sampler |
| 169 | + sca_tdf::sca_signal<double> m_sig_cdr_in; ///< CDR input (from splitter) |
| 170 | + |
| 171 | + // Sampler → DFE Summer (历史判决反馈) |
| 172 | + sca_tdf::sca_signal<double> m_sig_data_feedback; ///< Data feedback for DFE |
158 | 173 |
|
159 | 174 | // Dummy clock for Sampler (unused in phase-driven mode but required) |
160 | 175 | sca_tdf::sca_signal<double> m_sig_clk; |
161 | 176 |
|
| 177 | + // ======================================================================== |
| 178 | + // DE-TDF Bridge Signals (Adaption ↔ TDF modules) |
| 179 | + // ======================================================================== |
| 180 | + |
| 181 | + // Adaption outputs (DE domain) → TDF modules |
| 182 | + sc_core::sc_signal<double> m_sig_vga_gain_de; ///< VGA gain control |
| 183 | + sc_core::sc_signal<double> m_sig_dfe_tap1_de; ///< DFE tap 1 |
| 184 | + sc_core::sc_signal<double> m_sig_dfe_tap2_de; ///< DFE tap 2 |
| 185 | + sc_core::sc_signal<double> m_sig_dfe_tap3_de; ///< DFE tap 3 |
| 186 | + sc_core::sc_signal<double> m_sig_dfe_tap4_de; ///< DFE tap 4 |
| 187 | + sc_core::sc_signal<double> m_sig_dfe_tap5_de; ///< DFE tap 5 |
| 188 | + sc_core::sc_signal<double> m_sig_sampler_threshold_de; ///< Sampler threshold |
| 189 | + sc_core::sc_signal<double> m_sig_sampler_hysteresis_de; ///< Sampler hysteresis |
| 190 | + sc_core::sc_signal<double> m_sig_phase_cmd_de; ///< Phase command |
| 191 | + |
| 192 | + // TDF modules → Adaption inputs (DE domain) |
| 193 | + sc_core::sc_signal<double> m_sig_phase_error_de; ///< Phase error from CDR |
| 194 | + sc_core::sc_signal<double> m_sig_amplitude_rms_de; ///< Amplitude RMS |
| 195 | + sc_core::sc_signal<int> m_sig_error_count_de; ///< Error count |
| 196 | + sc_core::sc_signal<double> m_sig_isi_metric_de; ///< ISI metric |
| 197 | + sc_core::sc_signal<int> m_sig_mode_de; ///< Operating mode |
| 198 | + sc_core::sc_signal<bool> m_sig_reset_de; ///< Reset signal |
| 199 | + sc_core::sc_signal<double> m_sig_scenario_switch_de; ///< Scenario switch |
| 200 | + sc_core::sc_signal<bool> m_sig_sampler_data_out_de; ///< Sampler DE output |
| 201 | + |
| 202 | + // Adaption 其他输出信号 |
| 203 | + sc_core::sc_signal<double> m_sig_ctle_zero_de; |
| 204 | + sc_core::sc_signal<double> m_sig_ctle_pole_de; |
| 205 | + sc_core::sc_signal<double> m_sig_ctle_dc_gain_de; |
| 206 | + sc_core::sc_signal<double> m_sig_dfe_tap6_de; |
| 207 | + sc_core::sc_signal<double> m_sig_dfe_tap7_de; |
| 208 | + sc_core::sc_signal<double> m_sig_dfe_tap8_de; |
| 209 | + sc_core::sc_signal<int> m_sig_update_count_de; |
| 210 | + sc_core::sc_signal<bool> m_sig_freeze_flag_de; |
| 211 | + |
162 | 212 | // ======================================================================== |
163 | 213 | // Internal Helper Modules |
164 | 214 | // ======================================================================== |
@@ -196,24 +246,40 @@ SC_MODULE(RxTopModule) { |
196 | 246 | void processing() override { out.write(in.read()); } |
197 | 247 | }; |
198 | 248 |
|
199 | | - ConstClockSource* m_clk_src; ///< Dummy clock source |
200 | | - SignalPassThrough* m_data_out_tap; ///< Pass-through for external data_out |
| 249 | + /** |
| 250 | + * @brief Signal splitter - reads one signal and writes to two outputs |
| 251 | + * Used to split sampler output to CDR and data feedback |
| 252 | + */ |
| 253 | + class SignalSplitter : public sca_tdf::sca_module { |
| 254 | + public: |
| 255 | + sca_tdf::sca_in<double> in; |
| 256 | + sca_tdf::sca_out<double> out1; |
| 257 | + sca_tdf::sca_out<double> out2; |
| 258 | + |
| 259 | + SignalSplitter(sc_core::sc_module_name nm) |
| 260 | + : sca_tdf::sca_module(nm), in("in"), out1("out1"), out2("out2") {} |
| 261 | + |
| 262 | + void set_attributes() override { |
| 263 | + in.set_rate(1); |
| 264 | + out1.set_rate(1); |
| 265 | + out2.set_rate(1); |
| 266 | + } |
| 267 | + void processing() override { |
| 268 | + double val = in.read(); |
| 269 | + out1.write(val); |
| 270 | + out2.write(val); |
| 271 | + } |
| 272 | + }; |
| 273 | + |
| 274 | + ConstClockSource* m_clk_src; ///< Dummy clock source |
| 275 | + SignalPassThrough* m_data_out_tap; ///< Pass-through for external data_out |
| 276 | + SignalSplitter* m_sampler_splitter; ///< Splitter for sampler output |
201 | 277 |
|
202 | 278 | // ======================================================================== |
203 | 279 | // Parameters |
204 | 280 | // ======================================================================== |
205 | 281 | RxParams m_params; |
206 | | - RxDfeParams m_dfe_params_n; ///< Negated taps for DFE_N path |
207 | | - |
208 | | - // ======================================================================== |
209 | | - // Private Methods |
210 | | - // ======================================================================== |
211 | | - |
212 | | - /** |
213 | | - * @brief Setup negated DFE taps for N path |
214 | | - * For differential symmetry: taps_n[i] = -taps_p[i] |
215 | | - */ |
216 | | - void setup_dfe_negated_taps(); |
| 282 | + AdaptionParams m_adaption_params; |
217 | 283 | }; |
218 | 284 |
|
219 | 285 | } // namespace serdes |
|
0 commit comments