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

Subversion Repositories potato

[/] [potato/] [trunk/] [src/] [pp_alu_mux.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 skordal
-- The Potato Processor - A simple processor for FPGAs
2
-- (c) Kristian Klomsten Skordal 2014 <kristian.skordal@wafflemail.net>
3 3 skordal
-- Report bugs and issues on <http://opencores.org/project,potato,bugtracker>
4 2 skordal
 
5
library ieee;
6
use ieee.std_logic_1164.all;
7
use ieee.numeric_std.all;
8
 
9
use work.pp_types.all;
10
 
11
--! @brief Multiplexer used to choose between ALU inputs.
12
entity pp_alu_mux is
13
        port(
14
                source : in alu_operand_source;
15
 
16
                register_value  : in std_logic_vector(31 downto 0);
17
                immediate_value : in std_logic_vector(31 downto 0);
18
                shamt_value     : in std_logic_vector( 4 downto 0);
19
                pc_value        : in std_logic_vector(31 downto 0);
20
                csr_value       : in std_logic_vector(31 downto 0);
21
 
22
                output : out std_logic_vector(31 downto 0)
23
        );
24
end entity pp_alu_mux;
25
 
26
architecture behaviour of pp_alu_mux is
27
begin
28
 
29
        mux: process(source, register_value, immediate_value, shamt_value, pc_value, csr_value)
30
        begin
31
                case source is
32
                        when ALU_SRC_REG =>
33
                                output <= register_value;
34
                        when ALU_SRC_IMM =>
35
                                output <= immediate_value;
36
                        when ALU_SRC_PC =>
37
                                output <= pc_value;
38
                        when ALU_SRC_PC_NEXT =>
39
                                output <= std_logic_vector(unsigned(pc_value) + 4);
40
                        when ALU_SRC_CSR =>
41
                                output <= csr_value;
42
                        when ALU_SRC_SHAMT =>
43
                                output <= (31 downto 5 => '0') & shamt_value;
44
                        when ALU_SRC_NULL =>
45
                                output <= (others => '0');
46
                end case;
47
        end process mux;
48
 
49
end architecture behaviour;

powered by: WebSVN 2.1.0

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