Continue to Site

# How to simulate random offset of the comparators in Matlab?

Status
Not open for further replies.

#### tiportoolmo

##### Junior Member level 2
Hi all,
I have a little problem with the design of a full flash ADC, now I have to simulate the random offset of the comparators with matlab but I have no idea how to do this.
Someone can help me?

Offset simulation

for every comparator
vout=vin>vref+offset
where offset is a random vector with gaussian distribution that depends on the expected rms offset of your comparators, for example.

Re: Offset simulation

thanks for your replay..but I'm thinking,as i'm not able to use Matlab, maybe is more simple for me simulate the offset of the comparator with Cadence for example.
How can I simulate the offset with cadence?
Is more simple than with matlab? (I dont' know nothing about matlab)

This is the circuit that i want to simulate:

Offset simulation

In that case you can make a voltage source with a
gauss()* value in each of the relevant sub-blocks and
repetitively simulate (probably use ocean) and gather
the results for some sort of postprocessing.

*gauss(), agauss(), whatever random / stats you can
find in the Spectre manuals. You could also make a
veriloga offset source if the analog primtives can't be
propertized the way you want, but I believe they can.

Re: Offset simulation

Thanks for replying me, but I have to do it with Matlab, no cadence or others Cad.
So,which is the first step in order to do it using MATLAB?

Offset simulation

I believe you need to explain the problem in more details...
You have a clocked comparator whose offset is determined by the mismatch of M1 and M2 (as stated in the technology manuals). Once you set the size, you will have a gaussian distribution of offsets for your comparator. You can change the mean offset by changing the size of M1 and M2.

In matlab, you can represent this as:
offset=sigma_mismatch*randn(1,N)
where sigma_mismatch is the standard deviation of your offset and depends on the size of M1 and M2; randn is matlab's gaussian distribution function and N is the number of comparators.

Re: Offset simulation

I try to explain the problem in more details:

I'm designing a 5-bit, 4 Gs/s ADC FLASH in 65 nm CMOS. I have an idea of the total architecture, it's a classical architecture with resistor ladder, T/H, preamplifiers, clock comparator and encoder.
Now I want to simulate the offset of the clocked comparator using MATLAB.
My first problem is: How can I "transfer" the circuit of the comparator in matlab?
Which kind of equations i have to write?

Offset simulation

In matlab you do "system" simulations. The actual implementation of the comparator does not affect its model as long as you keep into account the parameters you want to check for, such as mismatch.

You do not need to write the voltage/current equations to get a good idea of the required performance to meet your design goals.

### tiportoolmo

Points: 2
Re: Offset simulation

Ok, we consider this simple problem:

I have this equation Vout=Rd*(Id1-Id2) , I suppose that (Id1-Id2) have a gaussian distribution and i want to plot Vout.
which kind of function i have to use to represent a gaussian distribution for (Id1-id2) ?

Offset simulation

simply noisy_Id1=Id1+sigma_id1*randn, where Id1 is the mean of your current, sigma_id1 is its standard deviation and randn is matlab's gaussian distribution function.
If you go this way, Rd should also be a random number (since you cannot guarantee its absolute value).
BTW, you would need to saturate Vout...

In my opinion, this way is far more complicated that the initial model I proposed to you and it does not add any more information...

Status
Not open for further replies.