HSPICE - Measuring a series of values in transient simulation
Hspice .MEASURE Continuous Results

This is from the 2014.09 Hspice command reference:

.MEASURE (Continuous Results)
Measures continuous results for TRIG-TARG, FIND-WHEN, Equation, and PARAM Evaluation functions.
Syntax
...


Examples from the documentation:

Example 2 The .measure statement continuously reports the time when the voltage value of node a1 reaches 2.5V, starting from the second falling edge.
.measure tran_cont cont_vout1 when v(a1)=2.5 fall=2

Example 3 The following example shows a correct .measure statement.
.measure tran_cont PERIOD
+ TRIG v(out) VAL =VDD/2 RISE=1
+ TARG v(out) VAL =VDD/2 RISE=2
.measure tran_cont FREQUENCY PARAM=1/PERIOD


The output will be in a separate continuous measures file

Hspice .MEASURE generation

Make a perl/python/whatever script that generates a .measure for each edge. Include the .measure statements into your hspice deck. The ostensible advantage of this is that the results will reside with the rest of the measurements.

VerilogA block

One can write a VerilogA piece of code which can be triggered by edges to output the time into a file. In Cadence there should be a sample library with some sample VerilogA widgets. The VerilogA code should be included into the hspice deck with a .hdl command and should be instantiated like any other subcircuit. Possible VerilogA code (in this case connect the signal of interest to the 'in' of this sampler:

`include "disciplines.vams"

module sampler(in);
input in; electrical in;

parameter real thres=0.5;

integer fh;

analog begin
  @(initial_step) begin
    fh = $fopen("times.txt","w");
  end
  @(final_step) begin
    $fclose(fh);
  end
  @(cross(V(in)-thres, +1, 10p)) begin
  //                   +1 means rising edge only
    $fstrobe(fh,"%g",$abstime);
  end
end
endmodule


PyOPUS post-processing

If you're looking for a more general post-procesing Python environment use PyOPUS.  PyOPUS will open Hspice POST_VERSION=9601 binary data into numpy data structures. A post-processing script might look like:

import pyopus.simulator.hspicefile as hspf
import pyopus.evaluator.measure as meas

hspfObj = hspf.hspice_read( 'netlist.tr0' )
if hspfObj is None:
    raise Exception("Error opening hspice file")

results = hspfObj[0][0][2][0]  # dictionary of waveforms, keyed by name
time = results[hspfObj[0][1]]  # list of scale point (in this case time)

i_rises = meas.IatXval(results['out'], 0.5, slope='rising')
t_rises = meas.XatI(time, i_rises)