100 Keywords – Holes

In reality, there are no holes! It just refers to positive charge.

The diagram below shows positive charge travels from the left to the right of silicon. At t1, one electron is released which produces a positive charge (indicated as a hole); at t2, the second electron is released and trapped in the hole shown in t1; at t3, the third electron is released and again trapped in the hole shown in t2.

This explains why movement of holes is shower than that of electrons.

For pure silicon, the density of holes is equal to the density of electrons (ni).

Posted in 100 Keywords | Tagged , , | 1 Comment

100 Keywords – Silicon

A silicon atom has 14 electrons. In its outmost shell, it has 4 valence electrons.

Covalent bonding in silicon:

Its resistivity drops as temperature rises.

Density of free electrons in silicon can be calculated as:

At T=300K,

¬†In the same cubic, there are 5×1022 silicon atoms. The ratio of electrons to silicon atoms is tiny tiny…Hence we need to do something to make it conducting.

Most of the information is gathered after watching the youtube video from Prof. Behzad Razavi’s Electronics 1. He is really talented at explaining things. If you have time, just skip mine and watch his video.

Posted in 100 Keywords | Tagged , | 1 Comment

100 Keywords – Preface

Feng Tang once said that if you want to know a bit about a new field, go and find 100 keywords. Digest them in two or three days, and you will look like a professional.

Somewhat make sense!

This triggers me to think about the keywords in my field – IC design. Astonishingly, some words are so common to me but I can’t tell the real details. Am I already a professional?! Maybe I can start a similar project in the dark cold Covid nordic winter to cheer up a little bit ūüôā

100 is not an absolute number to target, but in the beginning, let’s say 100. In addition, two or three days is also mission impossible for me, maybe two or three years…

Anyway, keep thinking and keep writing!

Posted in 100 Keywords | 1 Comment

CMOS Single Stage

Found an old drawing on CMOS single stage from many years ago. 


Stay healthy!

Posted in Analog Design | Leave a comment

Basics On Active-RC Low-Pass Filters

Just some basic understandings on analog filters which is inspired by ‘The Guru’ in our company. To clarify my thoughts, I will write in the format of Q&A. There are four questions to answer:

  1. What do we dream for a low-pass (LP) filter?
  2. Why complex poles are required?
  3. How to generate complex poles without inductor?
  4. Any real-life example?

Q1) What do we dream for a low-pass (LP) filter?

An ideal one, which has a brick-wall response. We only receive what we intend to receive, pure and loss-free. But, in reality…


Fig.1 Brick-wall response (in red) Vs. reality (in bluish)

Q2) Why complex poles are required?

Complex poles help to lift up the magnitude around the cut-off frequency by contributing larger pole quality factor (Q).

If we only have real poles, though higher-order gives better roll-off, the loss of magnitude around cut-off frequency becomes bigger. 


Fig.2 A system from order 1 to 5 which only have real poles

Now we move to a system which has complex poles. Taking the 5th-order Butterworth filter as an example, which has a real pole and two pairs of complex poles, the complex poles with a Q of 1.618 help to compensate the loss of magnitude around cut-off frequency. It tries to approximate the brick-wall response.


Fig.3 Generating 5th-order butterworth lowpass by multiplying (cascading) three transfer functions (1 one-pole + 2 biquads)

Q3) How to generate complex poles without inductor?

The answer is Feedback! R and C only generate real poles. When feedback is applied around a system containing real roots, the closed-loop transfer function may contain complex roots. 

Let’s think of this example: an amplifier with two poles. Its transfer function can be written as:

A(s)=\frac{A_0 \omega_1 \omega_2}{(s+\omega_1)(s+\omega_2)}.

The poles are generated by Rs and Cs in the amplifier and they are real. Now assume a negative feedback of beta is placed around the amplifier. The closed-loop transfer function becomes:

A_{cl}(s)=\frac{A(s)}{1+\beta A(s)}= \frac{A_0 \omega_1 \omega_2}{s^2+(\omega_1+\omega_2)s + \omega_1 \omega_2(1+\beta A_0)}.

