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

Subversion Repositories m1_core

[/] [m1_core/] [trunk/] [hdl/] [rtl/] [spartan3esk_top/] [spartan3esk_top.v] - Blame information for rev 64

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 44 fafa1971
/*
2 64 albert.wat
 * M1 Core System for Xilinx Spartan-3E 500 Starter Kit
3 44 fafa1971
 */
4
 
5
`include "ddr_include.v"
6
 
7
module spartan3esk_top (
8
 
9
    // System
10
    input sys_clock_i,
11
    input sys_reset_i,
12
 
13
    // VGA Port
14
    output vga_rgb_r_o,
15
    output vga_rgb_g_o,
16
    output vga_rgb_b_o,
17
    output vga_hsync_o,
18
    output vga_vsync_o,
19
 
20
    // PS/2 Keyboard interface
21
    inout ps2_keyboard_clock_io,
22
    inout ps2_keyboard_data_io,
23
 
24
    // DDR Port
25
    output ddr_clk,
26
    output ddr_clk_n,
27
    input ddr_clk_fb,
28
    output ddr_ras_n,
29
    output ddr_cas_n,
30
    output ddr_we_n,
31
    output ddr_cke,
32
    output ddr_cs_n,
33
    output[`A_RNG] ddr_a,
34
    output[`BA_RNG] ddr_ba,
35
    inout[`DQ_RNG] ddr_dq,
36
    inout[`DQS_RNG] ddr_dqs,
37
    output[`DM_RNG] ddr_dm
38
 
39
  );
40
 
41
  /*
42
   * Wires
43
   */
44
 
45
  // Interrupts
46
  wire sys_irq;
47
  wire[31:0] sys_irqs;
48
  assign sys_irqs[31:1] = 31'h00000000;
49
 
50
  // Rotary interface
51
  wire[2:0] rot = 3'b000;
52
 
53
  // PS/2 Keyboard interface
54
  wire ps2_keyboard_clock_i;
55
  wire ps2_keyboard_data_i;
56
  wire ps2_keyboard_clock_o;
57
  wire ps2_keyboard_data_o;
58
  wire ps2_keyboard_clock_padoe_o;
59
  wire ps2_keyboard_data_padoe_o;
