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
598 B
24 lines
598 B
7 months ago
|
//VerilogA for lightsource,cw_realimageinput,veriloga
|
||
|
`include "constants.vams"
|
||
|
`include "disciplines.vams"
|
||
|
|
||
|
module cw_realimageinput(Vreal,Vimag,Vlam,Opow,Ophase,Olam);
|
||
|
parameter real GainCoeff = 1 from [0:inf);
|
||
|
parameter real PhaseCoeff = 0 from (-360:360);
|
||
|
|
||
|
input Vreal,Vimag,Vlam;
|
||
|
output Opow,Ophase,Olam;
|
||
|
electrical Vreal,Vimag,Vlam,Pout,Opow,Ophase,Olam;
|
||
|
real mag,phase;
|
||
|
|
||
|
analog begin
|
||
|
mag=sqrt(pow(V(Vreal),2)+pow(V(Vimag),2));
|
||
|
phase=acos(V(Vreal)/mag);
|
||
|
V(Opow) <+ pow(mag*GainCoeff,2);
|
||
|
V(Ophase) <+ (PhaseCoeff+phase)/(2*`M_PI)*360.0;
|
||
|
V(Olam) <+ V(Vlam);
|
||
|
end
|
||
|
|
||
|
|
||
|
endmodule
|