We can then calculate the two poles of the closed-loop transfer function:

p_{1,2}=-\frac{\omega_1 + \omega_2}{2} \pm \frac{1}{2} \sqrt{(\omega_1 + \omega_2)^2 - 4\omega_1 \omega_2(1+\beta A_0)}.

By increasing \beta A_0, complex poles can be achieved! 


Fig.4 An illustration example of root-locus of poles when A*beta is increased from 0 to infinity

Q4) Any real-life example?

Of course. Fig.4 shows the Two-Thomas biquad. Without the feedback resistor R2, the open-loop transfer function has two real poles: one pole generated by R3 and C1 and the other pole at origin. With a feedback resistor applied, the two poles will move towards each other, arrive at the same position, and then leave the real axis, becoming complex poles.


Fig.4 The common Two-Thomas biquad filter (Wikipedia)

Posted in Analog Design, Circuit Analysis | Tagged , , , | Leave a comment

Leading Simulators for Analog/RF Circuits

Recently I have the opportunity to touch some RF design. WoW, some simple metal lines need a fancy tool to get them modeled! WoW, both Windows and Unix tools are involved to simulate the EVM!

It seems that Cadence Spectre just can’t do it on its own any more. Really? I start to ask myself which simulator or which way of simulation is more efficient for my design. Then I found this paper published in 2014, titled “Overview of Commercially-Available Analog/RF Simulation Engines and Design Environment”. Yep, it’s helpful (at least to a RF newbie). It reviews four main analog/RF simulators on the market:

  • Cadence Spectre
  • Agilent ADS (now Keysight, which was spun off from Agilent in 2014)
  • Agilent GoldenGate (again now Keysight)
  • Mentor Graphics AFS

Cadence Spectre, an evolved engine from SPICE, is good at transient analysis. However, the transient analysis may become expensive when it deals with RF signals, the signals normally containing a periodic high-frequency carrier and a low-frequency modulation signal. The carrier forces a small time step while the signal forces a long simulation interval. To speed up the RF simulation, harmonic balance (HB) comes in, which works on frequency domain. Though ADS provides a best-in-class HB simulator for RF design, its layout suite is inferior to Cadence Virtuoso environment. Hence the Spectre simulator  is still widely used as the standard sign-off simulator. Recently, to leverage ADS for RF simulation and Cadence for schematic capture and layout, GoldenGate is highly integrated into the Cadence design flow as an efficient hybrid method.

It is obvious that which simulator to choose depends pretty much on the signal nature. In general, for circuits with a few frequency components, like LNA and mixer, the frequency-domain technique is more efficient, while time-domain technique is more efficient for circuits with abrupt edges, like ADC/DAC or control logics. Many interesting details are described in the paper. Fig.1 provides a short summary.


Fig.1 A short performance summary [1]

Note that MTS is the acronym of multi-technology simulations. We typically design circuits within a single design kit. However, for some RF products, they may be composed of different modules from different processes. According to the paper, Cadence’s ADE GXL can do MTS simulations.


[1] B. Wan and X. Wang, “Overview of commercially-available analog/RF simulation engines and design environment,” 12th IEEE International Conference on Solid-State and Integrated Circuit Technology (ICSICT), 2014.

Posted in Analog Design, RF Design | Tagged | Leave a comment

Pulse Generator of Asynchronous SAR ADC

When it comes to designing SAR ADC, I am like a tortoise and can never imagine the world of rabbits. Recently I got some time to ponder how the rabbits can run so fast. One of the critical factors is that they have an internal asynchronous clock.

When it comes to digital signals, I always feel dizzy examining their timing sequences. It did take me a while to understand how the internal asynchronous clock is generated. In this post, I tried to write down the core idea behind the pulse generator of asynchronous SAR ADC.

First of all, the pulse generator (Fig.1) needs a dynamic latch comparator! At the reset phase, the differential outputs are both set to low; at the comparison phase, once the regeneration is complete, one of the differential outputs will go to high and another stay at low. This property is utilized by a succeeding NAND which will output a valid signal indicating the completion of comparison.

