A verilogA code to measure frequency (copied from designers-guide)
However, i got many warnings and errors.
Is it because it is a verilogAMS rather than verilogaA?
I am using Cadence 5141 mmsim61
1) like the `timescale 1ns / 1ps ->
Warning from spectre during SpectreHDL compile.
"xxxx/freq_meas/veriloga/veriloga.va", line 6:
Warning: `timescale directive is found in the module, if without a
`default_transition directive or local setting of transitions in either
transition filters or Z-transforms. In Verilog-A this results in the
`timescale setting the transistion time which is not supported by the
Verilog-AMS LRM. Please use `default_transition instead to set default
transition time for transition filters or zi_* filters.
Sound like I could I use this command.
2)
Line14 "initial begin<<--?" syntax error
Code:[color=#0000ff]`timescale 1ns / 1ps[/color]
module freq_meas (clk);
input clk;
real last_time, current_time, freq;
[color=#0000ff] initial begin[/color]
last_time = 0.0;
freq = 0.0;
end
always @(posedge clk) begin
current_time = $realtime;
if (last_time > 0.0)
freq = 1.0e9 / (current_time - last_time);
last_time = current_time;
end
endmodule