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

Subversion Repositories hicovec

[/] [hicovec/] [trunk/] [cpu/] [groups/] [aluinputgroup.vhd] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 hmanske
------------------------------------------------------------------
2 4 hmanske
-- PROJECT:      HiCoVec (highly configurable vector processor)
3 2 hmanske
--
4
-- ENTITY:      aluinputgroup
5
--
6
-- PURPOSE:     consists of and connects components
7
--              used to switch inputs for the scalar
8
--              alu
9
--              also includes instruction register
10
--
11
-- AUTHOR:      harald manske, haraldmanske@gmx.de
12
--
13
-- VERSION:     1.0
14
------------------------------------------------------------------
15
library ieee;
16
use ieee.std_logic_1164.all;
17
use ieee.std_logic_unsigned.all;
18
 
19
entity aluinputgroup is
20
    port(   -- clock
21
            clk:            in std_logic;
22
 
23
            -- data inputs
24
            memory_in:      in std_logic_vector(31 downto 0);   -- data from ram
25
            x_in:           in std_logic_vector(31 downto 0);
26
            y_in:           in std_logic_vector(31 downto 0);
27
            a_in:           in std_logic_vector(31 downto 0);
28
 
29
            -- data outputs
30
            ir_out:         out std_logic_vector(31 downto 0);
31
            k_out:          out std_logic_vector(31 downto 0);  -- k for vector unit
32
            vector_out:     out std_logic_vector(31 downto 0);  -- data for vector unit
33
            a_out:          out std_logic_vector(31 downto 0);
34
            b_out:          out std_logic_vector(31 downto 0);
35
 
36
            -- control signals
37
            sel_a:          in std_logic_vector(1 downto 0);
38
            sel_b:          in std_logic_vector(1 downto 0);
39
            sel_source_a:   in std_logic;                       -- c8
40
            sel_source_b:   in std_logic;                       -- c0
41
            load_ir:        in std_logic
42
         );
43
end aluinputgroup;
44
 
45
architecture rtl of aluinputgroup is
46
    component dataregister
47
        port(   clk:        in std_logic;
48
                load:       in std_logic;
49
                data_in:    in std_logic_vector(31 downto 0);
50
                data_out:   out std_logic_vector(31 downto 0)
51
            );
52
    end component;
53
 
54
    component multiplexer4
55
        generic (
56
            w : positive
57
        );
58
        port (
59
            selector:    in std_logic_vector(1 downto 0);
60
            data_in_00:  in std_logic_vector(w-1 downto 0);
61
            data_in_01:  in std_logic_vector(w-1 downto 0);
62
            data_in_10:  in std_logic_vector(w-1 downto 0);
63
            data_in_11:  in std_logic_vector(w-1 downto 0);
64
            data_out:    out std_logic_vector(w-1 downto 0)
65
        );
66
    end component;
67
 
68
    component multiplexer2
69
        generic (
70
            w : positive
71
        );
72
        port (
73
            selector:   in std_logic;
74
            data_in_0:  in std_logic_vector(w-1 downto 0);
75
            data_in_1:  in std_logic_vector(w-1 downto 0);
76
            data_out:   out std_logic_vector(w-1 downto 0)
77
        );
78
    end component;
79
 
80
    for ir:    dataregister use entity work.dataregister(rtl);
81
    for mux_a: multiplexer4 use entity work.multiplexer4(rtl);
82
    for mux_b: multiplexer4 use entity work.multiplexer4(rtl);
83
    for mux_source_b: multiplexer2 use entity work.multiplexer2(rtl);
84
    for mux_source_a: multiplexer2 use entity work.multiplexer2(rtl);
85
 
86
    signal instruction: std_logic_vector(31 downto 0);
87
    signal n: std_logic_vector(31 downto 0);
88
    signal mux_a_to_source: std_logic_vector(31 downto 0);
89
    signal mux_b_to_source: std_logic_vector(31 downto 0);
90
 
91
    begin
92
        ir: dataregister
93
            port map (
94
                clk => clk,
95
                load => load_ir,
96
                data_in => memory_in,
97
                data_out => instruction
98
            );
99
 
100
        mux_a: multiplexer4
101
            generic map (
102
                w => 32
103
            )
104
            port map (
105
                selector => sel_a,
106
                data_in_00 => "00000000000000000000000000000000",
107
                data_in_01 => a_in,
108
                data_in_10 => x_in,
109
                data_in_11 => y_in,
110
                data_out => mux_a_to_source
111
            );
112
 
113
        mux_b: multiplexer4
114
            generic map (
115
                w => 32
116
            )
117
            port map (
118
                selector => sel_b,
119
                data_in_00 => n,
120
                data_in_01 => a_in,
121
                data_in_10 => x_in,
122
                data_in_11 => y_in,
123
                data_out => mux_b_to_source
124
            );
125
 
126
        mux_source_a: multiplexer2
127
            generic map (
128
                w => 32
129
            )
130
            port map (
131
                selector => sel_source_a,
132
                data_in_0 => mux_a_to_source,
133
                data_in_1 => "00000000000000000000000000000000",
134
                data_out => a_out
135
            );
136
 
137
 
138
        mux_source_b: multiplexer2
139
            generic map (
140
                w => 32
141
            )
142
            port map (
143
                selector => sel_source_b,
144
                data_in_0 => mux_b_to_source,
145
                data_in_1 => memory_in,
146
                data_out => b_out
147
            );
148
 
149
 
150
        n(15 downto 0) <= instruction(15 downto 0);
151
        n(31 downto 16) <= "0000000000000000";
152
        k_out <= mux_b_to_source;
153
        vector_out <= mux_a_to_source;
154
        ir_out <= instruction;
155
 
156
end rtl;

powered by: WebSVN 2.1.0

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