Since the comparison starts at the negative edge, the sample signal is used to trigger the first comparison of the latch. Once the comparison is finished, the valid signal will generate a positive edge. With an OR function of sample and valid, following certain deliberate delay, the clock of the latch can be generated.


Fig.1 An example of pulse generator

Figure 7‚ÄĎ2 depicts the timing sequences of three critical signals (sample, clk, and valid). Four sources of delay keep the asynchronous machine running:

  • td1 is composed of the delay of the OR gate, the charging path of VDC, and the succeeding inverter.
  • td2 is composed of the regeneration time of the latch, the delay of the following inverter and the NAND gate.
  • td3 is composed of the delay of the OR gate, the discharging path of VDC, and the succeeding inverter.
  • td4 is composed of the reset time of the latch, the delay of the following inverter and the NAND gate.


Fig.2 Timing sequences of critical signals

The low level of the generated clk is the sum of td2 and td3, which varies as the input of the comparator changes. The high level of clk is the sum of td1 and td4, which is input-independent. One must pay attention to the DAC settling, which happens when clk goes high. The VDC can then be programmed/configured to ensure accurate DAC settling.

In summary, in order to increase the sample rate, the low level of clk should be as short as possible by speeding up the comparator, while the high level of clk should be long enough for the DAC to be fully settled. Worth to mention here, though the delay of digital control logic is not included in the discussion, it also become rather critical in high-speed design. This post is just a touch of the sphere of high-speed SAR ADC design. Salut to those who race in this challenging field!

Posted in Data Converter | 1 Comment

Ringing in Step Response

Is it possible to tell the stability of a negative-feedback circuit by just looking at its step response? The answer is yes. In this post, I will try to find the relationship between phase margin and ringing in step response.

I will start from the frequency domain and play with the equations we are familiar with.¬†To simplify the problem, I assume it’s a unity negative-feedback second-order system. Denoting the DC gain by A, the two poles by f1 and f2, the unity-gain bandwidth by GBW (=Af1), the open-loop gain can be written as


The closed-loop gain can be thereafter written as

A_c=\frac{A_o}{1+A_o} \approx \frac{1}{1+j\frac{f}{GBW}+j^2\frac{f^2}{GBW f_2}}.

Express the denominator in the familiar control theory form, 1+j 2 \zeta \frac{f}{f_n}+j^2 \frac{f^2}{f^2_n}, where őĺ is the damping factor and fn the natural frequency.

\zeta = \frac{1}{2} \sqrt{\frac{f_2}{GBW}}     and    f_n = \sqrt{GBW f_2}

If we take a close look at the damping factor, which tells the relative position between the second pole and the unity loop gain bandwidth, we shall know the phase margin as has been discussed in one of my old posts.

The peaking in the amplitude response can be found at f=f_n \sqrt{1-2\zeta^2} with a value equal to

P_f = \frac{1}{2 \zeta \sqrt{1-\zeta^2}}.


Fig.1 Peaking in amplitude response

Now we have derived the relationship between phase margin and peaking in amplitude response. Let’s continue to look at the time domain. Considering we normally care about the underdamped case (őĺ<1), the equation of its step response can be written as (detailed explanation and derivation can be referred to this link)

y(t) = 1 - \frac{1}{1 - \zeta^2} e^{- \zeta \omega_n t} sin(\omega_n (\sqrt{1-\zeta^2})t+acos(\zeta)).

The peaking in the step response can be found at \omega_n t = \frac{\pi}{\sqrt{1-\zeta ^2}} with a value equal to

P_t = 1 + e^{\frac{-\pi \zeta}{\sqrt{1-\zeta^2}}}.


Fig.2 Ringing in step response

The exact number of the phase margin and peakings can now be easily calculated. Poor phase margin corresponds  to peaking in the frequency domain and ringing in the time domain.


Fig.3 Relationship between¬†őĺ , PM, Pf, and Pt

Posted in Analog Design, Circuit Analysis | Tagged , , , , | Leave a comment

Memos on FFT With Windowing

