OpenCores
URL https://opencores.org/ocsvn/vhdl-pipeline-mips/vhdl-pipeline-mips/trunk

Subversion Repositories vhdl-pipeline-mips

[/] [vhdl-pipeline-mips/] [trunk/] [2_instruction_decoding/] [control_unit.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 elujan
--
2
-- Unidad de control del procesador MIPS Segmentado
3
--
4
-- Licencia: Copyright 2008 Emmanuel Luján
5
--
6
--      This program is free software; you can redistribute it and/or
7
--      modify it under the terms of the GNU General Public License as
8
--      published by the Free Software Foundation; either version 2 of
9
--      the License, or (at your option) any later version. This program
10
--      is distributed in the hope that it will be useful, but WITHOUT
11
--      ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12
--      or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13
--      License for more details. You should have received a copy of the
14
--      GNU General Public License along with this program; if not, write
15
--      to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
16
--      Boston, MA 02110-1301 USA.
17
-- 
18
-- Autor:       Emmanuel Luján
19
-- Email:       info@emmanuellujan.com.ar
20
-- Versión:    1.0
21
--
22
 
23
library ieee;
24
use ieee.std_logic_1164.all;
25
use ieee.numeric_std.all;
26
 
27
library work;
28
use work.segm_mips_const_pkg.all;
29
 
30
 
31
entity CONTROL_UNIT is
32
        port(
33
 
34
                OP                      : in    STD_LOGIC_VECTOR (5 downto 0);           --Código de operación
35
 
36
                RegWrite                : out   STD_LOGIC;                              --Señal de habilitación de escritura (RegWrite)
37
                MemtoReg                : out   STD_LOGIC;                              --Señal de habilitación  (MemToReg)
38
                Brach                   : out   STD_LOGIC;                              --Señal de habilitación  (Branch)
39
                MemRead                 : out   STD_LOGIC;                              --Señal de habilitación  (MemRead)
40
                MemWrite                : out   STD_LOGIC;                              --Señal de habilitación  (MemWrite)
41
                RegDst                  : out   STD_LOGIC;                              --Señal de habilitación  (RegDst)
42
                ALUSrc                  : out   STD_LOGIC;                              --Señal de habilitación  (ALUSrc)
43
                ALUOp0                  : out   STD_LOGIC;                              --Señal de habilitación  (ALUOp0)
44
                ALUOp1                  : out   STD_LOGIC;                              --Señal de habilitación  (ALUOp1)
45
                ALUOp2                  : out   STD_LOGIC                               --Señal de habilitación  (ALUOp2)
46
 
47
        );
48
end CONTROL_UNIT;
49
 
50
 
51
architecture CONTROL_UNIT_ARC of CONTROL_UNIT is
52
 
53
--Decaración de señales
54
        signal R_TYPE           : STD_LOGIC;
55
        signal LW               : STD_LOGIC;
56
        signal SW               : STD_LOGIC;
57
        signal BEQ              : STD_LOGIC;
58
        signal LUI              : STD_LOGIC;
59
 
60
begin
61
 
62
        R_TYPE          <=      not OP(5) and not OP(4) and not OP(3) and
63
                                not OP(2) and not OP(1) and not OP(0);
64
 
65
        LW              <=      OP(5) and not OP(4) and not OP(3) and
66
                                not OP(2) and    OP(1) and     OP(0);
67
 
68
        SW              <=      OP(5) and not OP(4) and         OP(3) and
69
                                not OP(2) and     OP(1) and     OP(0);
70
 
71
        BEQ             <=      not OP(5) and not OP(4) and not OP(3) and
72
                                    OP(2) and not OP(1) and not OP(0);
73
 
74
        LUI             <=      not OP(5) and not OP(4) and OP(3) and
75
                                OP(2) and  OP(1) and OP(0);
76
 
77
        RegWrite        <= R_TYPE or LW or LUI;
78
        MemtoReg        <= LW;
79
        Brach           <= BEQ;
80
        MemRead         <= LW or LUI;
81
        MemWrite        <= SW;
82
        RegDst          <= R_TYPE;
83
        ALUSrc          <= LW or SW or LUI;
84
        ALUOp0          <= BEQ;
85
        ALUOp1          <= R_TYPE;
86
        ALUOp2          <= LUI;
87
 
88
end CONTROL_UNIT_ARC;

powered by: WebSVN 2.1.0

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