Skip to content

Commit

Permalink
support for W=4
Browse files Browse the repository at this point in the history
  • Loading branch information
uhit332 authored and olofk committed Oct 31, 2023
1 parent f9d6b23 commit 46a820e
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions rtl/serv_state.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ module serv_state
#(parameter RESET_STRATEGY = "MINI",
parameter [0:0] WITH_CSR = 1,
parameter [0:0] ALIGN =0,
parameter [0:0] MDU = 0)
parameter [0:0] MDU = 0,
parameter W = 1
)
(
input wire i_clk,
input wire i_rst,
Expand Down Expand Up @@ -174,18 +176,30 @@ module serv_state
just need to check if cnt_r is not zero to see if the counter is
currently running
*/
o_cnt <= o_cnt + {2'd0,cnt_r[3]};
cnt_r <= {cnt_r[2:0],(cnt_r[3] & !o_cnt_done) | (i_rf_ready & !o_cnt_en)};
if (W == 4) begin
if (i_rf_ready) o_cnt_en <= 1; else
if (o_cnt_done) o_cnt_en <= 0;
o_cnt <= o_cnt + { 2'b0, o_cnt_en };
end else if (W == 1) begin
o_cnt <= o_cnt + {2'd0,cnt_r[3]};
cnt_r <= {cnt_r[2:0],(cnt_r[3] & !o_cnt_done) | (i_rf_ready & !o_cnt_en)};
end
if (i_rst) begin
if (RESET_STRATEGY != "NONE") begin
o_cnt <= 3'd0;
cnt_r <= 4'b0000;
end
if (RESET_STRATEGY != "NONE") begin
o_cnt <= 3'd0;
if (W == 1)
cnt_r <= 4'b0000;
else if (W == 4)
o_cnt_en <= 1'b0;
end
end
end

always @(*)
if (W == 1)
o_cnt_en = |cnt_r;
else if (W == 4)
cnt_r = 4'b1111;

assign o_ctrl_trap = WITH_CSR & (i_e_op | i_new_irq | misalign_trap_sync);

Expand Down

0 comments on commit 46a820e

Please sign in to comment.