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

Subversion Repositories minimips

[/] [minimips/] [trunk/] [miniMIPS/] [src/] [banc.vhd] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 poppy
------------------------------------------------------------------------------------
2
--                                                                                --
3
--    Copyright (c) 2004, Hangouet Samuel                                         --
4
--                  , Jan Sebastien                                               --
5
--                  , Mouton Louis-Marie                                          --
6
--                  , Schneider Olivier     all rights reserved                   --
7
--                                                                                --
8
--    This file is part of miniMIPS.                                              --
9
--                                                                                --
10
--    miniMIPS is free software; you can redistribute it and/or modify            --
11 5 poppy
--    it under the terms of the GNU Lesser General Public License as published by --
12
--    the Free Software Foundation; either version 2.1 of the License, or         --
13 2 poppy
--    (at your option) any later version.                                         --
14
--                                                                                --
15
--    miniMIPS is distributed in the hope that it will be useful,                 --
16
--    but WITHOUT ANY WARRANTY; without even the implied warranty of              --
17
--    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               --
18 5 poppy
--    GNU Lesser General Public License for more details.                         --
19 2 poppy
--                                                                                --
20 5 poppy
--    You should have received a copy of the GNU Lesser General Public License    --
21 2 poppy
--    along with miniMIPS; if not, write to the Free Software                     --
22
--    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   --
23
--                                                                                --
24
------------------------------------------------------------------------------------
25
 
26
 
27
-- If you encountered any problem, please contact :
28
--
29
--   lmouton@enserg.fr
30
--   oschneid@enserg.fr
31
--   shangoue@enserg.fr
32
--
33
 
34
 
35
 
36
--------------------------------------------------------------------------
37
--                                                                      --
38
--                                                                      --
39
--               miniMIPS Processor : Register bank                     --
40
--                                                                      --
41
--                                                                      --
42
--                                                                      --
43
-- Authors : Hangouet  Samuel                                           --
44
--           Jan       Sébastien                                        --
45
--           Mouton    Louis-Marie                                      --
46
--           Schneider Olivier                                          --
47
--                                                                      --
48
--                                                          june 2003   --
49
--------------------------------------------------------------------------
50
 
51
library ieee;
52
use ieee.std_logic_1164.all;
53
use ieee.numeric_std.all;
54
 
55
library work;
56
use work.pack_mips.all;
57
 
58
entity banc is
59
port (
60
       clock : in bus1;
61
       reset : in bus1;
62
 
63
       -- Register addresses to read
64
       reg_src1 : in bus5;
65
       reg_src2 : in bus5;
66
 
67
       -- Register address to write and its data
68
       reg_dest : in bus5;
69
       donnee   : in bus32;
70
 
71
       -- Write signal
72
       cmd_ecr  : in bus1;
73
 
74
       -- Bank outputs
75
       data_src1 : out bus32;
76
       data_src2 : out bus32
77
     );
78
end banc;
79
 
80
 
81
architecture rtl of banc is
82
 
83
    -- The register bank
84
    type tab_reg is array (1 to 31) of bus32;
85
    signal registres : tab_reg;
86
    signal adr_src1 : integer range 0 to 31;
87
    signal adr_src2 : integer range 0 to 31;
88
    signal adr_dest : integer range 0 to 31;
89
begin
90
 
91
    adr_src1 <= to_integer(unsigned(reg_src1));
92
    adr_src2 <= to_integer(unsigned(reg_src2));
93
    adr_dest <= to_integer(unsigned(reg_dest));
94
 
95
 
96
    data_src1 <= (others => '0') when adr_src1=0 else
97
                 registres(adr_src1);
98
    data_src2 <= (others => '0') when adr_src2=0 else
99
                 registres(adr_src2);
100
 
101
    process(clock)
102
    begin
103
        if clock = '1' and clock'event then
104
            if reset='1' then
105
                for i in 1 to 31 loop
106
                    registres(i) <= (others => '0');
107
                end loop;
108
            elsif cmd_ecr = '1' and adr_dest /= 0 then
109
            -- The data is saved
110
                registres(adr_dest) <= donnee;
111
            end if;
112
        end if;
113
    end process;
114
 
115
end rtl;

powered by: WebSVN 2.1.0

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