This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %Generation of colored noise in Matlab | |
| a=0.9; %low pass filter parameter | |
| Fs=1000; %sampling rate | |
| Fc=10; % carrier frequency for the dummy signal | |
| recordDuration=120; % seconds; a longer record reduces PSD estimation variance | |
| numSamples=round(recordDuration*Fs); | |
| t=(0:numSamples-1)/Fs; %time base | |
| variance = 1; %variance of white noise |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """ | |
| Closed-loop oscillator noise verification | |
| PN targets -> sigma_p^2(N) (table) -> per-period jitter injection | |
| -> edge accumulation -> recomputed PN, plus direct sigma_p(N) check. | |
| Conventions | |
| L(f) = S_phi(f)/2, S_phi one-sided, phase sampled once per period (fs = f0). | |
| Absolute jitter J(n) = t_n - n*T0, phase phi(n) = 2*pi*f0*J(n). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Neat two-level ODE check of the slide (Dw0 = 0), one eps, one figure (3 panels). | |
| Level 1 (phase ODE, eq.3): da/dt = -B sin(a), B = (E1/E) * w0/(2Q) | |
| Level 2 (raw circuit ODE): C dv/dt + v/R + iL = Ip*sgn(v) + eps*I1*sin(w_osc*t) | |
| L diL/dt = v | |
| Both start at a0 = 90 deg (v0 ~ cos, injection ~ sin) and are compared with | |
| the slide's closed form tan(a/2) = exp(-Bt)*tan(a0/2) and with a0*exp(-Bt). | |
| Two waveform panels show v0(t) right after injection turns on (90 deg ahead | |
| of i_n) and in steady state ((1+eps)*I1*R*sin, in phase with i_n). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """ | |
| fit_xcp.py -- extract Verilog-A parameters for xcp_nr.va | |
| Model of the swept differential I-V of a MOS cross-coupled pair, including | |
| the triode fold-back and the finite-voltage headroom cutoff: | |
| x = v/vzero, w = max(1 - x^2, 0) | |
| i(v) = -gm0 * v * exp(shape*x^2) * w^2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ----------------------------------------------------------------------------- | |
| // gnr.va | |
| // | |
| // Verilog-A model of the nonlinear active resistor g_nr of Fig. 9.7, plus an | |
| // optional all-Verilog-A testbench of the complete LC oscillator. | |
| // | |
| // The DC characteristic in the inset is an odd, saturating curve: | |
| // | |
| // i(v) = -isat * tanh(v/v0), v0 = isat/g0 | |
| // g_nr(v) = di/dv = -g0 * sech^2(v/v0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Emulation: average output of a phase detector (XOR) vs a phase-frequency | |
| detector (tri-state PFD) when the two inputs differ in frequency. | |
| Setup (open loop, no feedback): | |
| input A = reference square wave at f_a = 1 | |
| input B = "VCO" square wave at f_b = f_a - df | |
| Claims demonstrated: | |
| 1. XOR PD: time-average -> 0 for every df != 0, identical for +df and -df |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Inductive shunt peaking: bandwidth, peak frequency, and peaking gain | |
| as functions of m = R^2 * C / L. | |
| All frequencies are normalized to 1/RC (i.e. the plotted value is omega * RC). | |
| Smaller m <=> larger inductor L. | |
| Impedance: Z(s)/R = (1 + s L/R) / (1 + s R C + s^2 L C) | |
| With u = (omega * RC)^2 and m = R^2 C / L: | |
| |Z/R|^2 = (1 + u/m^2) / ((1 - u/m)^2 + u) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Quantization noise of a sinusoid: harmonic coefficients A_p, noise power, | |
| and the impact of the bit count n. | |
| Model: uniform quantizer, step Delta, input x(t) = A*sin(w t). | |
| The quantization error expands into ODD harmonics only: | |
| e(t) = sum_{p odd} A_p sin(p w t) | |
| For a mid-tread quantizer y = Delta*round(x/Delta) the error e = y - x has |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # modified from https://github.com/wulffern/aic2023/blob/main/ex/q.py | |
| #!/usr/bin/env python3 | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| #- Enable hanning window | |
| hann = True |
NewerOlder