Wolf-LITE/FPGA_61.440/vcxo_controller.v

33 wiersze
462 B
Coq
Czysty Zwykły widok Historia

2021-10-26 17:53:31 +00:00
module vcxo_controller(
2022-02-06 09:19:39 +00:00
pwm_clk_in,
2021-10-26 17:53:31 +00:00
VCXO_correction,
2022-02-06 09:19:39 +00:00
pump
2021-10-26 17:53:31 +00:00
);
2022-02-06 09:19:39 +00:00
input pwm_clk_in;
input unsigned [15:0] VCXO_correction;
2021-10-26 17:53:31 +00:00
output reg pump = 0;
2022-02-06 09:19:39 +00:00
reg unsigned [15:0] PWM_counter_MAX = 65500;
reg unsigned [15:0] PWM_counter = 0;
2021-10-26 17:53:31 +00:00
2022-02-06 09:19:39 +00:00
always @ (posedge pwm_clk_in)
2021-10-26 17:53:31 +00:00
begin
2022-02-06 09:19:39 +00:00
//count PWM
if(PWM_counter > PWM_counter_MAX)
2021-10-26 17:53:31 +00:00
PWM_counter = 0;
2022-02-06 09:19:39 +00:00
else
PWM_counter = PWM_counter + 1;
2021-10-26 17:53:31 +00:00
2022-02-06 09:19:39 +00:00
//do PWM
if(PWM_counter <= VCXO_correction)
2021-10-26 17:53:31 +00:00
pump = 1;
else
pump = 0;
end
2022-02-06 09:19:39 +00:00
2021-10-26 17:53:31 +00:00
endmodule