OpenCores
URL https://opencores.org/ocsvn/mipsr2000/mipsr2000/trunk

Subversion Repositories mipsr2000

[/] [mipsr2000/] [trunk/] [Alu_out.vhd] - Blame information for rev 60

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 jimi39
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    01:34:34 06/21/2012 
6
-- Design Name: 
7
-- Module Name:    Alu_out - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
 
23
-- Uncomment the following library declaration if using
24
-- arithmetic functions with Signed or Unsigned values
25
use IEEE.NUMERIC_STD.ALL;
26
use IEEE.STD_LOGIC_UNSIGNED.ALL;
27
-- Uncomment the following library declaration if instantiating
28
-- any Xilinx primitives in this code.
29
--library UNISIM;
30
--use UNISIM.VComponents.all;
31
 
32
entity Alu_out is
33
port (
34
      clk : in  STD_LOGIC;
35
           rst : in  STD_LOGIC;
36
                I  : in std_logic_vector(31 downto 0);
37
                N  : in std_logic_vector(31 downto 0);
38
                Alu_all_in : in std_logic_vector(31 downto 0);
39
                M : out std_logic_vector(31 downto 0);
40
                Alu_out : out std_logic_vector(31 downto 0)
41
 
42
);
43
 
44
end Alu_out;
45
 
46
architecture Behavioral of Alu_out is
47
 
48
begin
49
      process(clk,rst,Alu_all_in)
50
                begin
51
                              if rst = '0' then
52
                                       Alu_out <= (others => '0');
53
                                                        elsif (RISING_EDGE(Clk))then
54
                                      Alu_out <= Alu_all_in;
55
 
56
                                                  end if;
57
      end process;
58
 
59
                process(clk,I,N,rst)
60
                variable M_var,N_var,I_var : signed(31 downto 0);
61
                variable shift_temp : std_logic_vector(31 downto 0);
62
                begin
63
                     N_var := signed(N);
64
                          shift_temp :=  to_stdlogicvector(to_bitvector(I) sla 2);
65
                          I_var := signed(shift_temp);
66
                          M_var := N_var + I_var;
67
 
68
                          if rst = '0' then
69
                             M <= (others => '0');
70
                          elsif (RISING_EDGE(Clk))then
71
                             M <= std_logic_vector(M_var);
72
                          end if;
73
                end process;
74
 
75
end Behavioral;
76
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.