URL
https://opencores.org/ocsvn/potato/potato/trunk
[/] [potato/] [trunk/] [src/] [pp_imm_decoder.vhd] - Blame information for rev 54
Go to most recent revision |
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 |
|
|
|
8 |
|
|
--! @brief Module decoding immediate values from instruction words.
|
9 |
|
|
entity pp_imm_decoder is
|
10 |
|
|
port(
|
11 |
|
|
instruction : in std_logic_vector(31 downto 2);
|
12 |
|
|
immediate : out std_logic_vector(31 downto 0)
|
13 |
|
|
);
|
14 |
|
|
end entity pp_imm_decoder;
|
15 |
|
|
|
16 |
|
|
architecture behaviour of pp_imm_decoder is
|
17 |
|
|
begin
|
18 |
|
|
decode: process(instruction)
|
19 |
|
|
begin
|
20 |
|
|
case instruction(6 downto 2) is
|
21 |
|
|
when b"01101" | b"00101" => -- U type
|
22 |
|
|
immediate <= instruction(31 downto 12) & (11 downto 0 => '0');
|
23 |
|
|
when b"11011" => -- UJ type
|
24 |
|
|
immediate <= (31 downto 20 => instruction(31)) & instruction(19 downto 12) & instruction(20) & instruction(30 downto 21) & '0';
|
25 |
|
|
when b"11001" | b"00000" | b"00100" | b"11100"=> -- I type
|
26 |
|
|
immediate <= (31 downto 11 => instruction(31)) & instruction(30 downto 20);
|
27 |
|
|
when b"11000" => -- SB type
|
28 |
|
|
immediate <= (31 downto 12 => instruction(31)) & instruction(7) & instruction(30 downto 25) & instruction(11 downto 8) & '0';
|
29 |
|
|
when b"01000" => -- S type
|
30 |
|
|
immediate <= (31 downto 11 => instruction(31)) & instruction(30 downto 25) & instruction(11 downto 7);
|
31 |
|
|
when others =>
|
32 |
|
|
immediate <= (others => '0');
|
33 |
|
|
end case;
|
34 |
|
|
end process decode;
|
35 |
|
|
end architecture behaviour;
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.