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

Subversion Repositories vhdl-pipeline-mips

[/] [vhdl-pipeline-mips/] [trunk/] [5_write_back/] [write_back.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 elujan
--
2
-- Etapa Write back (WB) 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.records_pkg.all;
29
use work.segm_mips_const_pkg.all;
30
 
31
entity WRITE_BACK is
32
port(
33
        --Entradas
34
        RESET                   : in STD_LOGIC;                                 --Reset
35
        WB                      : in WB_CTRL_REG;                               --Señales de control para esta etapa
36
        READ_DATA               : in STD_LOGIC_VECTOR (INST_SIZE-1 downto 0);    --Posible dato a ser escribido en la memoria de registros
37
        ADDRESS                 : in STD_LOGIC_VECTOR (INST_SIZE-1 downto 0);    --Posible dato a ser escribido en la memoria de registros
38
        WRITE_REG               : in STD_LOGIC_VECTOR (ADDR_SIZE-1 downto 0);    --Dirección del registro a ser escrito en la memoria de registros              
39
        --Salidas hacia la etapas ID, sin sincronización
40
        RegWrite                : out STD_LOGIC;                                --WB_OUT.RegWrite
41
        WRITE_REG_OUT           : out STD_LOGIC_VECTOR (ADDR_SIZE-1 downto 0);   --Dirección del registro a ser escrito en la memoria de registros
42
        WRITE_DATA              : out STD_LOGIC_VECTOR (INST_SIZE-1 downto 0)    --Este dato representa a READ_DATA o a ADDRESS, según lo decida WB_OUT.MemtoReg
43
);
44
end WRITE_BACK;
45
 
46
architecture WRITE_BACK_ARC of WRITE_BACK is
47
begin
48
 
49
        MUX_WB:
50
                process(RESET,WB.RegWrite,WRITE_REG,WB.MemtoReg,ADDRESS,READ_DATA)
51
                begin
52
                        if( RESET = '1') then
53
                                RegWrite <= '0';
54
                                WRITE_REG_OUT <= "00000";
55
                                WRITE_DATA <= ZERO32b;
56
                        else
57
                                RegWrite <= WB.RegWrite;
58
                                WRITE_REG_OUT <= WRITE_REG;
59
                                if( WB.MemtoReg = '0') then
60
                                        WRITE_DATA <= ADDRESS;
61
                                else
62
                                        WRITE_DATA <= READ_DATA;
63
                                end if;
64
                        end if;
65
                 end process MUX_WB;
66
 
67
end WRITE_BACK_ARC;

powered by: WebSVN 2.1.0

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