Coherent sampling is quite difficult to meet under the lab conditions. One has to go for windowing to characterize the dynamic performance of ADC. Though seminal papers and reports [1-2] lie on my desk for quite long time, I still feel difficult to really understand windowing. Recently, I found two posts from Nerd Rage (Windows of Opportunity & ENBW) quite helpful, which are easier to digest.

And now, finally, I decide to write¬†down my very limited understanding on FFT with windowing, focusing on characterizing the dynamic performance of ADC in Matlab.¬†Let’s go straightforward by first looking at the Matlab script I am using to calculate the SNR/SNDR of ADC.

fs = 1e6;             % Sample rate
nfft = 1024;          % Number of FFT
cycles = 113;         % Number of input periods
fin = cycles/nfft*fs; % Input frequency
data = data(1:nfft);  % Number of data to be the same as nfft

w = 0.5*(1 - cos(2*pi*(0:nfft-1)/nfft)); % Hann window
cg = sum(w)/nfft;                        % Normalized coherent gain
enbw = sum(w.*w)/(sum(w)^2)*nfft;        % Normalized equivalent noise bandwidth
nb = 3;                                  % Signal bins
dcbin = (nb+1)/2;                        % Number of DC bins

if (size(data,1)~= size(w,1))            % Check dimention
   w = w';

ss = abs(fft(data.*w));      % FFT with windowing
ss = ss/nfft/cg;             % Compensate for window attenuation
ss = ss(1:nfft/2).*2;        % Drop the redundant half but keep total power the same

signal_bin = cycles+1;                           % Signal bin, Matlab array starts from 1
dc_bins = 1:dcbin;                               % DC bins
all_bins = setdiff(1:nfft/2, dc_bins);           % Disregard DC bins
signal_bins = signal_bin + (-(nb-1)/2:(nb-1)/2); % Signal leakage bins
other_bins = setdiff(all_bins, signal_bins);     % Further discard signal bins

fh = (2:10)*fin/fs;                              % Harmonic tone: (-/+m)fin + (-/+k)fs
   while max(fh) > 1/2
   fh = abs(fh - (fh > 1/2));                    % If harmonic tone fh>fs/2, it is equal to fs-fh
harm_bins = round(nfft * fh) + 1;                % Harmonic bins (2nd - 10th)
harm_binsl = zeros(length(harm_bins),nb);        % Find Harmonic leakage bins
for i = 1:length(harm_bins)
    harm_binsl(i,:) = ((harm_bins(i) + (-(nb-1)/2 : (nb-1)/2)));
harm_binsl=reshape(harm_binsl',length(harm_bins)*nb,1);  % Convert matrix to array
harm_binsl=unique(harm_binsl);                           % Discard the repetitive harmonic bins

noise_bins = setdiff(other_bins, harm_binsl);            % Further discard the harmonic bins

Psignal = sum(ss(signal_bin).^2);                        % Signal power
PnoiseD = sum(ss(noise_bins).^2)/enbw/length(noise_bins);% Noise PSD
Pnoise = PnoiseD*length(all_bins);                       % Total noise power
Pharm = sum(ss(harm_bins).^2);                           % Power of harmonics

snr = 10*log10(Psignal/Pnoise);                          % Calculate SNR
sndr = 10*log10(Psignal/(Pnoise+Pharm));                 % Calculate SNDR
enob = (sndr - 1.76)/6.02;                               % Calculate ENOB
thd = -10*log10(Psignal/Pharm);                          % Calculate THD

Pharm_max = max(ss(harm_bins)).^2;
Pnoise_max = max(ss(noise_bins)).^2;
sfdr = 10*log10(Psignal/max(Pharm_max,Pnoise_max));      % Calculate SFDR

sdb = 10*log10(ss.^2);
f = (1:length(ss))/nfft;                                 % Frequency vector normalized to fs

plot(f, sdb, 'k-','linewidth',1.5);
xlabel('Frequency [ f / f_s ]','FontSize',10);
ylabel('Power Spectrum [ dB ]','FontSize',10);
grid on;
text(0.3, -40,...
sprintf('SNDR = %.1fdB \n SNR = %.1fdB \n THD = %.1fdB \n SFDR = %.1fdB \n ENOB = %.1fbits', sndr, snr, thd, sfdr, enob), ...

An example of FFT plot will look like this:


Fig.1 An example of FFT plot showing the dynamic performance of ADC

A default FFT using rectangular/box window has a normalized coherent gain as 1, a normalized equivalent noise bandwidth as 1, and only 1 signal bin. Hence, if other types of window are used, the corresponding window properties need to be specified. It’s all about two values: 1) the sum of the window terms; and 2) the sum of the squares of the window terms.¬†Equations from the seminal paper [1] tell us why the two sums matter.

