mirror of
https://github.com/olofk/serv.git
synced 2026-03-03 09:55:24 +00:00
Change timer wraparound behavior to be more useful
This commit is contained in:
committed by
Olof Kindgren
parent
bc74a9a1d7
commit
bc984f6639
@@ -14,9 +14,9 @@ module servant_timer
|
||||
localparam HIGH = WIDTH-1-DIVIDER;
|
||||
|
||||
reg [WIDTH-1:0] mtime;
|
||||
reg [HIGH:0] mtimecmp;
|
||||
reg signed [HIGH:0] mtimecmp;
|
||||
|
||||
wire [HIGH:0] mtimeslice = mtime[WIDTH-1:DIVIDER];
|
||||
wire signed [HIGH:0] mtimeslice = mtime[WIDTH-1:DIVIDER];
|
||||
|
||||
always @(mtimeslice) begin
|
||||
o_wb_dat = 32'd0;
|
||||
@@ -27,7 +27,7 @@ module servant_timer
|
||||
if (i_wb_cyc & i_wb_we)
|
||||
mtimecmp <= i_wb_dat[HIGH:0];
|
||||
mtime <= mtime + 'd1;
|
||||
o_irq <= (mtimeslice >= mtimecmp);
|
||||
o_irq <= (mtimeslice - mtimecmp >= 0);
|
||||
if (RESET_STRATEGY != "NONE")
|
||||
if (i_rst) begin
|
||||
mtime <= 0;
|
||||
|
||||
Reference in New Issue
Block a user