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

Subversion Repositories riscompatible

[/] [riscompatible/] [trunk/] [rtl/] [riscompatible.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 borin
-------------------------------------------------------------------------------------------------------------------
2
-- ____________   _____   ___________   ___________   ___________ 
3
-- ||||        \ ||||  | ||||        | ||||        | ||||        |
4
-- ||||_____   | ||||  | ||||   _____| ||||   _____| ||||   __   |
5
-- ______||||  | ||||  | ||||  |_____  ||||  |       ||||  ||||  |
6
-- ||||        / ||||  | ||||        | ||||  |       ||||  ||||  |
7
-- ||||  ___   \ ||||  | ||||_____   | ||||  |       ||||  ||||  |
8
-- ||||  ||||  | ||||  | ______||||  | ||||  |_____  ||||  ||||  |
9
-- ||||  ||||  | ||||  | ||||        | ||||        | ||||        |
10
-- ||||__||||__| ||||__| ||||________| ||||________| ||||________|mpatible
11
--
12
-- RISCOmpatible - Implementation Based on the Instruction Set developed in:
13
-- "[1] RISCO - Microprocessador RISC CMOS de 32 Bits",
14
--      by Alexandre Ambrozi Junqueira and Altamiro Amadeu Suzim, 1993.
15
--      http://hdl.handle.net/10183/21530
16
-- HDL code by Andre Borin Soares
17
--
18
-- Current Features: Harvard architecture, single clock phase, multicycle operation.
19
--
20
-- USE THIS CODE AT YOUR OWN RISK !
21
-- HDL code 'as is' without warranty.  Author liable for nothing.
22
-------------------------------------------------------------------------------------------------------------------
23
-- Suffixes and prefixes used in the code:
24
-- _W - Wire
25
-- _R - Register
26
-- _F - Function
27
-- _O - Output
28
-- _I - Input
29
-- C_ - Constant
30
-------------------------------------------------------------------------------------------------------------------
31
library ieee;
32
use ieee.std_logic_1164.all;
33
use ieee.numeric_std.all;
34
library work;
35
use work.riscompatible_package.all;
36
-------------------------------------------------------------------------------------------------------------------
37
entity riscompatible is
38
    generic
39
    (
40
        NumBitsProgramMemory : Natural:=5;
41
        NumBitsDataMemory    : Natural:=5;
42
        NumBitsRegBank       : natural:=5;
43
        NumBitsInputPorts    : natural:=2;
44
        NumBitsOutputPorts   : natural:=2
45
    );
46
    port
47
    (
48
        Clk_I         : in  std_logic;
49
        Reset_I       : in  std_logic;
50
        Int_I         : in  std_logic;
51
        IntAck_O      : out std_logic;
52
        InputPorts_I  : in  std_logic_vector(NumBitsInputPorts-1 downto 0);
53
        OutputPorts_O : out std_logic_vector(NumBitsOutputPorts-1 downto 0)
54
    );
55
end riscompatible;
56
-------------------------------------------------------------------------------------------------------------------
57
architecture behavioral of riscompatible is
58
    ---------------------------------------------
59
    -- Wires
60
    ---------------------------------------------
61
    -- Program Memory Signals -----------------------------
62
    signal PMem_Enable_W     : std_logic;
63
    signal PMem_Write_W      : std_logic;
64
    signal PMem_Address_W    : std_logic_vector(NumBitsProgramMemory-1 downto 0);
65
    signal PMem_InputData_W  : TRiscoWord;
66
    signal PMem_OutputData_W : TRiscoWord;
67
    -- Data Memory Signals --------------------------------
68
    signal DMem_Enable_W     : std_logic;
69
    signal DMem_Write_W      : std_logic;
70
    signal DMem_Address_W    : std_logic_vector(NumBitsDataMemory-1 downto 0);
71
    signal DMem_InputData_W  : TRiscoWord;
72
    signal DMem_OutputData_W : TRiscoWord;
73
    -------------------------------------------------------
74
    signal GPIO_OutputData_W : TRiscoWord;
75
    signal MSPC_OutputData_W : TRiscoWord;
76
    signal OutputData_Vld_W  : std_logic;
77
    -------------------------------------------------------
78
    component GPIO is
79
        generic
80
        (
81
            NumBitsAddr        : natural:=1;
82
            NumBitsInputPorts  : natural:=2;
83
            NumBitsOutputPorts : natural:=2
84
        );
85
        port
86
        (
87
            Clk_I            : in  std_logic;
88
            Enable_I         : in  std_logic;
89
            Write_I          : in  std_logic;
90
            Address_I        : in  std_logic_vector(NumBitsAddr-1 downto 0);
91
            InputData_I      : in  std_logic_vector(C_NumBitsWord-1 downto 0);
92
            OutputData_O     : out std_logic_vector(C_NumBitsWord-1 downto 0);
93
            OutputData_Vld_O : out std_logic;
94
            InputPorts_I     : in  std_logic_vector(NumBitsInputPorts-1 downto 0);
95
            OutputPorts_O    : out std_logic_vector(NumBitsOutputPorts-1 downto 0)
96
        );
97
    end component;
98
    component Memory is
99
        generic
100
        (
101
            FileName    : String:="dummy.txt";
102
            NumBitsAddr : natural:=4;
103
            DataWidth   : natural:=32
104
        );
105
        port
106
        (
107
            Clk_I        : in std_logic;
108
            Enable_I     : in std_logic;
109
            Write_I      : in std_logic;
110
            Address_I    : in std_logic_vector(NumBitsAddr-1 downto 0);
111
            InputData_I  : in std_logic_vector(DataWidth-1 downto 0);
112
            OutputData_O : out std_logic_vector(DataWidth-1 downto 0)
113
        );
114
    end component;
115
         component data_sel is
116
        port
117
        (
118
            DMEM_OutputData_I : in TRiscoWord;
119
            GPIO_OutputData_I : in TRiscoWord;
120
            OutputData_Vld_I  : in std_logic;
121
            MSPC_OutputData_O : out TRiscoWord
122
        );
123
    end component;
124
begin
125
 
126
---------------------------------------------
127
-- Program Memory
128
---------------------------------------------
129
u_Program_Memory: Memory
130
    generic map
131
    (
132
        FileName    => "../../bench/program.txt",
133
        NumBitsAddr => NumBitsProgramMemory,
134
        DataWidth   => 32
135
    )
136
    port map
137
    (
138
        Clk_I        => Clk_I,
139
        Enable_I     => PMem_Enable_W,
140
        Write_I      => PMem_Write_W,
141
        Address_I    => PMem_Address_W,
142
        InputData_I  => PMem_InputData_W,
143
        OutputData_O => PMem_OutputData_W
144
    );
145
 
146
---------------------------------------------
147
-- Data Memory
148
---------------------------------------------
149
u_Data_Memory: Memory
150
    generic map
151
    (
152
        FileName    => "../../bench/data.txt",
153
        NumBitsAddr => NumBitsDataMemory-1,
154
        DataWidth   => 32
155
    )
156
    port map
157
    (
158
        Clk_I        => Clk_I,
159
        Enable_I     => DMem_Enable_W,
160
        Write_I      => DMem_Write_W,
161
        Address_I    => DMem_Address_W(NumBitsDataMemory-2 downto 0),
162
        InputData_I  => DMem_InputData_W,
163
        OutputData_O => DMem_OutputData_W
164
    );
165
 
166
---------------------------------------------
167
-- Risco Core
168
---------------------------------------------
169
u_Riscompatible_Core: Riscompatible_Core
170
    generic map
171
    (
172
        NumBitsProgramMemory => NumBitsProgramMemory,
173
        NumBitsDataMemory    => NumBitsDataMemory,
174
        NumBitsRegBank       => NumBitsRegBank
175
    )
176
    port map
177
    (
178
        Clk_I             => Clk_I,
179
        Reset_I           => Reset_I,
180
        PMem_Enable_O     => PMem_Enable_W,
181
        PMem_Write_O      => PMem_Write_W,
182
        PMem_Address_O    => PMem_Address_W,
183
        PMem_InputData_O  => PMem_InputData_W,
184
        PMem_OutputData_I => PMem_OutputData_W,
185
        DMem_Enable_O     => DMem_Enable_W,
186
        DMem_Write_O      => DMem_Write_W,
187
        DMem_Address_O    => DMem_Address_W,
188
        DMem_InputData_O  => DMem_InputData_W,
189
        DMem_OutputData_I => MSPC_OutputData_W,
190
        Int_I             => Int_I,
191
        IntAck_O          => IntAck_O
192
    );
193
---------------------------------------------
194
-- GPIO
195
---------------------------------------------    
196
u_GPIO: GPIO
197
    generic map
198
    (
199
        NumBitsAddr        => NumBitsDataMemory,
200
        NumBitsInputPorts  => NumBitsInputPorts,
201
        NumBitsOutputPorts => NumBitsOutputPorts
202
    )
203
    port map
204
    (
205
        Clk_I            => Clk_I,
206
        Enable_I         => DMem_Enable_W,
207
        Write_I          => DMem_Write_W,
208
        Address_I        => DMem_Address_W,
209
        InputData_I      => DMem_InputData_W,
210
        OutputData_O     => GPIO_OutputData_W,
211
        OutputData_Vld_O => OutputData_Vld_W,
212
        InputPorts_I     => InputPorts_I,
213
        OutputPorts_O    => OutputPorts_O
214
    );
215
 
216
u_data_sel: data_sel
217
        port map
218
        (
219
            DMEM_OutputData_I => DMEM_OutputData_W,
220
            GPIO_OutputData_I => GPIO_OutputData_W,
221
            OutputData_Vld_I  => OutputData_Vld_W,
222
            MSPC_OutputData_O => MSPC_OutputData_W
223
        );
224
 
225
end behavioral;

powered by: WebSVN 2.1.0

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