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

Subversion Repositories altor32

[/] [altor32/] [trunk/] [rtl/] [soc/] [soc.v] - Blame information for rev 35

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

Line No. Rev Author Line
1 32 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 27 ultra_embe
 
38
//-----------------------------------------------------------------
39
// Module:
40
//-----------------------------------------------------------------
41
module soc
42
(
43
    // General - Clocking & Reset
44
    clk_i,
45
    rst_i,
46
    ext_intr_i,
47
    intr_o,
48
 
49
    // Memory interface
50
    io_addr_i,
51
    io_data_i,
52
    io_data_o,
53 32 ultra_embe
    io_we_i,
54
    io_stb_i,
55
    io_ack_o
56 27 ultra_embe
);
57
 
58
//-----------------------------------------------------------------
59
// Params
60
//-----------------------------------------------------------------
61
parameter  [31:0]   CLK_KHZ              = 12288;
62
parameter  [31:0]   EXTERNAL_INTERRUPTS  = 1;
63
parameter           SYSTICK_INTR_MS      = 1;
64
parameter           ENABLE_SYSTICK_TIMER = "ENABLED";
65
parameter           ENABLE_HIGHRES_TIMER = "ENABLED";
66
 
67
//-----------------------------------------------------------------
68
// I/O
69
//-----------------------------------------------------------------
70
input                   clk_i /*verilator public*/;
71
input                   rst_i /*verilator public*/;
72
input [(EXTERNAL_INTERRUPTS - 1):0]  ext_intr_i /*verilator public*/;
73
output                  intr_o /*verilator public*/;
74
 
75
// Memory Port
76
input [31:0]            io_addr_i /*verilator public*/;
77
input [31:0]            io_data_i /*verilator public*/;
78
output [31:0]           io_data_o /*verilator public*/;
79 32 ultra_embe
input                   io_we_i /*verilator public*/;
80
input                   io_stb_i /*verilator public*/;
81
output                  io_ack_o /*verilator public*/;
82 27 ultra_embe
 
83
//-----------------------------------------------------------------
84
// Registers / Wires
85
//-----------------------------------------------------------------
86
wire [7:0]         timer_addr;
87
wire [31:0]        timer_data_o;
88
wire [31:0]        timer_data_i;
89 32 ultra_embe
wire               timer_we;
90
wire               timer_stb;
91 27 ultra_embe
wire               timer_intr_systick;
92
wire               timer_intr_hires;
93
 
94
wire [7:0]         intr_addr;
95
wire [31:0]        intr_data_o;
96
wire [31:0]        intr_data_i;
97 32 ultra_embe
wire               intr_we;
98
wire               intr_stb;
99 27 ultra_embe
 
