The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Aug 18th, 2024, 7:20am
Pages: 1 2 
Send Topic Print
frequency function in frequency domain (Read 17346 times)
icdesign
New Member
*
Offline



Posts: 9

frequency function in frequency domain
Jun 01st, 2006, 7:30pm
 
Can somebody tell me how to implement

out(f) = (sin(3.14*f/20M))^2 in spectre?  

X Axis: f (frequency)
Y Axis: out(f)

Thanks!
Back to top
 
 
View Profile   IP Logged
Eugene
Senior Member
****
Offline



Posts: 262

Re: frequency function in frequency domain
Reply #1 - Jun 1st, 2006, 9:33pm
 
It looks like you want to implement a transfer function that has a periodic frequency domain response. Digital filters do that. If the transfer function you listed is |H(f)|^2, you could write H(f) as sin(w/40M), where w=2pi*f. This can be written as (exp(jw/40M)-exp(-jw/40M))/(2j). If you don't care about the j in the denominator, you could a z-domain block in VerilogA. I believe this would be

(z - z^-1)/2

where the sample rate is 40M.

If the transfer function you wrote is H(f), you might still be able to use a z-domain block. This time, the z-domain block is

-(z - z^-1)^2 / 4 .  The sample rate is again 40MHz. This time, the (-) in front takes care of the j.

The only snag might be if there is a restriction that the degree of the numerator be less than or equal to the degree of the denominator. I am not 100% sure but causality might impose this constraint. If that is true, this will not work. In that event, you might be able to take the IFFT of the target transfer function over the frequencies of interest, which gives you an impulse response, and then use the impulse response samples as taps in an FIR filter. Again, you would implement the FIR filter with z-domain blocks...or lossless transmission lines if you don't have VerilogA.
Back to top
 
 
View Profile   IP Logged
Eugene
Senior Member
****
Offline



Posts: 262

Re: frequency function in frequency domain
Reply #2 - Jun 2nd, 2006, 7:05am
 
If you could tolerate a little delay in the model, you could solve the causality problem by replacing

(z - z^-1)/2  with

(z^-1)*(z - z^-1)/2 .
Back to top
 
 
View Profile   IP Logged
icdesign
New Member
*
Offline



Posts: 9

Re: frequency function in frequency domain
Reply #3 - Jun 2nd, 2006, 12:35pm
 
Thanks Eugene!

