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

Subversion Repositories wb_lpc

[/] [wb_lpc/] [trunk/] [examples/] [pci_lpc/] [top_pci_lpc_host.v] - Blame information for rev 20

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 hharte
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3 17 hharte
////  $Id: top_pci_lpc_host.v,v 1.4 2008-07-26 19:15:31 hharte Exp $   ////
4 7 hharte
////  top_pci_lpc_host.v - Top Level for PCI to LPC Host          ////
5
////  for the Enterpoint Raggedstone1 PCI Card.  Based on the     ////
6
////  OpenCores raggedstone project, and uses the OpenCores       ////
7
////  pci32tlite core.                                            ////
8
////                                                              ////
9
////  This file is part of the Wishbone LPC Bridge project        ////
10
////  http://www.opencores.org/projects/wb_lpc/                   ////
11
////                                                              ////
12
////  Author:                                                     ////
13
////      - Howard M. Harte (hharte@opencores.org)                ////
14
////                                                              ////
15
//////////////////////////////////////////////////////////////////////
16
////                                                              ////
17
//// Copyright (C) 2008 Howard M. Harte                           ////
18
////                                                              ////
19
//// This source file may be used and distributed without         ////
20
//// restriction provided that this copyright statement is not    ////
21
//// removed from the file and that any derivative work contains  ////
22
//// the original copyright notice and the associated disclaimer. ////
23
////                                                              ////
24
//// This source file is free software; you can redistribute it   ////
25
//// and/or modify it under the terms of the GNU Lesser General   ////
26
//// Public License as published by the Free Software Foundation; ////
27
//// either version 2.1 of the License, or (at your option) any   ////
28
//// later version.                                               ////
29
////                                                              ////
30
//// This source is distributed in the hope that it will be       ////
31
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
32
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
33
//// PURPOSE.  See the GNU Lesser General Public License for more ////
34
//// details.                                                     ////
35
////                                                              ////
36
//// You should have received a copy of the GNU Lesser General    ////
37
//// Public License along with this source; if not, download it   ////
38
//// from http://www.opencores.org/lgpl.shtml                     ////
39
////                                                              ////
40
//////////////////////////////////////////////////////////////////////
41
 
42
module pci_lpc_host
43
(
44
    CLK,
45
    RST, // Active Low
46
    INTA,
47
    REQ,
48
    GNT,
49
    FRAME,
50
    IRDY,
51
    IDSEL,
52
    DEVSEL,
53
    TRDY,
54
    STOP,
55
    PAR,
56
    PERR,
57
    SERR,
58
    PCI_AD,
59
    CBE0,
60
    CBE1,
61
    CBE2,
62
    CBE3,
63
 
64
    DISP_SEL,
65
    DISP_LED,
66
 
67 12 hharte
    LPC_RST,
68 7 hharte
    LPC_CLK,
69
    LFRAME,
70
    LAD,
71
    LAD_OE,
72
    LPC_INT,
73 12 hharte
 
74
    LPC_GND,
75
 
76 7 hharte
    PREVENT_STRIPPING_OF_UNUSED_INPUTS
77
);
78
 
79
input           CLK ;
80
input           RST ;
81
 
82
inout [31:0]    PCI_AD ;
83
 
84
input           CBE0,
85
                CBE1,
86
                CBE2,
87
                CBE3 ;
88
 
89
output          PAR ;
90
input           FRAME ;
91
input           IRDY ;
92
output          TRDY ;
93
output          DEVSEL ;
94
inout           STOP ;
95
input           IDSEL ;
96
inout           PERR ;
97
inout           SERR ;
98
output          INTA ;
99
//attribute s: string; -- SAVE NET FLAG
100
input           REQ ;       // attribute s of PCI_nREQ: signal is "yes"; 
101
input           GNT ;       // attribute s of PCI_nGNT: signal is "yes"; 
102
output  [3:0]   DISP_SEL ;
103
output  [6:0]   DISP_LED ;
104
 
105 12 hharte
output          LPC_RST;
106 7 hharte
output          LPC_CLK;
107
output          LFRAME;
108
inout   [3:0]   LAD;
109 12 hharte
inout           LPC_INT;
110 7 hharte
output          LAD_OE;
111
 
112 12 hharte
output  [6:0]   LPC_GND;
113
assign LPC_GND = 7'b0000000;
114
 
115 7 hharte
output          PREVENT_STRIPPING_OF_UNUSED_INPUTS ;
116
 
117
assign PREVENT_STRIPPING_OF_UNUSED_INPUTS = REQ & GNT;
118
 
119
wire    [2:0]   dma_chan_i = 3'b000;
120
wire            dma_tc_i = 1'b0;
121
wire            lframe_o;
122
wire    [3:0]   lad_i;
123
wire    [3:0]   lad_o;
124
wire            host_lad_oe;
125 9 hharte
 
