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

Subversion Repositories mipsr2000

[/] [mipsr2000/] [trunk/] [Ir.vhd] - Blame information for rev 15

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 15 jimi39
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer:      Lazaridis Dimitris
4
-- 
5
-- Create Date:    22:19:43 06/05/2012 
6
-- Design Name: 
7
-- Module Name:    Ir - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
 
23
-- Uncomment the following library declaration if using
24
-- arithmetic functions with Signed or Unsigned values
25
--use IEEE.NUMERIC_STD.ALL;
26
 
27
-- Uncomment the following library declaration if instantiating
28
-- any Xilinx primitives in this code.
29
--library UNISIM;
30
--use UNISIM.VComponents.all;
31
 
32
entity Ir is
33
port
34
     (
35
            clk         : in std_logic;
36
                 rst : in  STD_LOGIC;
37
                 imem_to_ir  : in std_logic_vector(31 downto 0);
38
                 IRWrite    : in std_logic;
39
                 Opcode      : out std_logic_vector(5 downto 0);
40
                 rs          : out std_logic_vector(4 downto 0);
41
            rt          : out std_logic_vector(4 downto 0);
42
                 rd          : out std_logic_vector(4 downto 0);
43
                 immed_addr  : out std_logic_vector(15 downto 0);
44
            Ext_sz_c  : out std_logic;
45
                 From_i_op : out std_logic_vector(1 downto 0);
46
                 From_i_mux : out std_logic_vector(1 downto 0);
47
                 lui : out  STD_LOGIC
48
          );
49
end Ir;
50
 
51
architecture Behavioral of Ir is
52
 
53
begin
54
 
55
     process(clk,rst,imem_to_ir,IRWrite)
56
          variable pre_out : std_logic_vector(31 downto 0);
57
          begin
58
 
59
                         if rst = '0' then
60
                                     Opcode <= (others => '0');
61
                                                         rs     <= (others => '0');
62
                                                         rt     <= (others => '0');
63
                                                         rd     <= (others => '0');
64
                                                         immed_addr  <= (others => '0');
65
               elsif(RISING_EDGE(clk))then
66
                   if(IRWrite = '1') then
67
                                     pre_out := imem_to_ir;
68
                                     Opcode <= pre_out(31 downto 26);
69
                 rs     <= pre_out(25 downto 21);
70
                 rt     <= pre_out(20 downto 16);
71
                                          rd     <= pre_out(15 downto 11);
72
                 immed_addr <= pre_out(15 downto 0);
73
                                  end if;
74
                         end if;
75
         end process;
76
 
77
 
78
    process(clk,rst,imem_to_ir)  --Sign_ext control
79
    begin
80
         if rst = '0' then
81
            Ext_sz_c <=  '0';
82
         elsif RISING_EDGE(clk) then
83
           if (imem_to_ir(31 downto 26) = "001100") or (imem_to_ir(31 downto 26) ="001101") or
84
                   (imem_to_ir(31 downto 26) = "001110") then
85
                   Ext_sz_c <=  '1';
86
                else
87
                   Ext_sz_c <=  '0';
88
         end if;
89
         end if;
90
         end process;
91
    process(clk,rst,imem_to_ir)   -- I type opcode control for less stages
92
    begin
93
    if rst = '0' then
94
                From_i_op <= "00";
95
                From_i_mux <= "00";
96
         elsif RISING_EDGE(clk) then
97
            case imem_to_ir(31 downto 26) is
98
                      when "001000" =>               --addi
99
                                      From_i_op <= "00";
100
                                 From_i_mux <= "10";
101
                                when "001001" =>
102
                                      From_i_op <= "01";      --addiu
103
                                 From_i_mux <= "10";
104
                                when "001100" =>
105
                                      From_i_op <= "00";      --andi
106
                                 From_i_mux <= "11";
107
                                when "001101" =>
108
                                      From_i_op <= "01";      --ori
109
                                 From_i_mux <= "11";
110
                                when "001110" =>
111
                                      From_i_op <= "10";      --xori
112
                                 From_i_mux <= "11";
113
                                when "001111" =>
114
                                      From_i_op <= "00";      --lui
115
                                 From_i_mux <= "00";
116
                                when "001010" =>
117
                                      From_i_op <= "10";      --slti
118
                                 From_i_mux <= "01";
119
                                when "001011" =>
120
                                      From_i_op <= "11";      --sltiu
121
                                 From_i_mux <= "01";
122
                                when others =>
123
                                      From_i_op <= "00";      --others
124
                                 From_i_mux <= "00";
125
                 end case;
126
        end if;
127
        end process;
128
        process(clk,rst,imem_to_ir)  --for lui control
129
        begin
130
         if rst = '0' then
131
            lui <= '0';
132
         elsif RISING_EDGE(clk) then
133
         if (imem_to_ir(31 downto 26) = "001111") then
134
                   lui <= '1';
135
      else
136
         lui <= '0';
137
    end if;
138
    end if;
139
        end process;
140
        --with imem_to_ir(31 downto 26) select
141
   --Ext_sz_c <= '1' when  ("001100" or "001101" or "001110"),
142
 
143
   --             '0' when others;        
144
 
145
 
146
 
147
end Behavioral;
148
 

powered by: WebSVN 2.1.0

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