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

Subversion Repositories cowgirl

[/] [cowgirl/] [trunk/] [alu.vhdl] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 thebeekeep
-- 10/24/2005
2
-- alu
3
 
4
library ieee;
5
use ieee.std_logic_1164.all;
6
use ieee.std_logic_arith.all;
7
 
8
entity alu is port(
9
        a:      in std_logic_vector(15 downto 0);
10
        b:      in std_logic_vector(15 downto 0);
11
        a_or_l: in std_logic;
12
        op:     in std_logic_vector(2 downto 0);
13
        o:      out std_logic_vector(15 downto 0)
14
);
15
end alu;
16
 
17
architecture alu_arch of alu is
18
 
19
component arithmetic port(
20
        a:      in signed(15 downto 0);
21
        b:      in signed(15 downto 0);
22
        fcn:    in std_logic_vector(2 downto 0);
23
        o:      out signed(15 downto 0);
24
        m_o:    out signed(31 downto 0)
25
);
26
end component;
27
 
28
component logical port(
29
        a:      in std_logic_vector(15 downto 0);
30
        b:      in std_logic_vector(15 downto 0);
31
        fcn:    in std_logic_vector(2 downto 0);
32
        o:      out std_logic_vector(15 downto 0)
33
);
34
end component;
35
 
36
component mux_2_1 port(
37
        a:      in std_logic_vector(15 downto 0);
38
        b:      in std_logic_vector(15 downto 0);
39
        sel:    in std_logic;
40
        o:      out std_logic_vector(15 downto 0)
41
);
42
end component;
43
 
44
signal s_a, s_b, s_o:   signed(15 downto 0);
45
signal l_o: std_logic_vector(15 downto 0);
46
 
47
begin
48
        s_a <= signed(a);
49
        s_b <= signed(b);
50
 
51
        arith: arithmetic
52
                port map(s_a, s_b, op, s_o);
53
        logic: logical
54
                port map(a, b, op, l_o);
55
        mux: mux_2_1
56
                port map(std_logic_vector(s_o), l_o, a_or_l, o);
57
end alu_arch;

powered by: WebSVN 2.1.0

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