The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Simulators >> Circuit Simulators >> exporting files from spectre to matlab ? https://designers-guide.org/forum/YaBB.pl?num=1092731732 Message started by City on Aug 17th, 2004, 1:35am |
Title: exporting files from spectre to matlab ? Post by City on Aug 17th, 2004, 1:35am Hi, is it possible to save a transient simulation result and to export it to matlab for signal processing ? Can anybody tell me how to do it ? regards, City |
Title: Re: exporting files from spectre to matlab ? Post by Eugene on Aug 17th, 2004, 11:34am I do this all the time, in both directions. If you have already run the simulation, you can use the waveform calculator's "printvs" command to display the data. You will have to change the format from engineering to scientific units. You then click the "print" command and print to a file. You can only print 1000 or so points this way. For more points, you have to use the command line. I prefer creating the file with VerilogA. I've included a piece of VerilogA code I use to create files. In Matlab, read the data in with aa=load('IinputCol'); You will have to make sure the path to the directory is in your Matlab path. //================================= `include "constants.h" `include "discipline.h" module write1(in); input in; electrical in; parameter real sample_rate = 1e6 from (0:inf]; parameter integer record = 1 from [0:1]; // 1 = record, 0 = don't. integer fptr; real period; analog begin @ ( initial_step ) begin if (record ==1) begin fptr = $fopen("/home/rcvr_5GHz/IinputCol"); end period = 1/sample_rate; 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 |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |