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,10 +159,15 @@ module timer_core(
ready_we = 1'h1;
prescaler_set = 1'h1;
timer_set = 1'h1;
if (prescaler_init == 0) begin
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
CTRL_PRESCALER: begin
@ -177,9 +182,7 @@ module timer_core(
if (prescaler_reg == 0) begin
core_ctrl_new = CTRL_TIMER;
core_ctrl_we = 1'h1;
end
else begin
end else begin
prescaler_dec = 1'h1;
end
end
@ -203,13 +206,16 @@ module timer_core(
end
else begin
prescaler_set = 1'h1;
timer_dec = 1'h1;
if (prescaler_init > 0) begin
prescaler_set = 1'h1;
core_ctrl_new = CTRL_PRESCALER;
core_ctrl_we = 1'h1;
end
end
end
end
default: begin
end