The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> Writing the output data to a file https://designers-guide.org/forum/YaBB.pl?num=1100394156 Message started by vivekrc on Nov 13th, 2004, 5:02pm |
Title: Writing the output data to a file Post by vivekrc on Nov 13th, 2004, 5:02pm Hi, I have written a code in Verilog AMS and i would like to know how to write the output data to a file from Verilog AMS, so that i can open it in Matlab.I would like to compute the FFT of the output data. My main aim is to determine the signal to noise ratio, spurious free dynamic range and total harmonic distortion from the frequency response. /*This code is used to compute the ADC */ `include "constants.vams" `include "disciplines.vams" module logelec (out3,out2,out1,out0,bit3,bit2,bit1,bit0 ); output out3,out2,out1,out0; input bit3,bit2,bit1,bit0; electrical out3,out2,out1,out0; logic bit3,bit2,bit1,bit0; parameter real td = 0; parameter real tt = 0; real outscaled1,outscaled2,outscaled3,outscaled4; integer mychannel; analog begin outscaled1=bit3; outscaled2=bit2; outscaled3=bit1; outscaled4=bit0; V(out3) <+ 1.2* outscaled1 ; V(out2) <+ 1.2* outscaled2 ; V(out1) <+ 1.2* outscaled3 ; V(out0) <+ 1.2* outscaled4 ; mychannel=$fopen("%C:r.freq_dat") ; end endmodule I would be grateful to anyone who could help me solve this problem. I am also interested to know whether there is a direct tool in Verilog AMS to compute the FFT of digitized signal . I know the same could be done in Cadence using the Calculator Tool of the Analog Environment which is given by dft((((VT("/bit0")+(VT("/bit1")*2)+(VT("/bit2")*4)+(VT("/bit3")*8))/45+0.4)1e-0.8 6.12e-0.8 128 "Rectangular" is a 128 point Rectangular window FFT for a transient response from 10ns to 61.2ns.I have done this successful in Cadence using transistor level design for a flash ADC. I also read the Verilog AMS language reference manual, and couldnt find anything which deals with FFT. Thanks Vivek |
Title: Re: Writing the output data to a file Post by August West on Nov 14th, 2004, 11:51pm It sounds like what you need is a periodic sampler. One is given below ... Code:
This module will sample a signal at a fixed rate and write the values to a file. The file can then be opened by Matlab and processed. -August |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |