mirror of
https://github.com/olofk/serv.git
synced 2025-04-20 11:57:07 -04:00
support for W=4
This commit is contained in:
parent
f9d6b23543
commit
46a820ee42
1 changed files with 21 additions and 7 deletions
|
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue