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

Subversion Repositories altor32

[/] [altor32/] [trunk/] [rtl/] [sim_icarus/] [top.v] - Blame information for rev 37

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 37 ultra_embe
//-----------------------------------------------------------------
2
//                           AltOR32 
3
//                Alternative Lightweight OpenRisc 
4
//                            V2.0
5
//                     Ultra-Embedded.com
6
//                   Copyright 2011 - 2013
7
//
8
//               Email: admin@ultra-embedded.com
9
//
10
//                       License: LGPL
11
//-----------------------------------------------------------------
12
//
13
// Copyright (C) 2011 - 2013 Ultra-Embedded.com
14
//
15
// This source file may be used and distributed without         
16
// restriction provided that this copyright statement is not    
17
// removed from the file and that any derivative work contains  
18
// the original copyright notice and the associated disclaimer. 
19
//
20
// This source file is free software; you can redistribute it   
21
// and/or modify it under the terms of the GNU Lesser General   
22
// Public License as published by the Free Software Foundation; 
23
// either version 2.1 of the License, or (at your option) any   
24
// later version.
25
//
26
// This source is distributed in the hope that it will be       
27
// useful, but WITHOUT ANY WARRANTY; without even the implied   
28
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      
29
// PURPOSE.  See the GNU Lesser General Public License for more 
30
// details.
31
//
32
// You should have received a copy of the GNU Lesser General    
33
// Public License along with this source; if not, write to the 
34
// Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
35
// Boston, MA  02111-1307  USA
36
//-----------------------------------------------------------------
37
 
38
//-----------------------------------------------------------------
39
// Module
40
//-----------------------------------------------------------------
41
module top
42
(
43
    // Clocking & Reset
44
    input clk_i,
45
    input rst_i,
46
    // Fault Output
47
    output fault_o,
48
    // Break Output 
49
    output break_o,
50
    // Interrupt Input
51
    input intr_i
52
);
53
 
54
//-----------------------------------------------------------------
55
// Params
56
//-----------------------------------------------------------------
57
parameter           CLK_KHZ              = 8192;
58
parameter           BOOT_VECTOR          = 32'h10000000;
59
parameter           ISR_VECTOR           = 32'h10000000;
60
 
61
//-----------------------------------------------------------------
62
// Registers / Wires
63
//-----------------------------------------------------------------
64
wire [31:0]         soc_addr;
65
wire [31:0]         soc_data_w;
66
wire [31:0]         soc_data_r;
67
wire                soc_we;
68
wire                soc_stb;
69
wire                soc_ack;
70
wire                soc_irq;
71
 
72
wire[31:0]          dmem_address;
73
wire[31:0]          dmem_data_w;
74
wire[31:0]          dmem_data_r;
75
wire[3:0]           dmem_sel;
76
wire[2:0]           dmem_cti;
77
wire                dmem_we;
78
wire                dmem_stb;
79
wire                dmem_cyc;
80
wire                dmem_stall;
81
wire                dmem_ack;
82
 
83
wire[31:0]          imem_addr;
84
wire[31:0]          imem_data;
85
wire[3:0]           imem_sel;
86
wire                imem_stb;
87
wire                imem_cyc;
88
wire[2:0]           imem_cti;
89
wire                imem_stall;
90
wire                imem_ack;
91
 
92
 