Let the input sampled sequence be defined by

f(nT) = A e^{+j\omega_knT} + q(nT)

where q(nT) is a white-noise sequence with variance \sigma^2_q. Then the signal component of  the windowed spectrum is given by

F(\omega_k)|_{signal} = \sum\limits_n w(nT) A e^{+j\omega_knT} e^{-j\omega_knT} =A \sum\limits_n w(nT)

Hence, the output amplitude of the noiseless signal is the input amplitude multiplied by a term which is the sum of the window terms (S1). This term is called the processing gain (sometimes called coherent gain) of the window. The rectangular window has the largest gain compared to other windows. In the Matlab script, the normalized coherent gain (normalized by S1 of the rectangular window) is specified.

The noise component of the windowed spectrum is given by

F(\omega_k)|_{noise} = \sum\limits_n w(nT) q(nT) e^{-j\omega_knT}

The noise power is calculated using the expectation operator

E\{F(\omega_k)|_{noise}^2\} = \sigma_q^2 \sum\limits_n w^2(nT)

As additive noise is assumed to be white, the above value represents the noise floor level (or the noise power spectral density), which is also constant. Notice the power gain of noise is the sum of the squares of the window terms (S2).

The noise bandwidth is calculated by the total noise power (sigma^2*S2*fs) divided by the peak power gain of the window (S1^2). Here we only focus on the multiplication term to the input noise (S2*fs/S1^2). Further introducing a parameter, fres, the width of one frequency bin (fs/N), then the normalized equivalent noise bandwidth (ENBW) is given by

ENBW = \frac{S_2 f_S }{S_1^2 f_{res}} = N\frac{S_2}{S_1^2} = N \frac{\sum\limits_n w^2(nT)}{ [\sum\limits_n w(nT)]^2}

Therefore, to obtain correct power levels of the signal and the noise, the normalized coherent gain is subtracted from the PSD and the normalized ENBW is subtracted from the calculated total noise power, respectively.

Nerd Rage explains the ENBW from window energy point of view, which is quite insightful. Allow me to copy one of his picture and some remarks here:


Fig. 2 Some properties of the Hann window and its instrument function. The window function (top left) is normalized to T = 1; graph also shows the window energy relative to the box window. Instrument function (top right) is shown for the spectral region covering the first 10 DFT bins. Close-up (bottom) shows main lobe height, maximum scalloping loss (see below), relative height of first sidelobe, and fraction of energy contained in main lobe, E0, to total energy E. (Courtesy: Nerd Rage)

“For the Hann window the main lobe height is -6.02dB and therefore the height of any single spectral line will be 6.02dB below its real value. To obtain correct energy levels of the spectral peaks (in the absence of scalloping), the main lobe height (in dB units) is usually subtracted from the PSD. However, this overcompensates the window-specific reduction of the noise floor ‚Äď for the Hann window, peak compensation is 6.02dB while the noise floor is only 4.26dB below its true value. This decreases the observed SNR by 1.76dB or a factor of 1.5.”

Note: for Hann window, 20log(s1/N) = -6.02dB; 10log(s2/N)=-4.26dB; N*s2/s1^2 = 1.5.

Regarding the number of spread bins for a certain window function, a simple Matlab script performing FFT with windowing can do the job:

