Verilog-A model in Namosim simulation

Status
Not open for further replies.

hmsheng

Full Member level 4
Joined
Dec 17, 2003
Messages
219
Helped
26
Reputation
52
Reaction score
10
Trophy points
1,298
Location
China
Activity points
1,556
pi veriloga

I build a Verilog-A VCO model. The model can work well in Cadence spectre simulation. But its frequency can't be tuned in nanosim simulation.

Can you help me?

Following is the VCO Verilog_A model:


`include "discipline.h"
`include "constants.h"


`define PI 3.14159265358979323846264338327950288419716939937511


module VCO(vin, vout);
input vin;
output vout;
electrical vin, vout;
parameter real amp = 1;
parameter real center_freq = 1K;
parameter real vco_gain = 1K;

real wc; // center freq in rad/s

real phase_lin; // wc*time component of phase
real phase_nonlin; // the idt(k*f(t)) of phase

integer num_cycles; // number of cycles in linear phase component

real inst_freq; // instanteous frequency

analog begin

@ ( initial_step ) begin
wc = 2 * `PI * center_freq;
end

phase_lin = wc * $abstime;
num_cycles = phase_lin / (2*`PI);
phase_lin = phase_lin - num_cycles * 2 * `PI;

phase_nonlin = 2 * `PI * vco_gain * idt(V(vin),0);

V(vout) <+ amp * sin (phase_lin + phase_nonlin);

inst_freq = center_freq + vco_gain * V(vin);
bound_step (0.04 / inst_freq);
end
endmodule
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…