60
  assign ps2_keyboard_clock_io  = (ps2_keyboard_clock_padoe_o  ? ps2_keyboard_clock_o  : 1'bZ);
61
  assign ps2_keyboard_data_io = (ps2_keyboard_data_padoe_o ? ps2_keyboard_data_o : 1'bZ);
62
 
63
  // Wishbone interface
64
  wire wb_cyc_core, wb_cyc_intc, wb_cyc_text, wb_cyc_ps2, wb_cyc_ddr;
65
  wire wb_stb_core, wb_stb_intc, wb_stb_text, wb_stb_ps2, wb_stb_ddr;
66
  wire wb_we_core, wb_we_intc, wb_we_text, wb_we_ps2, wb_we_ddr;
67
  wire[31:0] wb_adr_core, wb_adr_intc, wb_adr_text, wb_adr_ps2, wb_adr_ddr;
68
  wire[31:0] wb_wdat_core, wb_wdat_intc, wb_wdat_text, wb_wdat_ps2, wb_wdat_ddr;
69
  wire[3:0] wb_sel_core, wb_sel_intc, wb_sel_text, wb_sel_ps2, wb_sel_ddr;
70
  wire wb_ack_core, wb_ack_intc, wb_ack_text, wb_ack_ps2, wb_ack_ddr;
71
  wire[31:0] wb_rdat_core, wb_rdat_intc, wb_rdat_text, wb_rdat_ps2, wb_rdat_ddr;
72
 
73
  // The most significant byte of the address is used to select the destination
74
  wire request_to_ddr = (wb_stb_core && wb_cyc_core && wb_adr_core[31:24]==8'h00);
75
  wire request_to_intc = (wb_stb_core && wb_cyc_core && wb_adr_core[31:24]==8'hF8);
76
  wire request_to_text = (wb_stb_core && wb_cyc_core && wb_adr_core[31:24]==8'hFA);
77
  wire request_to_ps2 = (wb_stb_core && wb_cyc_core && wb_adr_core[31:24]==8'hFB);
78
 
79
  // Select outputs connected to M1 Core inputs
80
  assign wb_ack_core = (request_to_ddr ? wb_ack_ddr :
81
    (request_to_intc ? wb_ack_intc :
82
      (request_to_text ? wb_ack_text : wb_ack_ps2) ) );
83
  assign wb_rdat_core = (request_to_ddr ? wb_rdat_ddr :
84
    (request_to_intc ? wb_rdat_intc :
85
      (request_to_text ? wb_rdat_text : wb_rdat_ps2) ) );
86
 
87
  // Select outputs connected to Interrupt Controller inputs
88
  assign wb_cyc_intc = (request_to_intc ? wb_cyc_core : 1'b0);
89
  assign wb_stb_intc = (request_to_intc ? wb_stb_core : 1'b0);
90
  assign wb_adr_intc = (request_to_intc ? wb_adr_core : 32'h00000000);
91
  assign wb_we_intc = (request_to_intc ? wb_we_core : 1'b0);
92
  assign wb_sel_intc = (request_to_intc ? wb_sel_core : 4'b0000);
93
  assign wb_wdat_intc = (request_to_intc ? wb_wdat_core : 32'h00000000);
94
 
95
  // Select outputs connected to Text-only VGA Controller inputs
96
  assign wb_cyc_text = (request_to_text ? wb_cyc_core : 1'b0);
97
  assign wb_stb_text = (request_to_text ? wb_stb_core : 1'b0);
98
  assign wb_adr_text = (request_to_text ? wb_adr_core : 32'h00000000);
99
  assign wb_we_text = (request_to_text ? wb_we_core : 1'b0);
100
  assign wb_sel_text = (request_to_text ? wb_sel_core : 4'b0000);
101
  assign wb_wdat_text = (request_to_text ? wb_wdat_core : 32'h00000000);
102
 
103
  // Select outputs connected to PS/2 Keyboard Interface inputs
104
  assign wb_cyc_ps2 = (request_to_ps2 ? wb_cyc_core : 1'b0);
105
  assign wb_stb_ps2 = (request_to_ps2 ? wb_stb_core : 1'b0);
106
  assign wb_adr_ps2 = (request_to_ps2 ? wb_adr_core : 32'h00000000);
107
  assign wb_we_ps2 = (request_to_ps2 ? wb_we_core : 1'b0);
108
  assign wb_sel_ps2 = (request_to_ps2 ? wb_sel_core : 4'b0000);
109
  assign wb_wdat_ps2 = (request_to_ps2 ? wb_wdat_core : 32'h00000000);
110
 
111
  // Select outputs connected to DDR Controller inputs
112
  assign wb_cyc_ddr = (request_to_ddr ? wb_cyc_core : 1'b0);
113
  assign wb_stb_ddr = (request_to_ddr ? wb_stb_core : 1'b0);
114
  assign wb_adr_ddr = (request_to_ddr ? wb_adr_core : 32'h00000000);
115
  assign wb_we_ddr = (request_to_ddr ? wb_we_core : 1'b0);
116
  assign wb_sel_ddr = (request_to_ddr ? wb_sel_core : 4'b0000);
117
  assign wb_wdat_ddr = (request_to_ddr ? wb_wdat_core : 32'h00000000);
118
 
119
  /*
120
   * Module instances
121
   */
122
 
123
  // M1 Core
124
  m1_core m1_core_0 (
125
 
126
    // System
127
    .sys_clock_i(sys_clock_i),
128
    .sys_reset_i(sys_reset_i),
129
    .sys_irq_i(sys_irq),
130
 
131
    // Wishbone master interface
132
    .wb_cyc_o(wb_cyc_core),
133
    .wb_stb_o(wb_stb_core),
134
    .wb_we_o(wb_we_core),
135
    .wb_sel_o(wb_sel_core),
136
    .wb_adr_o(wb_adr_core),
137
    .wb_dat_o(wb_wdat_core),
138
    .wb_ack_i(wb_ack_core),
139
    .wb_dat_i(wb_rdat_core)
140
 
141
  );
142
 
143
  // Interrupt Controller
144
  wb_int_ctrl wb_int_ctrl_0 (
145
 
146
    // System
147
    .sys_clock_i(sys_clock_i),
148
    .sys_reset_i(sys_reset_i),
149
 
150
    // Interrupts
151
    .sys_irqs_i(sys_irqs),
152
    .sys_irq_o(sys_irq),
153
 
154
    // Wishbone slave interface
155
    .wb_cyc_i(wb_cyc_intc),
156
    .wb_stb_i(wb_stb_intc),
157
    .wb_adr_i(wb_adr_intc),
158
    .wb_we_i(wb_we_intc),
159
    .wb_sel_i(wb_sel_intc),
160
    .wb_dat_i(wb_wdat_intc),
161
    .wb_ack_o(wb_ack_intc),
162
    .wb_dat_o(wb_rdat_intc)
163
 
164
  );
165
 
166
  // Text-only VGA Controller
167
  wb_text_vga wb_text_vga_0 (
168
 
169
    // System
170
    .sys_clock_i(sys_clock_i),
171
    .sys_reset_i(sys_reset_i),
172
 
173
    // Wishbone slave interface
174
    .wb_cyc_i(wb_cyc_text),
175
    .wb_stb_i(wb_stb_text),
176
    .wb_adr_i(wb_adr_text),
177
    .wb_we_i(wb_we_text),
178
    .wb_sel_i(wb_sel_text),
179
    .wb_dat_i(wb_wdat_text),
180
    .wb_ack_o(wb_ack_text),
181
    .wb_dat_o(wb_rdat_text),
182
 
183
    // VGA Port
184
    .vga_rgb_r_o(vga_rgb_r_o),
185
    .vga_rgb_g_o(vga_rgb_g_o),
186
    .vga_rgb_b_o(vga_rgb_b_o),
187
    .vga_hsync_o(vga_hsync_o),
188
    .vga_vsync_o(vga_vsync_o)
189
 
190
  );
191
 
192
  // PS/2 Keyboard Interface
193
  ps2_top wb_ps2_keyboard_0
194
  (
195
 
196
    // System
197
    .wb_clk_i(sys_clock_i),
198
    .wb_rst_i(sys_reset_i),
199
 
200
    // Wishbone slave interface
201
    .wb_cyc_i(wb_cyc_ps2),
202
    .wb_stb_i(wb_stb_ps2),
203
    .wb_we_i(wb_we_ps2),
204
    .wb_sel_i(wb_sel_ps2),
205
    .wb_adr_i(wb_adr_ps2[3:0]),
206
    .wb_dat_i(wb_wdat_ps2),
207
    .wb_dat_o(wb_rdat_ps2),
208
    .wb_ack_o(wb_ack_ps2),
209
 
210
    // Interrupt
211
    .wb_int_o(sys_irqs[0]),
212
 
213
    // PS/2 Keyboard Port
214
    .ps2_kbd_clk_pad_i(ps2_keyboard_clock_i),
215
    .ps2_kbd_data_pad_i(ps2_keyboard_data_i),
216
    .ps2_kbd_clk_pad_o(ps2_keyboard_clock_o),
217
    .ps2_kbd_data_pad_o(ps2_keyboard_data_o),
218
    .ps2_kbd_clk_pad_oe_o(ps2_keyboard_clock_padoe_o),
219
    .ps2_kbd_data_pad_oe_o(ps2_keyboard_data_padoe_o)
220
 
221
  );
222
 
223
  // DDR Controller
224
  wb_ddr wb_ddr_0 (
225
 
226
    // System
227
    .clk(sys_clock_i),
228
    .reset(sys_reset_i),
229
 
230
    // DDR Port
231
    .ddr_clk(ddr_clk),
232
    .ddr_clk_n(ddr_clk_n),
233
    .ddr_clk_fb(ddr_clk_fb),
234
    .ddr_ras_n(ddr_ras_n),
235
    .ddr_cas_n(ddr_cas_n),
236
    .ddr_we_n(ddr_we_n),
237
    .ddr_cke(ddr_cke),
238
    .ddr_cs_n(ddr_cs_n),
239
    .ddr_a(ddr_a),
240
    .ddr_ba(ddr_ba),
241
    .ddr_dq(ddr_dq),
242
    .ddr_dqs(ddr_dqs),
243
    .ddr_dm(ddr_dm),
244
 
245
    // Wishbone master interface
246
    .wb_cyc_i(wb_cyc_ddr),
247
    .wb_stb_i(wb_stb_ddr),
248
    .wb_we_i(wb_we_ddr),
249
    .wb_adr_i(wb_adr_ddr),
250
    .wb_dat_o(wb_rdat_ddr),
251
    .wb_dat_i(wb_wdat_ddr),
252
    .wb_sel_i(wb_sel_ddr),
253
    .wb_ack_o(wb_ack_ddr),
254
 
255
    // phase shifting
256
    .rot(rot)
257
 
258
  );
259
 
260
 
261
endmodule
262
 

powered by: WebSVN 2.1.0

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