93
//-----------------------------------------------------------------
94
// Instantiation
95
//-----------------------------------------------------------------
96
ram
97
u_ram
98
(
99
    .clka_i(clk_i),
100
    .rsta_i(rst_i),
101
    .stba_i(imem_stb),
102
    .wea_i(1'b0),
103
    .sela_i(imem_sel),
104
    .addra_i(imem_addr[31:2]),
105
    .dataa_i(32'b0),
106
    .dataa_o(imem_data),
107
    .acka_o(imem_ack),
108
 
109
    .clkb_i(clk_i),
110
    .rstb_i(rst_i),
111
    .stbb_i(dmem_stb),
112
    .web_i(dmem_we),
113
    .selb_i(dmem_sel),
114
    .addrb_i(dmem_address[31:2]),
115
    .datab_i(dmem_data_w),
116
    .datab_o(dmem_data_r),
117
    .ackb_o(dmem_ack)
118
);
119
 
120
cpu_if
121
#(
122
    .CLK_KHZ(CLK_KHZ),
123
    .BOOT_VECTOR(32'h10000000),
124
    .ISR_VECTOR(32'h10000000),
125
    .ENABLE_ICACHE(`ICACHE_ENABLED),
126
    .ENABLE_DCACHE(`DCACHE_ENABLED),
127
    .REGISTER_FILE_TYPE("SIMULATION")
128
)
129
u_cpu
130
(
131
    // General - clocking & reset
132
    .clk_i(clk_i),
133
    .rst_i(rst_i),
134
    .fault_o(fault_o),
135
    .break_o(break_o),
136
    .nmi_i(1'b0),
137
    .intr_i(soc_irq),
138
 
139
    // Instruction Memory 0 (0x10000000 - 0x10FFFFFF)
140
    .imem0_addr_o(imem_addr),
141
    .imem0_data_i(imem_data),
142
    .imem0_sel_o(imem_sel),
143
    .imem0_cti_o(imem_cti),
144
    .imem0_cyc_o(imem_cyc),
145
    .imem0_stb_o(imem_stb),
146
    .imem0_stall_i(1'b0),
147
    .imem0_ack_i(imem_ack),
148
 
149
    // Data Memory 0 (0x10000000 - 0x10FFFFFF)
150
    .dmem0_addr_o(dmem_address),
151
    .dmem0_data_o(dmem_data_w),
152
    .dmem0_data_i(dmem_data_r),
153
    .dmem0_sel_o(dmem_sel),
154
    .dmem0_cti_o(dmem_cti),
155
    .dmem0_cyc_o(dmem_cyc),
156
    .dmem0_we_o(dmem_we),
157
    .dmem0_stb_o(dmem_stb),
158
    .dmem0_stall_i(1'b0),
159
    .dmem0_ack_i(dmem_ack),
160
 
161
    // Data Memory 1 (0x11000000 - 0x11FFFFFF)
162
    .dmem1_addr_o(/*open*/),
163
    .dmem1_data_o(/*open*/),
164
    .dmem1_data_i(32'b0),
165
    .dmem1_sel_o(/*open*/),
166
    .dmem1_we_o(/*open*/),
167
    .dmem1_stb_o(/*open*/),
168
    .dmem1_cyc_o(/*open*/),
169
    .dmem1_cti_o(/*open*/),
170
    .dmem1_stall_i(1'b0),
171
    .dmem1_ack_i(1'b1),
172
 
173
    // Data Memory 2 (0x12000000 - 0x12FFFFFF)
174
    .dmem2_addr_o(soc_addr),
175
    .dmem2_data_o(soc_data_w),
176
    .dmem2_data_i(soc_data_r),
177
    .dmem2_sel_o(/*open*/),
178
    .dmem2_we_o(soc_we),
179
    .dmem2_stb_o(soc_stb),
180
    .dmem2_cyc_o(/*open*/),
181
    .dmem2_cti_o(/*open*/),
182
    .dmem2_stall_i(1'b0),
183
    .dmem2_ack_i(soc_ack)
184
);
185
 
186
// CPU SOC
187
soc
188
#(
189
    .CLK_KHZ(CLK_KHZ),
190
    .ENABLE_SYSTICK_TIMER("ENABLED"),
191
    .ENABLE_HIGHRES_TIMER("ENABLED"),
192
    .EXTERNAL_INTERRUPTS(1)
193
)
194
u_soc
195
(
196
    // General - clocking & reset
197
    .clk_i(clk_i),
198
    .rst_i(rst_i),
199
    .ext_intr_i(1'b0),
200
    .intr_o(soc_irq),
201
 
202
    // Memory Port
203
    .io_addr_i(soc_addr),
204
    .io_data_i(soc_data_w),
205
    .io_data_o(soc_data_r),
206
    .io_we_i(soc_we),
207
    .io_stb_i(soc_stb),
208
    .io_ack_o(soc_ack)
209
);
210
 
211
endmodule

powered by: WebSVN 2.1.0

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