pychopmarg.com
Classes
- class pychopmarg.com.COM(com_params: COMParams, channels: Path | dict[str, list[Path]], vic_chnl_ix: int = 1, debug: bool = False, do_init: bool = True)[source]
Encoding of the IEEE 802.3-22 Annex 93A/178A ‘Channel Operating Margin’ (COM) specification.
- status_str = 'Ready'
- opt_mode = 2
- norm_mode = 1
- unit_amp = True
- tx_ix: int = 0
- rx_taps: ndarray[Any, dtype[Real]] = array([1.])
- dfe_taps: ndarray[Any, dtype[Real]] = array([], dtype=float64)
- gDC = 0.0
- gDC2 = 0.0
- vic_chnl_ix = 1
- cursor_ix: int = 0
- zp_sel = 0
- com_params = COMParams(fb=106.25, fstep=0.01, L=4, M=32, DER_0=0.0002, T_r=0.004, RLM=0.95, A_v=0.413, A_fe=0.413, A_ne=0.45, R_0=50, A_DD=0.02, SNR_TX=33, eta_0=6e-09, sigma_Rj=0.01, f_z=42.5, f_p1=42.5, f_p2=106.25, f_LF=1.328125, g_DC=[0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15], g_DC2=[0.0, -0.5, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4.0, -4.5, -5.0], tx_taps_min=[-0.06, 0.0, -0.34, -0.2, 0.0, 0.0], tx_taps_max=[0.0, 0.12, 0.0, 0.0, 0.0, 0.0], tx_taps_step=[0.005, 0.005, 0.005, 0.005, 0.0, 0.0], c0_min=0.5, f_r=0.58, dfe_min=array([0.]), dfe_max=array([0.85]), rx_taps_min=array([-0.7, -0.7, -0.7, -0.7, -0.7, 1. , -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7, -0.7]), rx_taps_max=array([0.7, 0.7, 0.7, 0.7, 0.7, 1. , 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7]), dw=5, R_d=array([50.]), C_d=[4e-05, 9e-05, 0.00011], C_b=[3e-05], C_p=[4e-05], L_s=[0.13, 0.15, 0.14], z_c=[87.5, 92.5], z_p=[33, 1.8], gamma0=0.0005, a1=0.00089, a2=0.0002, tau=0.006141, z_pB=1.8)
- debug = False
- chnls: list[tuple[tuple[Network, str], ndarray[Any, dtype[Comp]]]] = []
- chnls_noPkg: list[tuple[tuple[Network, str], ndarray[Any, dtype[Comp]]]] = []
- pulse_resps_nopkg: list[ndarray[Any, dtype[Real]]] = []
- pulse_resps_noeq: list[ndarray[Any, dtype[Real]]] = []
- nRxTaps: int = 0
- nRxPreTaps: int = 0
- rx_ffe_phase_matrix: ndarray[Any, dtype[Comp]] = array([], dtype=float64)
- property fb: float
Baud. rate (Hz)
- property ui: float
Unit interval (s)
- property nspui: int
Samples per UI
- property times: ndarray[Any, dtype[Real]]
System time vector (s); decoupled from system frequency vector!
- property fstep: float
Frequency step (Hz)
- property fmax: float
Maximum frequency (Hz)
- property freqs: ndarray[Any, dtype[Real]]
System frequency vector (Hz); decoupled from system time vector!
- property Xsinc: ndarray[Any, dtype[Real]]
Frequency domain sinc(f) corresponding to Rect(ui) in time domain.
- property Ht: ndarray[Any, dtype[Comp]]
Return the voltage transfer function, H(f), associated w/ the Tx risetime, according to (93A-46).
- property num_tx_combs: int
Return the number of available Tx FFE tap weight combinations.
- property Hr: ndarray[Any, dtype[Comp]]
Return the voltage transfer function, H(f), of the Rx AFE, according to (93A-20).
- property Hctf: ndarray[Any, dtype[Comp]]
Return the voltage transfer function, H(f), of the Rx CTLE, according to (93A-22).
- calc_Hctf(gDC: float | None = None, gDC2: float | None = None) ndarray[Any, dtype[Comp]][source]
Return the voltage transfer function, H(f), of the Rx CTLE, according to (93A-22).
- Keyword Arguments:
gDC – CTLE first stage d.c. gain (dB). Default: None
gDC2 – CTLE second stage d.c. gain (dB). Default: None
Notes
1. The instance’s current value(s) for
gDCandgDC2are used if not provided. (Necessary, to accommodate sweeping when optimizing EQ.)
- property gamma1_Tx: float
Reflection coefficient looking out of the left end of the channel.
- property gamma2_Tx: float
Reflection coefficient looking out of the right end of the channel.
- property gamma1_Rx: float
Reflection coefficient looking out of the left end of the channel.
- property gamma2_Rx: float
Reflection coefficient looking out of the right end of the channel.
- sDie(isRx: bool) Network[source]
On-die parasitic capacitance/inductance ladder network, including bump.
- property sPkgRx: Network
Rx package response.
- property sPkgTx: Network
Tx package response.
- property sPkgNEXT: Network
NEXT package response.
- add_pkg(ntwk: tuple[Network, str]) tuple[tuple[Network, str], ndarray[Any, dtype[Comp]]][source]
Add package response to raw channel and pre-calculate H21.
- sC(c: float) Network[source]
Return the 2-port network corresponding to a shunt capacitance, according to (93A-8).
- Parameters:
c – Value of shunt capacitance (F).
- Returns:
2-port network equivalent to shunt capacitance, calculated at given frequencies.
- Htx(tx_taps_ix: int) ndarray[Any, dtype[Comp]][source]
Return the complex frequency response of the Tx deemphasis filter.
- Parameters:
tx_taps_ix – Index into the Tx tap weight combinations list.
- Returns:
Complex frequency response of Tx deemphasis filter.
- Hffe_Rx(taps: ndarray[Any, dtype[Real]] | None = None) ndarray[Any, dtype[Comp]][source]
Return the complex frequency response of the Rx FFE.
- Keyword Arguments:
taps – Tap weights to use for calculation. Default: None (Means “use self.rx_taps”.)
- Returns:
Complex frequency response of Rx FFE.
- Raises:
ValueError – If
tapsis supplied and the length is wrong.
- H(H21: ndarray[Any, dtype[Comp]], tx_ix: int, Hctf: ndarray[Any, dtype[Comp]] | None = None, rx_taps: ndarray[Any, dtype[Real]] | None = None, dfe_taps: ndarray[Any, dtype[Real]] | None = None, passive_RxFFE: bool = False) ndarray[Any, dtype[Comp]][source]
Return the voltage transfer function, H(f), of a complete COM signal path, according to (93A-19).
- Parameters:
H21 – Voltage transfer function of channel + package.
tx_ix – Tx FFE tap weights index.
- Keyword Arguments:
Hctf – Complex voltage transfer function of CTLE. Default: None (i.e. - Calculate, using
self.gDC&self.gDC2.)rx_taps – Rx FFE tap weights. Default: None (i.e. - Use
self.rx_taps.)dfe_taps – Rx DFE tap weights. Default: None (i.e. - Use
self.dfe_taps.)passive_RxFFE – Enforce passivity of Rx FFE when True. Default: True
- Returns:
Complex voltage transfer function of complete path.
- Raises:
ValueError – If the length of the given voltage transfer function
differs from the length of the system frequency vector. –
Notes
It is in this processing step that linear EQ is first applied.
2. Any unprovided EQ values are taken from the
COMinstance. If you really want to omit a particular EQ component then call with:tx_taps: []rx_taps: [1.0]Hctle: ones(len(self.freqs))
- pulse_resp(H: ndarray[Any, dtype[Comp]]) ndarray[Any, dtype[Real]][source]
Return the unit pulse response, p(t), corresponding to the given voltage transfer function, H(f), according to (93A-24).
- Parameters:
H – The voltage transfer function, H(f). Note: Possitive frequency components only, including fN.
- Returns:
The pulse response corresponding to the given voltage transfer function.
- Raises:
ValueError – If the length of the given voltage transfer function differs from that of the system frequency vector.
Notes
The pulse response is trimmed to match the length of the system time vector.
- gen_pulse_resps(chnls: list[tuple[tuple[Network, str], ndarray[Any, dtype[Comp]]]] | None = None, Hctf: ndarray[Any, dtype[Comp]] | None = None, tx_ix: int | None = None, rx_taps: ndarray[Any, dtype[Real]] | None = None, dfe_taps: ndarray[Any, dtype[Real]] | None = None, apply_eq: bool = True) list[ndarray[Any, dtype[Real]]][source]
Generate pulse responses for all networks.
- Keyword Arguments:
chnls – The list of networks to generate pulse responses for. Default: None (i.e. - Use
self.chnls.)Hctf – Complex voltage transfer function of CTLE. Default: None (i.e. - Calculate, using
self.gDC&self.gDC2.)tx_ix – Desired Tx tap weights index. Default: None (i.e. - Use
self.tx_ix.)rx_taps – Desired Rx FFE tap weights. Default: None (i.e. - Use
self.rx_taps.)dfe_taps – Desired Rx DFE tap weights. Default: None (i.e. - Use
self.dfe_taps.)apply_eq – Include linear EQ when True; otherwise, exclude it. (Allows for pulse response generation of terminated, but unequalized, channel.) Default: True
- Returns:
list of pulse responses.
Notes
1. Assumes
self.gDC,self.gDC2,self.tx_taps,self.rx_taps, andself.dfe_tapshave been set correctly, if the equivalent function parameters have not been provided.2. To generate pulse responses that include all linear EQ except the Rx FFE/DFE (i.e. - pulse responses suitable for Rx FFE/DFE tap weight optimization, via either
optimize.przf()oroptimize.mmse()), setrx_tapsequal to:[1.0]anddfe_tapsequal to:[].
- calc_fom(tx_ix: int, Hctf: ndarray[Any, dtype[Comp]], rx_taps: ndarray[Any, dtype[Real]] | None = None, opt_mode: OptMode | None = None, norm_mode: NormMode | None = None, unit_amp: bool | None = None, n_pre: int | None = None) float[source]
Calculate the figure of merit (FOM), given the existing linear EQ settings. Optimize Rx FFE taps if they aren’t specified by caller.
- Parameters:
tx_ix – Index into the list of Tx tap weight combinations.
Hctf – Complex voltage transfer function of CTLE.
- Keyword Arguments:
rx_taps – Rx FFE tap weight overrides. Default: None (i.e. - Optimize Rx FFE tap weights.)
opt_mode – Optimization mode. Default: None (i.e. - Use
self.opt_mode.)norm_mode – The tap weight normalization mode to use. Default: None (i.e. - Use
self.norm_mode.)unit_amp – Enforce unit pulse response amplitude when True. (For comparing
optimize.przf()results tooptimize.mmse()results.) Default: None (i.e. - Useself.unit_amp.)n_pre – Number of pre-cursor taps to use in calculating ISI. Default: None (i.e. - Use
self.nRxPreTaps.)
- Returns:
The resultant figure of merit.
Notes
See: IEEE 802.3-2022 93A.1.6.
Unlike other member functions of the
COMclass, this function optimizes the Rx FFE tap weights when they are not provided.
- opt_eq(do_opt_eq: bool = True, tx_taps: ndarray[Any, dtype[Real]] | None = None, opt_mode: OptMode | None = None, norm_mode: NormMode | None = None, unit_amp: bool | None = None) bool[source]
Find and set the optimum values for the linear equalization parameters:
c[n],gDC,gDC2, andw[n]as per IEEE 802.3-22 93A.1.6 (or, [1] slide 11 if MMSE has been chosen).- Keyword Arguments:
do_opt_eq – Perform optimization of linear EQ when True. Default: True
tx_taps – Used when
do_opt_eq= False. Default: Noneopt_mode – Optimization mode. Default: None (i.e. - Use
self.opt_mode.)norm_mode – The tap weight normalization mode to use. Default: None (i.e. - Use
self.norm_mode.)unit_amp – Enforce unit pulse response amplitude when True. (For comparing
przf()results tommse()results.) Default: None (i.e. - Useself.unit_amp.)
- Returns:
True if no errors encountered; False otherwise.
Notes
The found optimum equalization values are set for the instance.
- calc_noise(cursor_ix: int | None = None) tuple[float, float, int][source]
Calculate the interference and noise for COM.
- Keyword Arguments:
cursor_ix – An optional predetermined cursor index, to be used instead of our own estimate. (In support of MMSE.) Default: None
- Returns:
A triplet containing
signal amplitude (V)
noise + interference amplitude (V)
cursor location within victim pulse response vector
Notes
Assumes the following instance variables have been set optimally:
gDCgDC2tx_ixrx_taps
(This assumption is embedded into the
gen_pulse_resps()function.)Fills in the
com_resultsdictionary w/ various useful values for debugging.
- about_str = '\n <H2><em>PyChOpMarg</em> - A Python implementation of COM, as per IEEE 802.3-22 Annex 93A/178A.</H2>\n\n <strong>By:</strong> David Banas <capn.freako@gmail.com><p>\n\n <strong>On:</strong> January 20, 2025<p>\n\n <strong>At:</strong> v3.1.0\n\n <H3>Useful Links</H3>\n\n (You\'ll probably need to: right click, select <em>Copy link address</em>, and paste into your browser.)\n <UL>\n\n <LI><a href="https://github.com/capn-freako/PyChOpMarg"><em>GitHub</em> Home</a>\n <LI><a href="https://pypi.org/project/PyChOpMarg/"><em>PyPi</em> Home</a>\n <LI><a href="https://readthedocs.org/projects/pychopmarg/"><em>Read the Docs</em> Home</a>\n </UL>\n '