Hmmm, I tried setting the maxstep parameter down to 50e-12, errpreset=conservative, $bound_step(0.1*period); without any improvement in the noise floor. I also used the maximum tolerance option for the @cross function. (see code below)
Code:simulator lang=spectre
ahdl_include "widthcounter.va"
ahdl_include "fmeasure.va"
parameters FS=200e6
Vin (in 0) vsource type=sine ampl=0.5 freq=8.4e3 dc=0 sinedc=0
Vclk (clk 0) vsource type=pulse period=1/FS rise=1p fall=1p
sdvco (out in clk) sdm Kvco=0.5e6 f0=4*4.352e6 period=1/FS
resp tran stop=8/8.4e3 skipdc=yes errpreset=conservative maxstep=50e-12
Code:`include "disciplines.vams"
`include "constants.vams"
module sdm (out, in, clk);
input in, clk; voltage in, clk;
output out; voltage out;
parameter real f0=4*4.352e6; // Carrier frequency VCO
parameter real Kvco=0.5e6; // Gain VCO
parameter real period=1/200e6; // Sampling frequency
integer fptr1;
real TFM, last_timee, Te;
real freq, phase, last_time, current_time;
analog begin
@(initial_step)
begin
fptr1=$fopen("...path to file");
end
$bound_step(0.1*period);
freq = f0+Kvco*V(in);
phase = 2*`M_PI*idtmod(freq, 0.0, 1.0, -0.5);
@(cross(phase + `M_PI/2, +1, 1e-12, 1e-12) or cross(phase - `M_PI/2, +1, 1e-12, 1e-12))
begin
current_time = $abstime;
if (last_time > 0.0) TFM = period/(current_time - last_time);
last_time = current_time;
end
@(cross(V(clk) - 0.5, 1)) begin
$fstrobe(fptr1, "%g", TFM);
end
@(final_step) $fclose(fptr1);
V(out) <+ phase;
end
endmodule
Do you know what else I might try?
Cheers