% Here you create an input 
fs = 1024;
nfft = 1024;
fin = 16;
cycles = 16;
vin = sin(2.*pi.*fin.*(0:1:nfft-1)./fs);
% Here you perform FFT with and without windowing
ss = abs(fft(vin(1:nfft)))/(nfft/2);
w = 0.5*(1 - cos(2*pi*(0:nfft-1)/nfft));
cg = sum(w)/nfft;
sshann = abs(fft(vin(1:nfft).*w))/(nfft/2)/cg;
% Here you do the plot
xlim([1 25]);
grid on;
xlim([1 25]);
grid on;

Then it comes the plot:


Fig.3 FFT with Rectangular and Hann window (For Hann window, signal bins = 3)

Sorry for the boring and not well-written post (though I’ve tried my best). Fig.4 is just for a smile when one finishes reading all the above dull words.

Last but not least,¬†¬†may Mr. Fourier’s wisdom be always with us!

Fig.4 A sketch of Mr. Fourier

[1] Frederick J. Harris, ‚ÄúOn the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform,‚ÄĚ Proceedings of the IEEE, vol 66, pp. 51-83, January 1978.

[2] G. Heinzel, A.Rudiger, and R. Schilling, “Spectrum and spectral density estimation by the Discrete Fourier transform (DFT), including a comprehensive list of window functions and some new flat-top windows,” February 15, 2002.

Posted in Data Converter, Matlab | Tagged , | Leave a comment

Capacitor as a Discrete-Time Resistor

Prof. Ali has a column called “Circuit Intuitions” in the IEEE Solid-State Circuits Magazine. This time he wrote about capacitor as a resistor, which is quite helpful for me to understand this property recognized by James Clerk Maxwell 140 years ago. In this post, I tried to write down what I’ve learned from this topic.

First, let’s look at Fig.1 and ask oneself the following question: Between (a) and (b), which one is an integrator and which one is a gain stage?


Fig.1 (a) Integrator; (b) Gain stage

The top is an integrator and the bottom a gain stage. The two working modes of the integrator and the gain stage are depicted in Fig.2 and Fig.3, respectively.


Fig.2 Two modes of integrator: sample and integrate.


Fig.3 Two modes of gain stage: sample and amplify

Now it’s time to take a close look at the switched-capacitor part of the integrator. Why does it act like a resistor?

First, let’s simplify the parasitic-insensitive version of Fig.4(a) to a straightforward implementation of Fig.4(b). In the first half of the period, S1 is closed and S2 is open. The capacitor is connected to V1, acquiring a charge of Q1=C*V1. In the second half, S1 is closed and S2 is open. The capacitor is connected to V2, storing a charge of Q2=C*V2. During this period, the total charge transferred from V1 to V2 is C*(V1-V2). In the next cycle, the capacitor is again connected to V1, replenishing its charge back to C*V1.¬† Then it transfers¬†a charge of C*(V1-V2) to V2. Accordingly, the average current flowing from source V1 to source V2 is equal to the charge moved in one period:


We can therefore view the discrete-time circuit as a resistor equals to


There are several considerations we shall pay attention to:

  1. Time varying of V1/V2 should be slower than the rate of switching.
  2. T/2 should be long enough for the capacitor to fully charge/discharge to the intended levels.
  3. Different from a resistor, the average currents are the same, but not the instantaneous current.
  4. … (to be discovered by oneself during real implementation)


Fig.4: (a) A capacitor and four switches that act like a resistor; (b) A straightforward implementation of (a); (c) S1 is closed and S2 is open; (d) S1 is open and S2 is closed.

Knowing the switched-capacitor version of a resistor, Fig.5 gives two types of integrator: the continuous and the discrete. A comparison between the two reveals one of the advantages of the latter: while the product of R and C may have as much as a 10% process variation, the ratio of two capacitances has only a variation within 0.1%. OK. Let’s also be fair to name one disadvantage of the discrete equivalent: it is jitter-sensitive.


Fig.5 (a) Continuous-time integrator; (b) discrete-time (switched-capacitor) integrator

Finally, allow me to copy part of Prof.Ali’s summary in the article – “If we view a resistor as an element that transfers charge from one terminal to another at a constant rate, we can implement it using a capacitor and two switches.”

Posted in Analog Design, Circuit Analysis | Tagged , , | Leave a comment