From 26cd798bc91bff993b59e911c5d75cef9b679197 Mon Sep 17 00:00:00 2001 From: Olof Kindgren Date: Wed, 4 Sep 2024 13:15:04 +0200 Subject: [PATCH] Make all functions automatic The automatic keyword makes a function reentrant and avoids warnings by some synthesis tools. --- design/ifu/ifu.sv | 2 +- design/ifu/ifu_bp_ctl.sv | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/design/ifu/ifu.sv b/design/ifu/ifu.sv index dbf3375..f833eb5 100644 --- a/design/ifu/ifu.sv +++ b/design/ifu/ifu.sv @@ -394,7 +394,7 @@ assign tmp_bnk[2:0] = encode8_3(bp.btb_sel_f2[7:0]); if(dec_tlu_br1_wb_pkt.br_error | dec_tlu_br1_wb_pkt.br_start_error) $display("%7d BTB_ERR1: index: %0h bank: %0h start: %b rfpc: %h way: %h", `DEC.tlu.mcyclel[31:0]+32'ha,dec_tlu_br1_wb_pkt.index[`RV_BTB_ADDR_HI:`RV_BTB_ADDR_LO],dec_tlu_br1_wb_pkt.bank[1:0], dec_tlu_br1_wb_pkt.br_start_error, {exu_flush_path_final[31:1], 1'b0}, dec_tlu_br1_wb_pkt.way); end // always @ (negedge clk) - function [2:0] encode8_3; + function automatic [2:0] encode8_3; input [7:0] in; encode8_3[2] = |in[7:4]; diff --git a/design/ifu/ifu_bp_ctl.sv b/design/ifu/ifu_bp_ctl.sv index d57d119..e3d35ef 100644 --- a/design/ifu/ifu_bp_ctl.sv +++ b/design/ifu/ifu_bp_ctl.sv @@ -1703,7 +1703,7 @@ assign fgmask_f2[0] = (~ifc_fetch_addr_f2[3] & ~ifc_fetch_addr_f2[2] - function [2:0] encode8_3; + function automatic [2:0] encode8_3; input [7:0] in; encode8_3[2] = |in[7:4]; @@ -1711,7 +1711,7 @@ assign fgmask_f2[0] = (~ifc_fetch_addr_f2[3] & ~ifc_fetch_addr_f2[2] encode8_3[0] = in[7] | in[5] | in[3] | in[1]; endfunction - function [7:0] decode3_8; + function automatic [7:0] decode3_8; input [2:0] in; decode3_8[7] = in[2] & in[1] & in[0]; @@ -1724,7 +1724,7 @@ assign fgmask_f2[0] = (~ifc_fetch_addr_f2[3] & ~ifc_fetch_addr_f2[2] decode3_8[0] = ~in[2] & ~in[1] & ~in[0]; endfunction - function [3:0] decode2_4; + function automatic [3:0] decode2_4; input [1:0] in; decode2_4[3] = in[1] & in[0]; @@ -1734,7 +1734,7 @@ assign fgmask_f2[0] = (~ifc_fetch_addr_f2[3] & ~ifc_fetch_addr_f2[2] endfunction - function [3:0] countones; + function automatic [3:0] countones; input [7:0] valid; begin @@ -1749,7 +1749,7 @@ countones[3:0] = {3'b0, valid[7]} + {3'b0, valid[0]}; end endfunction - function [2:0] newlru; // updated lru + function automatic [2:0] newlru; // updated lru input [2:0] lru;// current lru input [1:0] used;// hit way begin @@ -1765,7 +1765,7 @@ newlru[0] = (~lru[2] & lru[1] & ~used[1] & ~used[0]) | (~lru[1] & ~lru[0] & used end endfunction // - function [1:0] lru2way; // new repl way taking invalid ways into account + function automatic [1:0] lru2way; // new repl way taking invalid ways into account input [2:0] lru; // current lru input [2:0] v; // current way valids begin