I would like to have a discrete time input x[k] feed into a continuous time filter H(f) to produce a coutinuous output y(t) (in frequency domain it's Y(f)).

Would you tell me more details on how to place the 40M sampling rate in the Verilog-A or show me where can I find the example?  I guess I might need some FIR filter with z-domain block examples.

Thank you very much!

Y(f)=(1/T)*|H(f)|^2*X(z)

where z=e^(-j6.28fT)
1/T=40MHz
H(f) is a 2nd-order noise shaped transfer function
H(z) = (1-z^-1)^2
Back to top
 
 
View Profile   IP Logged
Eugene
Senior Member
****
Offline



Posts: 262

Re: frequency function in frequency domain
Reply #4 - Jun 2nd, 2006, 1:09pm
 
The book listed below has a good section on z-blocks. If you have access to the on line Cadence documentation, it also has some examples in the VerilogA language reference section. I have not checked but you might find some z-domain app notes on Sourcelink. The few times I've used z-domain transfer functions in VerilogA, I found them to be fairly robust. One thing to remember is that Spectre is an analog simulator; Spectre follows the z-domain block with a zero order hold. Even before your signal bandwidth approaches the Nyquist frequency, you could see some filtering effects from the ZOH, depending on what kind of accuracy you want.

The Designer's Guide to Verilog-AMS by Kenneth S. Kundert & Olaf Zinke, 2004.
There's a link to this book at this web site. Click on "Books" and you should see it.
Back to top
 
 
View Profile   IP Logged
icdesign
New Member
*
Offline



Posts: 9

Re: frequency function in frequency domain
Reply #5 - Jun 6th, 2006, 7:36pm
 
Thanks! Eugene,

Following your instruction, I have done the H(f) noise shaped transfer function.

I am going to feed the discrete time pseudo-random noise in frequency domain to the input of the H(f) transfer function so that I expect most of the noise will be pushed to high frequency.

I know how to implement the pseudo-random noise generator in time domain.  However, I haven't figured out how to implement the discrete time pseudo-random noise in the frequency domain.  Would you give me some hints again?

I appreciate your help, Eugene.
Back to top
 
 
View Profile   IP Logged
Eugene
Senior Member
****
Offline



Posts: 262

Re: frequency function in frequency domain
Reply #6 - Jun 7th, 2006, 8:39am
 
You should be able to start with a VerilogA white noise source and color it with a z-domain filter. You could also use a noise table if you already have the power spectral density and don't want to synthesize a coloring filter. If you use a noise table, you can use VerilogA but you can also import the noise file through a Spectre primitive source.
Back to top
 
 
View Profile   IP Logged
icdesign
New Member
*
Offline



Posts: 9

Re: frequency function in frequency domain
Reply #7 - Jun 7th, 2006, 3:33pm
 
Hi Eugene,

Very sorry to ask the syntax error.  Would you tell me where is my bug?

Thanks a lot!

Assume the random noise is (1/12)=0.083 over the frequency:

module test (vout);
output vout;
electrical vout;
     V(vout) <+ noise_table({1,0.083}, {100M, 0.083});
endmodule
Back to top
 
 
View Profile   IP Logged
Eugene
Senior Member
****
Offline



Posts: 262

Re: frequency function in frequency domain
Reply #8 - Jun 7th, 2006, 4:34pm
 
Try:

noise_table({1,0.083, 100M, 0.083});

i.e. remove the innermost curly brackets.

Back to top
 
 
View Profile   IP Logged
icdesign
New Member
*
Offline



Posts: 9

Re: frequency function in frequency domain
Reply #9 - Jun 7th, 2006, 5:28pm
 
Hi Eugune,

Thanks!  However, it looks that it complains the V(vout).  Looks that I should not use V().

"V(<<--? vout) <+ noise_table({1,0.083, 100M, 0.083});"

"V(<<--? vout) <+ noise_table({1,0.083}, {100M, 0.083});"
Back to top
 
 
View Profile   IP Logged
icdesign
New Member
*
Offline



Posts: 9

Re: frequency function in frequency domain
Reply #10 - Jun 8th, 2006, 11:32am
 
Hi Eugune,

Thanks for your help.

I feed the (1/12) random noise to the noise shaped function H(z)=(1-z^-1)^2

V(out) <+ zi_nd(noise_table({1, 0.083, 100M, 0.083}), {1, -2, 1}, {1, 0}, 50n);

Syntax error message:

Error: Use of small signal sources in expressions is not supported.
   Exiting SpectreHDL compilation.
Back to top
 
 
View Profile   IP Logged
Eugene
Senior Member
****
Offline



Posts: 262

Re: frequency function in frequency domain
Reply #11 - Jun 9th, 2006, 8:15pm
 
You need "analog begin" and "end":

module test (vout);
output vout;
electrical vout;
    analog begin //<<----
       V(vout) <+ noise_table({1,0.083, 100M, 0.083});
    end //<<----
endmodule

You can then drive your z-filter with V(vout).
Back to top
 
 
View Profile   IP Logged
icdesign
New Member
*
Offline



Posts: 9

Re: frequency function in frequency domain
Reply #12 - Jun 12th, 2006, 2:45pm
 
Hi Eugene,

Thanks very much for your kindly support.  I have two symbols on the schematic: test1 drives test2.  The Verilog-A code are below.  With noise simulation, I can see the output node of the test1 (noise voltage over the frequency).  I expect the test2 is the Z-transform (1-z^-1)^2, which can shaped the noise over the frequency.  However, the output of the test2 is 0 over the frequency.

I appreciate your help very much.

module test1 (vout);
output vout;
electrical vout;
analog begin
     V(vout) <+ noise_table({1,0.083, 100M, 0.083});
     end
endmodule

**

module test2 (in, out);
electrical in, out;
parameter real T = 50n;

analog begin
     V(out) <+ zi_nd(V(in), {1,-2,1}, {1,0}, T);    
end
     
endmodule
Back to top
 
 
View Profile   IP Logged
Eugene
Senior Member
****
Offline



Posts: 262

Re: frequency function in frequency domain
Reply #13 - Jun 13th, 2006, 2:46pm
 
I can't try it right now but I think your denominator coefficients should be {0,0,1}.

(1-z^-1)^2=(1-2z+z^2)/(0+0+z^2).

Maybe this helps.
Back to top
 
 
View Profile   IP Logged
icdesign
New Member
*
Offline



Posts: 9

Re: frequency function in frequency domain
Reply #14 - Jun 13th, 2006, 4:47pm
 
Thanks Eugene,

According to my manual, the zi_nd is in the format of (nk*z^-k)/(dk*z^-k).  
Therefore, (1-z^-1)^2 = (1-2z^-1+z^-2)/1

I try both

(1-z^-1)^2 = (1-2z+z^2)/0+0+z^2 ==> {1, -2, 1}, {0, 0, 1}
==> fatal error "constant term in denominator polynomial evaluates to zero.

(1-z^-1)^2 = (1-2z^-1+z^-2)/1==> {1, -2, 1}, {1, 0, 0} ==> output = 0 over frequency

Thank you very much for your help.
Back to top
 
 
View Profile   IP Logged
Pages: 1 2 
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.