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

Subversion Repositories potato

[/] [potato/] [trunk/] [src/] [pp_alu_mux.vhd] - Diff between revs 2 and 3

Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 3
-- The Potato Processor - A simple processor for FPGAs
-- The Potato Processor - A simple processor for FPGAs
-- (c) Kristian Klomsten Skordal 2014 <kristian.skordal@wafflemail.net>
-- (c) Kristian Klomsten Skordal 2014 <kristian.skordal@wafflemail.net>
-- Report bugs and issues on <https://github.com/skordal/potato/issues>
-- Report bugs and issues on <http://opencores.org/project,potato,bugtracker>
 
 
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.numeric_std.all;
 
 
use work.pp_types.all;
use work.pp_types.all;
 
 
--! @brief Multiplexer used to choose between ALU inputs.
--! @brief Multiplexer used to choose between ALU inputs.
entity pp_alu_mux is
entity pp_alu_mux is
        port(
        port(
                source : in alu_operand_source;
                source : in alu_operand_source;
 
 
                register_value  : in std_logic_vector(31 downto 0);
                register_value  : in std_logic_vector(31 downto 0);
                immediate_value : in std_logic_vector(31 downto 0);
                immediate_value : in std_logic_vector(31 downto 0);
                shamt_value     : in std_logic_vector( 4 downto 0);
                shamt_value     : in std_logic_vector( 4 downto 0);
                pc_value        : in std_logic_vector(31 downto 0);
                pc_value        : in std_logic_vector(31 downto 0);
                csr_value       : in std_logic_vector(31 downto 0);
                csr_value       : in std_logic_vector(31 downto 0);
 
 
                output : out std_logic_vector(31 downto 0)
                output : out std_logic_vector(31 downto 0)
        );
        );
end entity pp_alu_mux;
end entity pp_alu_mux;
 
 
architecture behaviour of pp_alu_mux is
architecture behaviour of pp_alu_mux is
begin
begin
 
 
        mux: process(source, register_value, immediate_value, shamt_value, pc_value, csr_value)
        mux: process(source, register_value, immediate_value, shamt_value, pc_value, csr_value)
        begin
        begin
                case source is
                case source is
                        when ALU_SRC_REG =>
                        when ALU_SRC_REG =>
                                output <= register_value;
                                output <= register_value;
                        when ALU_SRC_IMM =>
                        when ALU_SRC_IMM =>
                                output <= immediate_value;
                                output <= immediate_value;
                        when ALU_SRC_PC =>
                        when ALU_SRC_PC =>
                                output <= pc_value;
                                output <= pc_value;
                        when ALU_SRC_PC_NEXT =>
                        when ALU_SRC_PC_NEXT =>
                                output <= std_logic_vector(unsigned(pc_value) + 4);
                                output <= std_logic_vector(unsigned(pc_value) + 4);
                        when ALU_SRC_CSR =>
                        when ALU_SRC_CSR =>
                                output <= csr_value;
                                output <= csr_value;
                        when ALU_SRC_SHAMT =>
                        when ALU_SRC_SHAMT =>
                                output <= (31 downto 5 => '0') & shamt_value;
                                output <= (31 downto 5 => '0') & shamt_value;
                        when ALU_SRC_NULL =>
                        when ALU_SRC_NULL =>
                                output <= (others => '0');
                                output <= (others => '0');
                end case;
                end case;
        end process mux;
        end process mux;
 
 
end architecture behaviour;
end architecture behaviour;
 
 

powered by: WebSVN 2.1.0

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