Optimize locking mechanism in the FU that implements RISCV M-extension
@@ -151,7 +151,7 @@ begin
if (rstx = '0') then
t2data_r <= (others => '0');
elsif rising_edge(clk) then
- if (glock = '0' and t1load = '1') then
+ if (glock = '0' and t2load = '1') then
t2data_r <= t2data;
end if;
end if;
@@ -182,8 +182,7 @@ begin
-- arbitration
ctrl.cp_op_ff <= ctrl.cp_op;
ctrl.cnt <= "11110"; -- iterative cycle counter
- if (t1load = '1') then -- trigger new operation
- lock_req_r <= '1';
+ if (t1load = '1' and glock = '0') then -- trigger new operation
if (DIVISION_EN = true) then
-- DIV: check relevant input signs for result sign compensation --
if (ctrl.cp_op(1 downto 0) = cp_op_div_c(1 downto 0)) then -- signed div operation
@@ -202,8 +201,10 @@ begin
end if;
-- is fast multiplication?--
if (is_div = '0') and (FAST_MUL_EN = true) then
- ctrl.state <= S_DONE;
+ ctrl.out_en <= '1';
+ ctrl.state <= S_IDLE;
else -- serial division or serial multiplication
+ lock_req_r <= '1';
ctrl.state <= S_BUSY;
end if;
end if;
@@ -216,7 +217,6 @@ begin
end if;
when S_DONE => -- final step
- lock_req_r <= '1';
ctrl.out_en <= '1';
ctrl.state <= S_IDLE;
@@ -255,13 +255,13 @@ begin
end case;
end process decode_div_cp;
- decode_op_start_cp : process(t1load, is_div)
+ decode_op_start_cp : process(t1load, is_div, glock)
begin
mul.start <= '0';
div.start <= '0';
- if (t1load = '1' and is_div = '1') then
+ if (t1load = '1' and is_div = '1' and glock = '0') then
div.start <= '1';
- elsif (t1load = '1') then
+ elsif (t1load = '1' and glock = '0') then
mul.start <= '1';
end if;
end process decode_op_start_cp;
@@ -280,13 +280,13 @@ begin
mul.dsp_x <= signed((t1data(t1data'left) and ctrl.t1datas_signed) & t1data);
mul.dsp_y <= signed((t2data_shadow(t2data_shadow'left) and ctrl.t2datas_signed) & t2data_shadow);
end if;
- mul.prod <= std_logic_vector(mul.dsp_z(63 downto 0));
end if;
end if;
end process multiplier_core;
-- actual multiplication --
mul.dsp_z <= mul.dsp_x * mul.dsp_y;
+ mul.prod <= std_logic_vector(mul.dsp_z(63 downto 0));
end generate; --/multiplier_core_parallel
