| |
Here to introduce some techniques to perform. data analysis of Cadence Spectre simulations using MathWorks Matlab. This is very useful in situations that requires complex mathematic operations, to obtain better simulation graphs or when WaveScan/AWD can't plot data on very large simulations. Basic knowledge of Spectre and Matlab are required.
source /afs/fe.up.pt/service/cadsw/setup/scripts/setup.mmsim.6.2 source /afs/fe.up.pt/service/cadsw/setup/scripts/setup.matlab.R2008A
simdir = '/home/<USER>/projects/austriamicrosystems/freq_synthethizer/Sim/freq_synthethizer/spectre/schematic/psf' datalist = cds_srr(simdir) % List of simulated analysis signals = cds_srr(simdir,'tran-tran') % List of signals of the temporal analysis signals.V % List signals to console v = cds_srr(simdir, 'tran-tran', 'SIGNAL'); % Change 'SIGNAL' by the desired signal name
To import and view large simulation data to Matlab it's a good practice to split the information otherwise the computer will freeze. To do this I've wrote this to Matlab scripts. To use it, just change the net names to fit your simulation.
% Microelectronics Students Group % Faculty of Engineering of the University of Porto % Department of Electrical and Computer Engineering % % Description: Generates data files from Spectre simulations % Américo Dias, Jun 2009 simdir = '/home/adias/projects/austriamicrosystems/hit-kit-4.0/pll/Sim/pll/spectre/schematic/psf' disp 'Loading fref...'; fref = cds_srr(simdir, 'tran-tran', 'fref'); disp 'Loading fdiv...'; fdiv = cds_srr(simdir, 'tran-tran', 'net023'); disp 'Loading charge pump output...'; cp = cds_srr(simdir, 'tran-tran', 'net033'); disp 'Loading vco output...'; ut = cds_srr(simdir, 'tran-tran', 'outp'); disp 'Spliting data...'; totalSize = numel(fref.time); counter = 1; block = 0; step = 10e-6; currentStep = step; left = 1; while(counter <= totalSize) if(fref.time(counter) > currentStep) currentStep = currentStep + step; block = block + 1; filename = sprintf('data_%d.dat', block); disp(sprintf('Creating %s', filename)); data = [fref.time(left:counter), fref.V(left:counter), fdiv.V(left:counter), cp.V(left:counter), out.V(left:counter)]; save(filename, 'data', '-ascii'); left = counter; end counter = counter + 1; end disp 'Done!';
% Microelectronics Students Group % Faculty of Engineering of the University of Porto % Department of Electrical and Computer Engineering % % Description: Generates graphs directly from data files % Américo Dias, Jun 2009 nBlocks = 26; % Change this to the number of blocks you have for j=1:nBlocks, disp(sprintf('Block %d...', j)); filename = sprintf('data_%d.dat', j); data = load(filename, '-ASCII'); figure(1); subplot(4,1,1); plot(data(:,1), data(:,2)); axis([data(1,1) data(end,1) 0 3.3]); subplot(4,1,2); plot(data(:,1), data(:,3)); axis([data(1,1) data(end,1) 0 3.3]); subplot(4,1,3); plot(data(:,1), data(:,4)); axis([data(1,1) data(end,1) 0 3.3]); subplot(4,1,4); plot(data(:,1), data(:,5)); axis([data(1,1) data(end,1) 0 3.3]); pause; end disp 'Done!';