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


module phaseDetector(pin, nin, out);
input pin, nin; output out;
phase pin, nin;
electrical out;
parameter real gain = 1 from (0:inf); // transfer gain (A/cycle)
parameter real n = 0 from [0:inf); // white output current noise (A2/Hz)
parameter real fc = 0 from [0:inf); // flicker noise corner frequency (Hz)
analog begin
I(out) <+ gain * Theta(pin,nin) / (2*`M_PI);
I(out) <+ white_noise(n, "wpn") + flicker_noise(n*fc, 1, "fpn");
end
endmodule