2 use ieee.std_logic_1164.all;
3 use ieee.numeric_std.all;
9 sys_clk : in std_logic;
10 sys_res_n : in std_logic;
15 do_calc : in std_logic;
16 calc_done : out std_logic
20 architecture beh of alu is
21 type ALU_STATE is (SIDLE, SADD, SSUB, SMUL, SDIV, SDONE);
22 signal state, state_next : ALU_STATE;
23 signal done_intern : std_logic;
24 signal op3_int, op3_next : csigned;
25 signal calc_done_int, calc_done_next : std_logic;
28 calc_done <= calc_done_int;
31 process(sys_clk, sys_res_n)
33 if sys_res_n = '0' then
35 elsif rising_edge(sys_clk) then
38 calc_done_int <= calc_done_next;
43 process(state, opcode, done_intern, do_calc)
45 -- set a default value for next state
47 -- next state berechnen
65 if done_intern = '1' then
69 if done_intern = '1' then
73 if done_intern = '1' then
77 if done_intern = '1' then
88 process(state, op1, op2)
89 variable tmperg : csigned;
90 variable multmp : signed(((2*CBITS)-1) downto 0);
92 op3_next <= (others => '0');
93 calc_done_next <= '0';
97 tmperg := (others => '0');
107 tmperg(CBITS-1) := multmp((2*CBITS)-1);
108 tmperg((CBITS-2) downto 0) := multmp((CBITS-2) downto 0);
115 calc_done_next <= '1';
117 tmperg := (others => '0');
120 end architecture beh;