You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
767 B
24 lines
767 B
7 months ago
|
//VerilogA for modulator,idealmz,veriloga
|
||
|
|
||
|
`include "constants.vams"
|
||
|
`include "disciplines.vams"
|
||
|
|
||
|
module idealmz(Ipow,Iphase,Ilam,Opow,Ophase,Olam,Vdata);
|
||
|
parameter real ext = 30 from [0:inf);
|
||
|
parameter real sym = -1 from [-1:1);
|
||
|
parameter integer Chirp = 1 from [-1:1] exclude 0;
|
||
|
input Ipow,Iphase,Ilam,Vdata;
|
||
|
output Opow,Ophase,Olam;
|
||
|
electrical Ipow,Iphase,Ilam,Opow,Ophase,Olam,Vdata;
|
||
|
|
||
|
real fext,dph;
|
||
|
analog begin
|
||
|
fext = 1.0 - 4.0 / `M_PI * atan(1.0 / sqrt(pow(10, ext / 10.0)));
|
||
|
dph = `M_PI / 2.0 * (0.5 - fext * (V(Vdata) - 0.5));
|
||
|
V(Olam) <+ V(Ilam);
|
||
|
V(Ophase) <+ V(Iphase) + Chirp * dph * (1 + sym)/(1 - sym) * 360.0 / (2 * `M_PI);
|
||
|
V(Opow) <+ V(Ipow) * pow(cos(dph),2);
|
||
|
end
|
||
|
|
||
|
endmodule
|