Added picorv32_pcpi_fast_mul MUL_CLKGATE

This commit is contained in:
Clifford Wolf 2016-09-05 22:37:52 +02:00
parent e45cc362a7
commit 5fdee952c9
1 changed files with 9 additions and 4 deletions

View File

@ -1918,7 +1918,8 @@ endmodule
module picorv32_pcpi_fast_mul #( module picorv32_pcpi_fast_mul #(
parameter EXTRA_MUL_FFS = 0, parameter EXTRA_MUL_FFS = 0,
parameter EXTRA_INSN_FFS = 0 parameter EXTRA_INSN_FFS = 0,
parameter MUL_CLKGATE = 0
) ( ) (
input clk, resetn, input clk, resetn,
@ -1963,10 +1964,14 @@ module picorv32_pcpi_fast_mul #(
always @(posedge clk) begin always @(posedge clk) begin
pcpi_insn_valid_q <= pcpi_insn_valid; pcpi_insn_valid_q <= pcpi_insn_valid;
if (!MUL_CLKGATE || active[0]) begin
rs1_q <= rs1; rs1_q <= rs1;
rs2_q <= rs2; rs2_q <= rs2;
end
if (!MUL_CLKGATE || active[2]) begin
rd_q <= rd; rd_q <= rd;
end end
end
always @(posedge clk) begin always @(posedge clk) begin
rd <= $signed(EXTRA_MUL_FFS ? rs1_q : rs1) * $signed(EXTRA_MUL_FFS ? rs2_q : rs2); rd <= $signed(EXTRA_MUL_FFS ? rs1_q : rs1) * $signed(EXTRA_MUL_FFS ? rs2_q : rs2);