Merge pull request #35 from antonblanchard/multiply-opt

Simplify multiply
pull/36/head
Anton Blanchard 5 years ago committed by GitHub
commit d79c994158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,7 +10,7 @@ use work.crhelpers.all;


entity multiply is entity multiply is
generic ( generic (
PIPELINE_DEPTH : integer := 6 PIPELINE_DEPTH : natural := 6
); );
port ( port (
clk : in std_logic; clk : in std_logic;
@ -58,21 +58,16 @@ begin


m_out <= MultiplyToWritebackInit; m_out <= MultiplyToWritebackInit;


if m.valid then v.multiply_pipeline(0).valid := m.valid;
v.multiply_pipeline(0).valid := '1';
v.multiply_pipeline(0).insn_type := m.insn_type; v.multiply_pipeline(0).insn_type := m.insn_type;
v.multiply_pipeline(0).data := signed(m.data1) * signed(m.data2); v.multiply_pipeline(0).data := signed(m.data1) * signed(m.data2);
v.multiply_pipeline(0).write_reg := m.write_reg; v.multiply_pipeline(0).write_reg := m.write_reg;
v.multiply_pipeline(0).rc := m.rc; v.multiply_pipeline(0).rc := m.rc;
else
v.multiply_pipeline(0).valid := '0';
end if;


loop_0: for i in 0 to PIPELINE_DEPTH-2 loop loop_0: for i in 1 to PIPELINE_DEPTH-1 loop
v.multiply_pipeline(i+1) := r.multiply_pipeline(i); v.multiply_pipeline(i) := r.multiply_pipeline(i-1);
end loop; end loop;


if v.multiply_pipeline(PIPELINE_DEPTH-1).valid then
d := std_ulogic_vector(v.multiply_pipeline(PIPELINE_DEPTH-1).data); d := std_ulogic_vector(v.multiply_pipeline(PIPELINE_DEPTH-1).data);


case_0: case v.multiply_pipeline(PIPELINE_DEPTH-1).insn_type is case_0: case v.multiply_pipeline(PIPELINE_DEPTH-1).insn_type is
@ -87,10 +82,12 @@ begin
d2 := (others => '0'); d2 := (others => '0');
end case; end case;


m_out.write_reg_data <= d2;
m_out.write_reg_nr <= v.multiply_pipeline(PIPELINE_DEPTH-1).write_reg;

if v.multiply_pipeline(PIPELINE_DEPTH-1).valid then
m_out.valid <= '1'; m_out.valid <= '1';
m_out.write_reg_enable <= '1'; m_out.write_reg_enable <= '1';
m_out.write_reg_nr <= v.multiply_pipeline(PIPELINE_DEPTH-1).write_reg;
m_out.write_reg_data <= d2;


if v.multiply_pipeline(PIPELINE_DEPTH-1).rc = '1' then if v.multiply_pipeline(PIPELINE_DEPTH-1).rc = '1' then
m_out.write_cr_enable <= '1'; m_out.write_cr_enable <= '1';

Loading…
Cancel
Save