Skip to content

Commit

Permalink
straightforward merge of serv and qerv
Browse files Browse the repository at this point in the history
  • Loading branch information
uhit332 committed Oct 20, 2023
1 parent 0c0fe9c commit 918f89b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
31 changes: 22 additions & 9 deletions rtl/serv_state.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ module qerv_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,29 @@ module qerv_state
just need to check if cnt_r is not zero to see if the counter is
currently running
*/
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 };
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;
o_cnt_en <= 1'b0;
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 @(*)
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
4 changes: 3 additions & 1 deletion rtl/serv_top.v
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ module qerv_top
#(.RESET_STRATEGY (RESET_STRATEGY),
.WITH_CSR (WITH_CSR[0:0]),
.MDU(MDU),
.ALIGN(ALIGN))
.ALIGN(ALIGN),
.W(W)
)
state
(
.i_clk (clk),
Expand Down

0 comments on commit 918f89b

Please sign in to comment.