126 12 hharte
assign LPC_RST = RST;
127 7 hharte
assign LAD = (host_lad_oe ? lad_o : 4'bzzzz);
128
assign LAD_OE = host_lad_oe;
129
assign LFRAME = ~lframe_o;
130
 
131
wire    [3:0]   CBE_in =
132
{
133
    CBE3,
134
    CBE2,
135
    CBE1,
136
    CBE0
137
} ;
138
 
139
wire    [24:0]  wb_adr_o;
140
wire    [31:0]  wb_dat_i;
141
wire    [31:0]  wb_dat_o;
142
wire    [3:0]   wb_sel_o;
143
wire    [1:0]   wb_tga;
144
wire            wb_we_o;
145
wire            wb_stb_o;
146
wire            wb_cyc_o;
147
wire            wb_ack_i;
148
wire            wb_rty_i = 1'b0;
149
wire            wb_err_i = 1'b0;
150
wire            wb_int_i;
151
 
152
//assign wb_tga = wb_adr_o[17:16];  // I/O Cycle
153
assign wb_tga = 2'b10;  // Firmware cycle
154
 
155
// Instantiate the pci32tlite module
156
pci32tLite #(
157 9 hharte
    .vendorID(16'h10ee),
158
    .deviceID(16'hf00d),
159
    .revisionID(8'h01),
160 7 hharte
    .subsystemID(16'h0),
161
    .subsystemvID(16'h0),
162
    .BARS("1BARMEM"),
163
    .WBSIZE(32),
164
    .WBENDIAN("LITTLE"))
165
pci_target (
166
    .clk33(PCI_CLK),
167
    .rst(~RST),
168
    .ad(PCI_AD),
169
    .cbe(CBE_in),
170
    .par(PAR),
171
    .frame(FRAME),
172
    .irdy(IRDY),
173
    .trdy(TRDY),
174
    .devsel(DEVSEL),
175
    .stop(STOP),
176
    .idsel(IDSEL),
177
    .perr(PERR),
178
    .serr(SERR),
179
    .intb(INTA),
180
    .wb_adr_o(wb_adr_o),
181
    .wb_dat_i(wb_dat_i),
182
    .wb_dat_o(wb_dat_o),
183
    .wb_sel_o(wb_sel_o),
184
    .wb_we_o(wb_we_o),
185
    .wb_stb_o(wb_stb_o),
186
    .wb_cyc_o(wb_cyc_o),
187
    .wb_ack_i(wb_ack_i),
188
    .wb_rty_i(wb_rty_i),
189
    .wb_err_i(wb_err_i),
190
    .wb_int_i(wb_int_i)
191
    );
192
 
193 12 hharte
// Instantiate the LPC clock generator.
194
// The LPC clock is phase shifted by about -3ns to compensate
195
// for the skew to the LPC slave over the cable.
196
lpc_clkgen lpc_clkgen (
197
    .CLKIN_IN(CLK),
198
    .RST_IN(~RST),
199
    .CLKIN_IBUFG_OUT(PCI_CLK),
200
    .CLK0_OUT(LPC_CLK)
201
    );
202
 
203 7 hharte
wb_lpc_host lpc_host (
204 12 hharte
    .clk_i(PCI_CLK),
205 7 hharte
    .nrst_i(RST),
206
    .wbs_adr_i(wb_adr_o),
207
    .wbs_dat_o(wb_dat_i),
208
    .wbs_dat_i(wb_dat_o),
209
    .wbs_sel_i(wb_sel_o),
210
    .wbs_tga_i(wb_tga),
211
    .wbs_we_i(wb_we_o),
212
    .wbs_stb_i(wb_stb_o),
213
    .wbs_cyc_i(wb_cyc_o),
214 17 hharte
    .wbs_ack_o(wb_ack_i),
215
    .wbs_err_o(wb_err_i),
216 7 hharte
    .dma_chan_i(dma_chan_i),
217
    .dma_tc_i(dma_tc_i),
218
    .lframe_o(lframe_o),
219
    .lad_i(LAD),
220
    .lad_o(lad_o),
221
    .lad_oe(host_lad_oe)
222
    );
223
 
224 12 hharte
wire         serirq_mode = 1'b0;
225
wire  [31:0] irq_o;
226
wire         serirq_i;
227
wire         serirq_o;
228
wire         serirq_oe;
229
 
230
assign LPC_INT = (serirq_oe ? serirq_o : 1'bz);
231
assign serirq_i = LPC_INT;
232
assign wb_int_i = ~irq_o[1];
233
// Instantiate the module
234
serirq_host lpc_serirq_host (
235
    .clk_i(PCI_CLK),
236
    .nrst_i(RST),
237
    .serirq_mode_i(serirq_mode),
238
    .irq_o(irq_o),
239
    .serirq_o(serirq_o),
240
    .serirq_i(serirq_i),
241
    .serirq_oe(serirq_oe)
242
    );
243
 
244 7 hharte
// The 7-segment display is write-only from the PCI interface.
245
// Use some dummy nets for inputs that are ignored.
246 12 hharte
wire    [31:0] wb2_dat_i;
247
wire           wb2_ack_i;
248
wire           wb2_err_i;
249
wire           wb2_int_i;
250 7 hharte
 
251
// Instantiate the 7-Segment module on the host
252
wb_7seg seven_seg0 (
253 12 hharte
    .clk_i(PCI_CLK),
254 7 hharte
    .nrst_i(RST),
255
    .wb_adr_i(wb_adr_o),
256
    .wb_dat_o(wb2_dat_i),
257
    .wb_dat_i(wb_dat_o),
258
    .wb_sel_i(wb_sel_o),
259
    .wb_we_i(wb_we_o),
260
    .wb_stb_i(wb_stb_o),
261
    .wb_cyc_i(wb_cyc_o),
262
    .wb_ack_o(wb2_ack_i),
263
    .wb_err_o(wb2_err_i),
264
    .wb_int_o(wb2_int_i),
265
    .DISP_SEL(DISP_SEL),
266
    .DISP_LED(DISP_LED)
267
    );
268 12 hharte
endmodule
269 7 hharte
 
270 12 hharte
 
271
// FPGA-specific: use a Xilinx DCM Block to deskew the LPC_CLK
272
module lpc_clkgen(CLKIN_IN,
273
                  RST_IN,
274
                  CLKIN_IBUFG_OUT,
275
                  CLK0_OUT);
276
 
277
    input CLKIN_IN;
278
    input RST_IN;
279
    output CLKIN_IBUFG_OUT;
280
    output CLK0_OUT;
281
 
282
    wire CLKFB_IN;
283
    wire CLKIN_IBUFG;
284
    wire CLK0_BUF;
285
    wire GND_BIT;
286
 
287
    assign GND_BIT = 0;
288
    assign CLKIN_IBUFG_OUT = CLKIN_IBUFG;
289
    assign CLK0_OUT = CLKFB_IN;
290
    IBUFG CLKIN_IBUFG_INST (.I(CLKIN_IN),
291
                            .O(CLKIN_IBUFG));
292
    BUFG CLK0_BUFG_INST (.I(CLK0_BUF),
293
                         .O(CLKFB_IN));
294
    DCM DCM_INST (.CLKFB(CLKFB_IN),
295
                  .CLKIN(CLKIN_IBUFG),
296
                  .DSSEN(GND_BIT),
297
                  .PSCLK(GND_BIT),
298
                  .PSEN(GND_BIT),
299
                  .PSINCDEC(GND_BIT),
300
                  .RST(RST_IN),
301
                  .CLKDV(),
302
                  .CLKFX(),
303
                  .CLKFX180(),
304
                  .CLK0(CLK0_BUF),
305
                  .CLK2X(),
306
                  .CLK2X180(),
307
                  .CLK90(),
308
                  .CLK180(),
309
                  .CLK270(),
310
                  .LOCKED(),
311
                  .PSDONE(),
312
                  .STATUS());
313
    defparam DCM_INST.CLK_FEEDBACK = "1X";
314
    defparam DCM_INST.CLKDV_DIVIDE = 2.0;
315
    defparam DCM_INST.CLKFX_DIVIDE = 1;
316
    defparam DCM_INST.CLKFX_MULTIPLY = 4;
317
    defparam DCM_INST.CLKIN_DIVIDE_BY_2 = "FALSE";
318
    defparam DCM_INST.CLKIN_PERIOD = 30.000;
319
    defparam DCM_INST.CLKOUT_PHASE_SHIFT = "FIXED";
320
    defparam DCM_INST.DESKEW_ADJUST = "SYSTEM_SYNCHRONOUS";
321
    defparam DCM_INST.DFS_FREQUENCY_MODE = "LOW";
322
    defparam DCM_INST.DLL_FREQUENCY_MODE = "LOW";
323
    defparam DCM_INST.DUTY_CYCLE_CORRECTION = "TRUE";
324
    defparam DCM_INST.FACTORY_JF = 16'h8080;
325
    defparam DCM_INST.PHASE_SHIFT = -18;
326
    defparam DCM_INST.STARTUP_WAIT = "FALSE";
327 7 hharte
endmodule
328 12 hharte
// End of FPGA-specific

powered by: WebSVN 2.1.0

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