100
//-----------------------------------------------------------------
101
// Peripheral Interconnect
102
//-----------------------------------------------------------------
103
soc_pif8
104
u2_soc
105
(
106
    // General - Clocking & Reset
107
    .clk_i(clk_i),
108
    .rst_i(rst_i),
109
 
110
    // I/O bus (from mem_mux)
111
    // 0x12000000 - 0x12FFFFFF
112
    .io_addr_i(io_addr_i),
113
    .io_data_i(io_data_i),
114
    .io_data_o(io_data_o),
115 32 ultra_embe
    .io_we_i(io_we_i),
116
    .io_stb_i(io_stb_i),
117
    .io_ack_o(io_ack_o),
118 27 ultra_embe
 
119
    // Peripherals
120
    // Unused = 0x12000000 - 0x120000FF
121
    .periph0_addr_o(/*open*/),
122
    .periph0_data_o(/*open*/),
123
    .periph0_data_i(32'h00000000),
124 32 ultra_embe
    .periph0_we_o(/*open*/),
125
    .periph0_stb_o(/*open*/),
126 27 ultra_embe
 
127
    // Timer = 0x12000100 - 0x120001FF
128
    .periph1_addr_o(timer_addr),
129
    .periph1_data_o(timer_data_o),
130
    .periph1_data_i(timer_data_i),
131 32 ultra_embe
    .periph1_we_o(timer_we),
132
    .periph1_stb_o(timer_stb),
133 27 ultra_embe
 
134
    // Interrupt Controller = 0x12000200 - 0x120002FF
135
    .periph2_addr_o(intr_addr),
136
    .periph2_data_o(intr_data_o),
137
    .periph2_data_i(intr_data_i),
138 32 ultra_embe
    .periph2_we_o(intr_we),
139
    .periph2_stb_o(intr_stb),
140 27 ultra_embe
 
141
    // Unused = 0x12000300 - 0x120003FF
142
    .periph3_addr_o(/*open*/),
143
    .periph3_data_o(/*open*/),
144
    .periph3_data_i(32'h00000000),
145 32 ultra_embe
    .periph3_we_o(/*open*/),
146
    .periph3_stb_o(/*open*/),
147 27 ultra_embe
 
148
    // Unused = 0x12000400 - 0x120004FF
149
    .periph4_addr_o(/*open*/),
150
    .periph4_data_o(/*open*/),
151
    .periph4_data_i(32'h00000000),
152 32 ultra_embe
    .periph4_we_o(/*open*/),
153
    .periph4_stb_o(/*open*/),
154 27 ultra_embe
 
155
    // Unused = 0x12000500 - 0x120005FF
156
    .periph5_addr_o(/*open*/),
157
    .periph5_data_o(/*open*/),
158
    .periph5_data_i(32'h00000000),
159 32 ultra_embe
    .periph5_we_o(/*open*/),
160
    .periph5_stb_o(/*open*/),
161 27 ultra_embe
 
162
    // Unused = 0x12000600 - 0x120006FF
163
    .periph6_addr_o(/*open*/),
164
    .periph6_data_o(/*open*/),
165
    .periph6_data_i(32'h00000000),
166 32 ultra_embe
    .periph6_we_o(/*open*/),
167
    .periph6_stb_o(/*open*/),
168 27 ultra_embe
 
169
    // Unused = 0x12000700 - 0x120007FF
170
    .periph7_addr_o(/*open*/),
171
    .periph7_data_o(/*open*/),
172
    .periph7_data_i(32'h00000000),
173 32 ultra_embe
    .periph7_we_o(/*open*/),
174
    .periph7_stb_o(/*open*/)
175 27 ultra_embe
);
176
 
177
//-----------------------------------------------------------------
178
// Timer
179
//-----------------------------------------------------------------
180
timer_periph
181
#(
182
    .CLK_KHZ(CLK_KHZ),
183
    .SYSTICK_INTR_MS(SYSTICK_INTR_MS),
184
    .ENABLE_SYSTICK_TIMER(ENABLE_SYSTICK_TIMER),
185
    .ENABLE_HIGHRES_TIMER(ENABLE_HIGHRES_TIMER)
186
)
187
u5_timer
188
(
189
    .clk_i(clk_i),
190
    .rst_i(rst_i),
191
    .intr_systick_o(timer_intr_systick),
192
    .intr_hires_o(timer_intr_hires),
193
    .addr_i(timer_addr),
194
    .data_o(timer_data_i),
195
    .data_i(timer_data_o),
196 32 ultra_embe
    .we_i(timer_we),
197
    .stb_i(timer_stb)
198 27 ultra_embe
);
199
 
200
//-----------------------------------------------------------------
201
// Interrupt Controller
202
//-----------------------------------------------------------------
203
intr_periph
204
#(
205
    .EXTERNAL_INTERRUPTS(EXTERNAL_INTERRUPTS)
206
)
207
u6_intr
208
(
209
    .clk_i(clk_i),
210
    .rst_i(rst_i),
211
    .intr_o(intr_o),
212
 
213
    .intr0_i(1'b0),
214
 
215
    .intr1_i(timer_intr_systick),
216
    .intr2_i(timer_intr_hires),
217
    .intr3_i(1'b0),
218
 
219
    .intr4_i(1'b0),
220
 
221
    .intr5_i(1'b0),
222
 
223
    .intr6_i(1'b0),
224
 
225
    .intr7_i(1'b0),
226
    .intr_ext_i(ext_intr_i),
227
 
228
    .addr_i(intr_addr),
229
    .data_o(intr_data_i),
230
    .data_i(intr_data_o),
231 32 ultra_embe
    .we_i(intr_we),
232
    .stb_i(intr_stb)
233 27 ultra_embe
);
234
 
235
//-------------------------------------------------------------------
236
// Hooks for debug
237
//-------------------------------------------------------------------
238
`ifdef verilator
239
   function [0:0] get_uart_wr;
240
      // verilator public
241
      get_uart_wr = 1'b0;
242
   endfunction
243
 
244
   function [7:0] get_uart_data;
245
      // verilator public
246
      get_uart_data = 8'b0;
247
   endfunction
248
`endif
249
 
250
endmodule

powered by: WebSVN 2.1.0

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