The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 10:12pm
Pages: 1
Send Topic Print
Question about SH VerilogA model (Read 3223 times)
bmwsky
New Member
*
Offline



Posts: 7

Question about SH VerilogA model
Apr 10th, 2008, 4:28am
 
Dear All
I've already read the "Simulating switch-capacitor filters with SpectreRF" written by Ken Kundert. And I found two questions that I can't settle.

1. In the guide, Ken give the SH VerilogA model below:
-------------------------------------------------------------
`include "discipline.h"
`include "constants.h"

module sh (Pout, Nout, Pin, Nin);

input Pin, Nin;
output Pout, Nout;
electrical Pin, Nin, Pout, Nout;
parameter real period=1 from (0:inf);
parameter real tdelay=0 from [0:inf);
parameter real aperture=period/100 from (0:period/2);
parameter real tc=aperture/10 from (0:aperture);

integer n;
real tstart, tstop;
electrical hold;

   analog begin

// Determine the point where the aperture begins;
     n = ($abstime - tdelay + aperture) / period + 0.5;
     tstart = n*period + tdelay - aperture;
     @(timer(tstart));

// Determine the time where the aperture ends;
     n = ($abstime - tdelay) / period + 0.0;
     tstop = n*period + tdelay;
     @(timer(tstop));

// Implement switch with effective series resistence of 1 Ohm
     if (($abstime > tstop - aperture) && ($abstime <= tstop))
         I(hold) <+ V(hold) - V(Pin, Nin);
     else
         I(hold) <+ 1.0e-12 * V(hold);

// Implement capacitor with an effective capacitance of tc
     I(hold) <+ tc * ddt(V(hold));

// Buffer output
     V(Pout, Nout) <+ V(hold);

// Control time step tightly during aperture and loosely otherwise
     if (($abstime >= tstop - aperture) && ($abstime < tstop)) begin
         $bound_step(tc);
     end else begin
         $bound_step(period/5);
     end

   end
endmodule
---------------------------------------------
why he use the "tc=aperture/10 "to set the capacitor? why not use a fixed capacitor??

2. In the guide, he told that if you would like to check the discrete time Gain response of the SC circuit, you should add a sample and hold circuit as described above. However, due to the sinc function of the SH, the output of the continues gain checked by PAC will change, esspecially the NULL point of the sinc. So, my question is how to check the discrete response by SpectreRF without adding a SH circuit after the output??

Thank you!!!

BMWSKY
Back to top
 
 
View Profile   IP Logged
Marq Kole
Senior Member
****
Offline

Hmmm. That's
weird...

Posts: 122
Eindhoven, The Netherlands
Re: Question about SH VerilogA model
Reply #1 - Apr 10th, 2008, 8:08am
 
Hi,

Answer to 1: the capacitance is related to the aperture - when the aperture changes through the parameter setting the capacitance value has to change with it as this hold capacitor has to be charged within the aperture time. To small and it would discharge too fast outside the aperture time; too large and it wouldn't charge up to the required level.

You can see for yourself what a fixed capacitor would do by setting up a test bench for this circuit and vary the aperture parameter value while passing a fixed value for the tc parameter value.

Cheers,
Marq
Back to top
 
 
View Profile   IP Logged
bmwsky
New Member
*
Offline



Posts: 7

Re: Question about SH VerilogA model
Reply #2 - Apr 10th, 2008, 10:20pm
 
Thank you Marq,

I'v already test the SH as you said, it works. However, I found that the DC gain of PAC simulation is several dB less than the trans simulation when using the frequency near dc to test. I'm wondering what's going on?

BMWSKY
Back to top
 
 
View Profile   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2386
Silicon Valley
Re: Question about SH VerilogA model
Reply #3 - May 16th, 2008, 12:16pm
 
PAC includes the effect of the duty cycle when computing DC gain, whereas people often ignore the fact that the signal is only present part of the time and just examine the peaks when computing the DC gain.

-Ken
Back to top
 
 
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.