The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Apr 24th, 2024, 6:47am
Pages: 1
Send Topic Print
write output to file (Read 3859 times)
Roky
New Member
*
Offline



Posts: 5

write output to file
Apr 28th, 2003, 12:02am
 
Hi everyone, I have some problems with hidden state in specteRF, I would like to simulate an GSM transmitter with envlp. analysis... I deceided to solve this problem with an data controled voltage source... But my problem is I dont know how to print the simulation results as data to the file. (Like in spice to the output file). I am an CADENCE beginner so I would be very happy if someone could help me...


Thanks a lot....                    
                               Roky
Back to top
 
 
View Profile   IP Logged
Eugene
Senior Member
****
Offline



Posts: 262

Re: write output to file
Reply #1 - Apr 28th, 2003, 2:11pm
 
I've included a module I use to sample an output voltage and write it out to a file in SPW format. The Spectre pwlf sources understand SPW format but SPW format is not necessary. Two columns, one time and one voltage, works too. Perhaps this will get you started.

I did not make the filename a parameter because I know of no way to pass a string to the module. That is one of my complaints about VerilogA. SpectreHDL lets you pass strings to modules.

The other thing to remember is that if you post process the data on a pc, you need to rename the file with a different name each time you overwrite the old one because of some caching problem with pc networks. This is, of course, moot if you are doing everything on a unix box.

// VerilogA for behavioral_models, SPW_signal_sink, veriloga

`include "constants.h"
`include "discipline.h"

module I_SPW_output_sink(in);
input in;
electrical in;

parameter real sample_rate = 1e6 from (0:inf];
parameter real sim_time = 0.001 from (0:inf];
parameter integer record = 1 from [0:1]; // 1 = record, 0 = don't.
integer fptr;
real period;
integer number_of_samples;

analog begin
  @ ( initial_step ) begin
     if (record ==1) begin
        fptr = $fopen("/home/phase_noise.ascsig");
        period = 1/sample_rate;
        number_of_samples = sim_time*sample_rate;
        $fstrobe(fptr, "$SIGNAL_FILE 9");
        $fstrobe(fptr, "$USER_COMMENT");
        $fstrobe(fptr, "data");
        $fstrobe(fptr, "$COMMON_INFO");
        $fstrobe(fptr, "SPW Version          = 4.50");
        $fstrobe(fptr, "System Type          = solaris2");
        $fstrobe(fptr, "Sampling Frequency   = %g", sample_rate);
        $fstrobe(fptr, "Starting Time        = 0");
        $fstrobe(fptr, "$DATA_INFO");
        $fstrobe(fptr, "Number of points     =        %d", number_of_samples);
        $fstrobe(fptr, "Signal Type          = Double");
        $fstrobe(fptr, "$DATA ASCII");
     end
  end

  if (record == 0) period = 1e6;
  @(timer(0, period)) begin
     if(record == 1) $fstrobe(fptr, "%g", V(in));
  end

  @ (final_step) begin
     $fclose(fptr);
  end
end
endmodule
Back to top
 
 
View Profile   IP Logged
Roky
New Member
*
Offline



Posts: 5

Re: write output to file
Reply #2 - Apr 28th, 2003, 2:37pm
 
Thanks for your help Eugene.... I' ll try it...

Regards...  Roky
Back to top
 
 
View Profile   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.