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

Subversion Repositories minimips_superscalar

[/] [minimips_superscalar/] [trunk/] [sources/] [banc.vhd] - Blame information for rev 21

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mcafruni
--------------------------------------------------------------------------
2
--                                                                      --
3
--                                                                      --
4
-- miniMIPS Superscalar Processor : Register bank                       --
5
-- based on miniMIPS Processor                                          --
6
--                                                                      --
7
--                                                                      --
8
-- Author : Miguel Cafruni                                              --
9
-- miguel_cafruni@hotmail.com                                           --
10
--                                                      December 2018   --
11
--------------------------------------------------------------------------
12
 
13
library ieee;
14
use ieee.std_logic_1164.all;
15
use ieee.numeric_std.all;
16
 
17
library work;
18
use work.pack_mips.all;
19
 
20
entity banc is
21
port (
22
       clock : in bus1;
23
       clock2 : in bus1;
24
       reset : in bus1;
25
 
26
       -- Register addresses to read
27
       reg_src1 : in bus5;
28
       reg_src2 : in bus5;
29
 
30
       -- Register address to write and its data
31
       reg_dest : in bus5;
32
       donnee   : in bus32;
33
 
34
       -- Write signal
35
       cmd_ecr  : in bus1;
36
 
37
       -- Bank outputs
38
       data_src1 : out bus32;
39
       data_src2 : out bus32;
40
 
41
       -- Register addresses to read
42
       reg_src3 : in bus5;
43
       reg_src4 : in bus5;
44
 
45
       -- Register address to write and its data
46
       reg_dest2 : in bus5;
47
       donnee2   : in bus32;
48
 
49
       -- Write signal
50
       cmd_ecr2  : in bus1;
51
 
52
       -- Bank outputs
53
       data_src3 : out bus32;
54
       data_src4 : out bus32
55
     );
56
end banc;
57
 
58
 
59
architecture rtl of banc is
60
 
61
    -- The register bank
62
    type tab_reg is array (1 to 31) of bus32;
63
    signal registres : tab_reg;
64
    signal adr_src1 : integer range 0 to 31;
65
    signal adr_src2 : integer range 0 to 31;
66
    signal adr_dest : integer range 0 to 31;
67
    signal adr_src3 : integer range 0 to 31;
68
    signal adr_src4 : integer range 0 to 31;
69
    signal adr_dest2 : integer range 0 to 31;
70
begin
71
 
72
    adr_src1 <= to_integer(unsigned(reg_src1));
73
    adr_src2 <= to_integer(unsigned(reg_src2));
74
    adr_dest <= to_integer(unsigned(reg_dest));
75
    adr_src3 <= to_integer(unsigned(reg_src3));
76
    adr_src4 <= to_integer(unsigned(reg_src4));
77
    adr_dest2 <= to_integer(unsigned(reg_dest2));
78
 
79
    data_src1 <= (others => '0') when adr_src1=0 else
80
                 registres(adr_src1);
81
    data_src2 <= (others => '0') when adr_src2=0 else
82
                 registres(adr_src2);
83
    data_src3 <= (others => '0') when adr_src3=0 else
84
                 registres(adr_src3);
85
    data_src4 <= (others => '0') when adr_src4=0 else
86
                 registres(adr_src4);
87
 
88
 
89
    process(clock)
90
    begin
91
        if rising_edge(clock) then
92
            if reset='1' then
93
                for i in 1 to 31 loop
94
                    registres(i) <= (others => '0');
95
                end loop;
96
            elsif cmd_ecr = '1' and adr_dest /= 0 then
97
            -- The data is saved
98
                registres(adr_dest) <= donnee;
99
                           end if;
100
            if cmd_ecr2 = '1' and adr_dest2 /= 0 then
101
                -- The data is saved
102
                    registres(adr_dest2) <= donnee2;
103
                end if;
104
            end if;
105
        end process;
106
 
107
end rtl;

powered by: WebSVN 2.1.0

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