Ignore the prescaler if prescaler init value is zero

This commit is contained in:
Joachim Strömbergson 2022-10-13 16:24:03 +02:00
parent 2be934ee22
commit c3f7c5fb06
No known key found for this signature in database
GPG Key ID: 865B8A548EA61679

View File

@ -159,8 +159,13 @@ module timer_core(
ready_we = 1'h1; ready_we = 1'h1;
prescaler_set = 1'h1; prescaler_set = 1'h1;
timer_set = 1'h1; timer_set = 1'h1;
core_ctrl_new = CTRL_PRESCALER; if (prescaler_init == 0) begin
core_ctrl_we = 1'h1; core_ctrl_new = CTRL_TIMER;
core_ctrl_we = 1'h1;
end else begin
core_ctrl_new = CTRL_PRESCALER;
core_ctrl_we = 1'h1;
end
end end
end end
@ -177,9 +182,7 @@ module timer_core(
if (prescaler_reg == 0) begin if (prescaler_reg == 0) begin
core_ctrl_new = CTRL_TIMER; core_ctrl_new = CTRL_TIMER;
core_ctrl_we = 1'h1; core_ctrl_we = 1'h1;
end end else begin
else begin
prescaler_dec = 1'h1; prescaler_dec = 1'h1;
end end
end end
@ -203,10 +206,13 @@ module timer_core(
end end
else begin else begin
prescaler_set = 1'h1; timer_dec = 1'h1;
timer_dec = 1'h1;
core_ctrl_new = CTRL_PRESCALER; if (prescaler_init > 0) begin
core_ctrl_we = 1'h1; prescaler_set = 1'h1;
core_ctrl_new = CTRL_PRESCALER;
core_ctrl_we = 1'h1;
end
end end
end end
end end