# Comparator Gain simulation - cadence

Status
Not open for further replies.

#### AMSA84 Hi guys, I am simulating a open-loop comparator with positive feedback (it is not the dynamics one).

What happens is that, I simulate the dc-characteristic and ask for the derivative of the characteristic to see where the max is. The value that he gives me is supposed to be the gain, right?

Supposing that it is the gain, there is something that is confusing me.

When I simulate for example, between a range of input voltage varying, say 1.6V to 1.7V with a step of 1mV the "gain" is around 3K. When I simulate the same thing, but now with a step of 0.1mV the gain gives higher, around 30K.

When I set a very small voltage sweep rang, say 1.6485V to 1.6515V with 100nV of step, it gives me 128K of gain.

Hows that possible?

- - - Updated - - -

I forgot to ask another thing. This gain is the dc gain, right? What about the gain from the frequency response of the comparator? VDC source in vin+ in series with a vsin VAC=1 and other VDC source at the vin- pin with the polarization voltages. What kind of gain is this? If I want to know the bandwidth of the comparator, this is one way to do it, right? But what about the gain that we get? What's his name?

Regards.

Last edited:

#### kenambo

##### Full Member level 6 Hi

For your first question, What do you exactly mean by DC characteristic simulation? And for which characteristic you are taking the derivative.

Which sources are you using to calculate gain.? Please clarify this..

Second question: According to my point of view DC gain is the same as AC gain which is for zero frequency. And the gain is called AC gain. What I am thinking is the simulator calculates the gain for different frequencies and plot that on the graph.So it draws an asymptote for the low frequencies.

So the gain you are mentioning now is gain = change in output/change in Input which is AC gain.

And please clarify about DC gain and how you are measuring... because I am also in the need of knowing DC gain..

Thanks.

#### KlausST

##### Super Moderator
Staff member Hi,

open loop means "no feedback". but you talk about positive feedback. So you add hysteresis. This is not good for a gain test.

Disconnect the feedback and do your tests again.

****

1mV step --> gain of 3000
0.1mV step --> gain of 30000

It seems to me the comparator is supplied with 3.3V or so.

What happens: with hysteresis you increase the input voltage each time 1mV. Suddenly the output voltage changes from about 0V to about 3V. --> the output makes a step of about 3V whil the input makes a step of 1mV
A = delta_U_out / delta_U_in = 3V / 1mV = 3000

The same is with 0.1V steps.
A = 3V / 0.1mV = 30000.

But the gain values make no sense,
Again: with positive feedback you can´t measure gain.

Klaus

#### AMSA84 Hi thank you for the answers.

Kenambo, dc characteristic of the comparator that I am talking about is similar to the charateristic of the inverter. If you look at Allen's book page 442 you will see the picture that I am talking about.

Regarding the gain, in the same book, if you look at page 440 Allen defines the gain as (VOH-VOL)/(VIH-VIL) where VIH-VIL is the input difference and you can see that in figure in page 441. So what gain is this one? Static gain? Dynamic gain?

Being the gain defined as that (as defined by Allen's book and I think Baker's too), the gain of the comparator is the slope of that dc-characteristic. So if I plot that dc-characterist, grab the calculator and make the derivative of it, it will give me the maximum and that maximum is the gain. Right?

KlausST, regading that issue, I found around the web that the step of the dc-analysis should be made very small, smaller that the resolution of the comparator. That said, for example, grabing a step of 1uV and 0.1uV the "gain" didn't vary much. The resolution, from the same book it is said that corresponds to (VOH-VOL)/Av(0).

And now?

- - - Updated - - -

You can see the derivative graphic that I get in baker's book 879.

- - - Updated - - -

and in page 916 too.

- - - Updated - - -

Ok, page 916 describes that problem of the step klausST.

#### kenambo

##### Full Member level 6 Hi

I saw the pages yous suggested, and I think it is dynamic gain since it depends on the switching of two states and you are measuring the gain at the changing level.

