(fpga) Integrate free running support in API

Add support in the Timer API to enable the free runing mode.

Signed-off-by: Joachim Strömbergson <joachim@assured.se>
This commit is contained in:
Joachim Strömbergson 2024-08-15 08:43:25 +02:00
parent 9c465cd813
commit 041559f19a
No known key found for this signature in database
GPG Key ID: 5DDC7C542422EC8D

View File

@ -39,6 +39,8 @@ module timer(
localparam ADDR_PRESCALER = 8'h0a;
localparam ADDR_TIMER = 8'h0b;
localparam ADDR_FREE_RUNNING = 8'h0c;
localparam FREE_RUNNING_BIT = 0;
//----------------------------------------------------------------
@ -56,6 +58,9 @@ module timer(
reg stop_reg;
reg stop_new;
reg free_running_reg;
reg free_running_we;
//----------------------------------------------------------------
// Wires.
@ -85,6 +90,7 @@ module timer(
.timer_init(timer_reg),
.start(start_reg),
.stop(stop_reg),
.free_running(free_running_reg),
.curr_timer(core_curr_timer),
.running(core_running)
@ -113,6 +119,10 @@ module timer(
if (timer_we) begin
timer_reg <= write_data;
end
if (free_running_we) begin
free_running_reg <= write_data[0];
end
end
end // reg_update
@ -126,6 +136,7 @@ module timer(
begin : api
start_new = 1'h0;
stop_new = 1'h0;
free_running_we = 1'h0;
prescaler_we = 1'h0;
timer_we = 1'h0;
tmp_read_data = 32'h0;
@ -148,6 +159,10 @@ module timer(
if (address == ADDR_TIMER) begin
timer_we = 1'h1;
end
if (address == ADDR_FREE_RUNNING) begin
free_running_we = 1'h1;
end
end
end