And it doesn't change for the step voltages which are greater than the resolution of the comparator.

But why you see a difference in gain numbers is because you didn't measure the actual gain.

That means you are seeing the slope of the switching which is constant for both of your case .. that is 1mV and 0.1mV

What happens actually is it is not the real gain..since real gain saturates the Voltage at power supply rails.

You are manually dividing the output and input and your output is constant you are changing your input as 1mV and 0.1mV so you are getting a factor of 10. As KlausST said...

yeah.. it is referred as DC gain for a comparator/differential amp.

And the gain which you are getting for AC sources is Your amplifier gain.(Since amplifier can easily converted to act like a comparator by configuration). That means if you are making it as a differential amplifier you will get some gain.. that gains is represented by this..

thanks.

#### AMSA84 Hi,

I am afraid that you guys didn't understood what I said about the 1mV and 0.1mV or I haven't made myself clear.

I will try to explain with and example:

DC Characteristic from 0 to 3.3V with 1mV linear step in the DC simulation options -> plot of dc characteristic -> derivative -> gain of 3200;
DC Characteristic from 0 to 3.3V with 0.1mV linear step in the DC simulation options -> plot of dc characteristic -> derivative -> gain of 26000;

etc

until a start to get the same gain (128000) no matter the step I use (lower). It kinda like stabilizes. This for a sweep from 1.6485V to 1.6515V with 0.01uV of linear step.

Did you understood now?

- - - Updated - - -

I forgot to ask another thing that is related to the type of comparator I am using. It's a cross-coupled one, as it is shown in the Allen's book.

What precautions should I have to measure the gain?

#### erikl

##### Super Moderator
Staff member ... until a start to get the same gain (128000) no matter the step I use (lower). It kinda like stabilizes. This for a sweep from 1.6485V to 1.6515V with 0.01uV of linear step.

Due to positive feedback you get a rather steep gain peak at this voltage - you should see it if you plot gain vs. this input voltage. The zero-crossing of its derivative should give you the exact voltage of max. gain.

Measuring the gain with declining input voltage should result in a different (lower) peak gain voltage - due to hysteresis - but probably with similar peak gain.

#### AMSA84 My comparator does not have hysterisis. Regarding the zero-crossing, my comparator is fed by a 0V to 3.3V power supply, so you would mean VDD/2 crossing, right?

But this gain that you talk about is what kind?

We are usted to plot the frequency response of an amplifier. In this case we can do that? Why the values are different from the way you are talking about? What's the difference between those two types of gain? What one gives/means?

Although my comparator does not have hysteresis, it has a latch type, a cross-couple load. Can I do all that tests with that kind of load?

I have been told that doesn't make sense to measure the gain of the comparator, but they didn't justified... well. Don't know in where can I stay.

#### erikl

##### Super Moderator
Staff member My comparator does not have hysterisis.
I think any comparator with positive feedback has hysteresis. But I don't know enough your circuit (with latch) - it could be different. You could verify by measuring gain vs. voltage with declining voltage - if this results in a different switching voltage.

Regarding the zero-crossing, my comparator is fed by a 0V to 3.3V power supply, so you would mean VDD/2 crossing, right?
No, what I want to say is: if you plot the derivative of the gain-vs.-voltage curve vs. this voltage (i.e. δgain/δV vs. V), this will have a zero-crossing (δgain/δV = 0). This should give you the input voltage with max. gain.

But this gain that you talk about is what kind?
The kind you measure it: gain vs. input voltage.

We are used to plot the frequency response of an amplifier. In this case we can do that? Why the values are different from the way you are talking about? What's the difference between those two types of gain? What one gives/means?
You can measure both analysis types:

Gain vs. frequency shows you the amplifier's/comparator's frequency behaviour, with the usual results of unity gain and phase margin (if you also plot gain's phase vs. frequency).

With the gain vs. input voltage analysis you receive the switching voltage(s) of your comparator, and the max. gain at the switching voltage (if you use voltage stepping <= comparator sensitivity).

Although my comparator does not have hysteresis, it has a latch type, a cross-couple load. Can I do all that tests with that kind of load?

I have been told that doesn't make sense to measure the gain of the comparator, but they didn't justified... well. Don't know in where can I stay.
Sure this makes sense: It gives you the exact input switching voltage(s), together with the comparator's sensitivity at the switching voltage (this is the step size, when your gain result is saturated).

• AMSA84

### AMSA84

Points: 2

#### AMSA84 Just to finish here with this, when I said that I have been told that doesn't make sense to measure the gain of the comparator, I was referring to the comparator employing the cross-couple pair as a load to the input differential pair (which in this case is what I am using). That is, doesn't make sense to make all those measurement (AC sweep, gain vs input, gbwm bw, etc) because it has a cross-couple/latch type.

But if we are talking about a folded-cascode comparator or a two-stage comparator, there is no problem, from their view, because those doesn't have any cross-coupled/latch type load in the input differential pair.

So from your experience or point of view, those guys who told me that aren't right. We can make all those stuffs independently if it has a cross-coupled or not. Is that it?

#### erikl

##### Super Moderator
Staff member We can make all those stuffs independently if it has a cross-coupled or not. Is that it?

Yes, I think so. If you can measure a peaking gain curve vs. the input voltage also with your latch type comparator, of course this makes sense, because you can get the exact switching voltage(s) and the switching sensitivity by this.

BTW: Did you check for hysteresis by running the input voltage sweep from higher to lower voltages?

#### AMSA84 Hi erikl, thanks again for the input.

Yes I have checked if the comparator has hysteresis. I did a sweep backwards, that is, from 3.3V to 0V with 1mV of step and it seemed to me that the comparator has no hysteresis because the slope fit together with the other one.

Regarding the simulation of the gain. I asked that and I insist on that because, if we have a kinda latch type cross-couple load, we have feedback, and having feedback we are not measuring the open loop gain, right?

#### KlausST

##### Super Moderator
Staff member Hi,

for OPAMPs you can measure the open loop gain while it has closed loop:

connect it as an inverting amp: Rin = 10kOhm, Rfb = 100kOhm. (You may adjust the values)
connect In+ to GND.

Now it has a closed loop gain of 10.

Add a pot at Rin. With it you can now adjust output voltage.
check that opamp is not oscillating.

Now adjust pot to get output voltage 1V. (input at Rin = about -0.1V)
Measure output voltage (VO1)
Measure IN- voltage (VI1)

Now adjust pot to get output voltage of 2V (input at Rin = about -0.2V)
Measure output voltage (VO2)
Measure IN- voltage (VI2)

Now open loop gain (with a load of 100kOhms) = -(VO2-VO1)/(VI2-VI1)
in words: (change of output voltage) / (change of input voltage)

Try if this technique is also possible with the comparator. (I doubt it with the latched one..)
Check if the values make sense.

Maybe worth a try...
Good luck

Klaus

#### AMSA84 I will give it a try.

I forgot toask another thing that is happening to my comparator. I didn't pay much attention to that but here it go: The lower output voltage doesn't reach 0V. What might causing this? Anyone know?

#### erikl

##### Super Moderator
Staff member ... having feedback we are not measuring the open loop gain, right?

Right. You measure the effective gain in your very application.

- - - Updated - - -

The lower output voltage doesn't reach 0V. What might causing this? Anyone know?

The rounded falling slope shows a slew_rate ≈ 1.25 V/ns , which means a discharge current of about 6.25mA by NM46 for an estimated 5pF cap (C5 + output cap values of NM46 & PM37). NM46 cannot sink more current, and it still needs a few tens of millivolts as Vds. At a lower frequency, you would perhaps see it fall down to perhaps 50mV (≈2*Vt), probably its min. Vds.

Status
Not open for further replies.