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

Subversion Repositories s6soc

[/] [s6soc/] [trunk/] [rtl/] [busmaster.v] - Blame information for rev 18

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

Line No. Rev Author Line
1 4 dgisselq
////////////////////////////////////////////////////////////////////////////////
2 2 dgisselq
//
3 4 dgisselq
// Filename:    busmaster.v
4 2 dgisselq
//
5 4 dgisselq
// Project:     CMod S6 System on a Chip, ZipCPU demonstration project
6 2 dgisselq
//
7 4 dgisselq
// Purpose:     
8 2 dgisselq
//
9 4 dgisselq
// Creator:     Dan Gisselquist, Ph.D.
10 2 dgisselq
//              Gisselquist Technology, LLC
11
//
12 4 dgisselq
////////////////////////////////////////////////////////////////////////////////
13 2 dgisselq
//
14 4 dgisselq
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
15 2 dgisselq
//
16 4 dgisselq
// This program is free software (firmware): you can redistribute it and/or
17
// modify it under the terms of  the GNU General Public License as published
18
// by the Free Software Foundation, either version 3 of the License, or (at
19
// your option) any later version.
20
//
21
// This program is distributed in the hope that it will be useful, but WITHOUT
22
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
// for more details.
25
//
26
// You should have received a copy of the GNU General Public License along
27
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
28
// target there if the PDF file isn't present.)  If not, see
29
// <http://www.gnu.org/licenses/> for a copy.
30
//
31
// License:     GPL, v3, as defined and found on www.gnu.org,
32
//              http://www.gnu.org/licenses/gpl.html
33
//
34
//
35
////////////////////////////////////////////////////////////////////////////////
36
//
37
//
38
//
39 2 dgisselq
`include "builddate.v"
40
//
41
`define INCLUDE_ZIPPY
42 16 dgisselq
`define IMPLEMENT_ONCHIP_RAM
43 2 dgisselq
`ifndef VERILATOR
44
`define FANCY_ICAP_ACCESS
45
`endif
46
`define FLASH_ACCESS
47 7 dgisselq
`define DBG_SCOPE       // About 204 LUTs, at 2^6 addresses
48 16 dgisselq
// `define      COMPRESSED_SCOPE
49
`define INCLUDE_SECOND_TIMER
50
`define INCLUDE_CPU_RESET_LOGIC
51 7 dgisselq
// `define      INCLUDE_RTC     // About 90 LUTs
52 2 dgisselq
module  busmaster(i_clk, i_rst,
53
                i_rx_stb, i_rx_data, o_tx_stb, o_tx_data, i_tx_busy,
54 12 dgisselq
                        o_uart_cts,
55 2 dgisselq
                // The SPI Flash lines
56
                o_qspi_cs_n, o_qspi_sck, o_qspi_dat, i_qspi_dat, o_qspi_mod,
57
                // The board I/O
58
                i_btn, o_led, o_pwm, o_pwm_aux,
59
                // Keypad connections
60
                i_kp_row, o_kp_col,
61
                // UART control
62
                o_uart_setup,
63
                // GPIO lines
64
                i_gpio, o_gpio);
65 8 dgisselq
        parameter       BUS_ADDRESS_WIDTH=23, ZIP_ADDRESS_WIDTH=BUS_ADDRESS_WIDTH,
66 11 dgisselq
                        CMOD_ZIPCPU_RESET_ADDRESS=23'h480000,
67 8 dgisselq
                        ZA=ZIP_ADDRESS_WIDTH, BAW=BUS_ADDRESS_WIDTH; // 24bits->2,258,23b->2181
68 2 dgisselq
        input                   i_clk, i_rst;
69
        input                   i_rx_stb;
70
        input           [7:0]    i_rx_data;
71
        output  reg             o_tx_stb;
72
        output  reg     [7:0]    o_tx_data;
73
        input                   i_tx_busy;
74 12 dgisselq
        output  wire            o_uart_cts;
75 2 dgisselq
        // SPI flash control
76
        output  wire            o_qspi_cs_n, o_qspi_sck;
77
        output  wire    [3:0]    o_qspi_dat;
78
        input           [3:0]    i_qspi_dat;
79
        output  wire    [1:0]    o_qspi_mod;
80
        // Board I/O
81
        input           [1:0]    i_btn;
82
        output  wire    [3:0]    o_led;
83
        output  wire            o_pwm;
84
        output  wire    [1:0]    o_pwm_aux;
85
        // Keypad
86
        input           [3:0]    i_kp_row;
87
        output  wire    [3:0]    o_kp_col;
88
        // UART control
89
        output  wire    [29:0]   o_uart_setup;
90
        // GPIO liines
91
        input           [15:0]   i_gpio;
92
        output  wire    [15:0]   o_gpio;
93
 
94
 
95
        //
96
        //
97
        // Master wishbone wires
98
        //
99
        //
100
        wire            wb_cyc, wb_stb, wb_we, wb_stall, wb_ack, wb_err;
101
        wire    [31:0]   wb_data, wb_idata;
102
        wire    [(BAW-1):0]      wb_addr;
103
        wire    [5:0]            io_addr;
104
        assign  io_addr = {
105
                        wb_addr[22],    // Flash
106
                        wb_addr[13],    // RAM
107
                        wb_addr[11],    // RTC
108
                        wb_addr[10],    // CFG
109
                        wb_addr[ 9],    // SCOPE
110
                        wb_addr[ 8] };  // I/O
111
 
112
        // Wires going to devices
113
        // And then headed back home
114
        wire    w_interrupt;
115
        // Oh, and the debug control for the ZIP CPU
116
        wire            zip_dbg_ack, zip_dbg_stall;
117
        wire    [31:0]   zip_dbg_data;
118
 
119
 
120
        //
121
        //
122
        // The BUS master (source): The ZipCPU
123
        //
124
        //
125
        wire            zip_cyc, zip_stb, zip_we, zip_cpu_int;
126
        wire    [(ZA-1):0]       w_zip_addr;
127
        wire    [(BAW-1):0]      zip_addr;
128 16 dgisselq
        wire    [31:0]           zip_data, zip_scope_data;
129 2 dgisselq
        // and then coming from devices
130
        wire            zip_ack, zip_stall, zip_err;
131
        wire    dwb_we, dwb_stb, dwb_cyc, dwb_ack, dwb_stall, dwb_err;
132
        wire    [(BAW-1):0]      dwb_addr;
133
        wire    [31:0]           dwb_odata;
134
 
135
        // wire [31:0]  zip_debug;
136
//
137
// We'll define our RESET_ADDRESS to be halfway through our flash memory.
138
//      `define CMOD_ZIPCPU_RESET_ADDRESS       23'h600000
139
//
140
// Ahm, No.  We can actually do much better than that.  Our toplevel *.bit file
141
// only takes up only 335kB.  Let's give it some room to grow to 1024 kB.  Then
142
// 23 can start our ROM at 23'h400100
143
//
144
// Not so fast.  In hindsight, we really want to be  able to adjust the load and
145
// the program separately.  So, instead, let's place our RESET address at the
146
// second flash erase block.  That way, we can change our program code found
147
// in the flash without needing to change our FPGA load and vice versa.
148
//
149
// 23'h404000
150 16 dgisselq
        wire    cpu_reset;
151
`ifdef  INCLUDE_CPU_RESET_LOGIC
152
        reg     btn_reset, x_button, r_button;
153
        initial btn_reset = 1'b0;
154
        initial x_button = 1'b0;
155
        initial r_button = 1'b0;
156
        always @(posedge i_clk)
157
        begin
158
                x_button <= i_btn[1];
159
                r_button <= x_button;
160
                btn_reset <= ((r_button)&&(zip_cpu_int))||(tmrb_int);
161
        end
162
        assign  cpu_reset = btn_reset;
163
`else
164
        assign  cpu_reset = 1'b0;
165
`endif
166
 
167 2 dgisselq
        zipbones #(CMOD_ZIPCPU_RESET_ADDRESS,ZA,6)
168 16 dgisselq
                thecpu(i_clk, btn_reset, // 1'b0,
169 2 dgisselq
                        // Zippys wishbone interface
170
                        wb_cyc, wb_stb, wb_we, w_zip_addr, wb_data,
171
                                wb_ack, wb_stall, wb_idata, wb_err,
172
                        w_interrupt, zip_cpu_int,
173 16 dgisselq
                        // Debug wishbone interface -- not really used
174 2 dgisselq
                        1'b0, 1'b0,1'b0, 1'b0, 32'h00,
175 16 dgisselq
                                zip_dbg_ack, zip_dbg_stall, zip_dbg_data,
176
                        zip_scope_data);
177 2 dgisselq
        generate
178
        if (ZA < BAW)
179
                assign  wb_addr = { {(BAW-ZA){1'b0}}, w_zip_addr };
180
        else
181
                assign  wb_addr = w_zip_addr;
182
        endgenerate
183
 
184
        wire    io_sel, flash_sel, flctl_sel, scop_sel, cfg_sel, mem_sel,
185
                        rtc_sel, none_sel, many_sel;
186
        wire    flash_ack, scop_ack, cfg_ack, mem_ack;
187
        wire    rtc_ack, rtc_stall;
188
`ifdef  INCLUDE_RTC
189
        assign  rtc_stall = 1'b0;
190
`endif
191
        wire    io_stall, flash_stall, scop_stall, cfg_stall, mem_stall;
192 4 dgisselq
        reg     io_ack;
193 2 dgisselq
 
194
        wire    [31:0]   flash_data, scop_data, cfg_data, mem_data, pwm_data,
195
                        spio_data, gpio_data, uart_data;
196
        reg     [31:0]   io_data;
197
        reg     [(BAW-1):0]      bus_err_addr;
198
 
199
        assign  wb_ack = (wb_cyc)&&((io_ack)||(scop_ack)||(cfg_ack)
200
`ifdef  INCLUDE_RTC
201
                                ||(rtc_ack)
202
`endif
203
                                ||(mem_ack)||(flash_ack)||((none_sel)&&(1'b1)));
204
        assign  wb_stall = ((io_sel)&&(io_stall))
205
                        ||((scop_sel)&&(scop_stall))
206
                        ||((cfg_sel)&&(cfg_stall))
207
                        ||((mem_sel)&&(mem_stall))
208
`ifdef  INCLUDE_RTC
209
                        ||((rtc_sel)&&(rtc_stall))
210
`endif
211
                        ||((flash_sel||flctl_sel)&&(flash_stall));
212
                        // (none_sel)&&(1'b0)
213
 
214
        /*
215
        assign  wb_idata = (io_ack)?io_data
216
                        : ((scop_ack)?scop_data
217
                        : ((cfg_ack)?cfg_data
218
                        : ((mem_ack)?mem_data
219
                        : ((flash_ack)?flash_data
220
                        : 32'h00))));
221
        */
222
        assign  wb_idata =  (io_ack|scop_ack)?((io_ack )? io_data  : scop_data)
223
                        : ((mem_ack|rtc_ack)?((mem_ack)?mem_data:rtc_data)
224 4 dgisselq
                        : ((cfg_ack) ? cfg_data : flash_data));//if (flash_ack)
225 2 dgisselq
        assign  wb_err = ((wb_cyc)&&(wb_stb)&&(none_sel || many_sel)) || many_ack;
226
 
227
        // Addresses ...
228
        //      0000 xxxx       configuration/control registers
229
        //      1 xxxx xxxx xxxx xxxx xxxx      Up-sampler taps
230
        assign  io_sel   =((wb_cyc)&&(io_addr[5:0]==6'h1));
231
        assign  flctl_sel= 1'b0; // ((wb_cyc)&&(io_addr[5:1]==5'h1));
232
        assign  scop_sel =((wb_cyc)&&(io_addr[5:1]==5'h1));
233
        assign  cfg_sel  =((wb_cyc)&&(io_addr[5:2]==4'h1));
234
        // zip_sel is not on the bus at this point
235
`ifdef  INCLUDE_RTC
236
        assign  rtc_sel  =((wb_cyc)&&(io_addr[5:3]==3'h1));
237
`endif
238
        assign  mem_sel  =((wb_cyc)&&(io_addr[5:4]==2'h1));
239
        assign  flash_sel=((wb_cyc)&&(io_addr[5]));
240
 
241
        assign  none_sel =((wb_cyc)&&(wb_stb)&&(io_addr==6'h0));
242
        /*
243 16 dgisselq
        assign  none_sel =((wb_cyc)&&(wb_stb)&&
244
                        ((io_addr==6'h0)
245
                        ||((~io_addr[5])&&(|wb_addr[22:14])))
246
                        );
247
        */
248
        /*
249 2 dgisselq
        assign  many_sel =((wb_cyc)&&(wb_stb)&&(
250
                         {3'h0, io_sel}
251
                        +{3'h0, flctl_sel}
252 11 dgisselq
                        +{3'h0, scop_sel}
253 2 dgisselq
                        +{3'h0, cfg_sel}
254 11 dgisselq
                        +{3'h0, rtc_sel}
255 2 dgisselq
                        +{3'h0, mem_sel}
256
                        +{3'h0, flash_sel} > 1));
257
        */
258
        assign  many_sel = 1'b0;
259
 
260
        wire    many_ack;
261
        assign  many_ack =((wb_cyc)&&(
262
                         {3'h0, io_ack}
263
                        +{3'h0, scop_ack}
264
                        +{3'h0, cfg_ack}
265
`ifdef  INCLUDE_RTC
266
                        +{3'h0, rtc_ack}
267
`endif
268
                        +{3'h0, mem_ack}
269
                        +{3'h0, flash_ack} > 1));
270
 
271
        wire            flash_interrupt, scop_interrupt, tmra_int, tmrb_int,
272
                        rtc_interrupt, gpio_int, pwm_int, keypad_int,button_int;
273
 
274
 
275
        //
276
        //
277
        //
278
        reg             rx_rdy;
279
        wire    [10:0]   int_vector;
280
        assign  int_vector = { gpio_int, pwm_int, keypad_int,
281 13 dgisselq
                                (~o_tx_stb), rx_rdy,
282
                                tmrb_int, tmra_int,
283 2 dgisselq
                                rtc_interrupt, scop_interrupt,
284
                                wb_err, button_int };
285
 
286
        wire    [31:0]   pic_data;
287 4 dgisselq
        icontrol #(11)  pic(i_clk, 1'b0, (wb_stb)&&(io_sel)
288 2 dgisselq
                                        &&(wb_addr[3:0]==4'h0)&&(wb_we),
289
                        wb_data, pic_data, int_vector, w_interrupt);
290
 
291 8 dgisselq
        initial bus_err_addr = 0; // `DATESTAMP;
292 2 dgisselq
        always @(posedge i_clk)
293
                if (wb_err)
294
                        bus_err_addr <= wb_addr;
295
 
296 11 dgisselq
        wire    [31:0]   timer_a, timer_b;
297 2 dgisselq
        wire            zta_ack, zta_stall, ztb_ack, ztb_stall;
298 11 dgisselq
        ziptimer        #(32,31)
299 4 dgisselq
                zipt_a(i_clk, 1'b0, 1'b1, wb_cyc,
300 16 dgisselq
`ifdef  INCLUDE_SECOND_TIMER
301 2 dgisselq
                                (wb_stb)&&(io_sel)&&(wb_addr[3:0]==4'h2),
302 16 dgisselq
`else
303
                                (wb_stb)&&(io_sel)&&(wb_addr[3:1]==3'h1),
304
`endif
305 2 dgisselq
                                wb_we, wb_data, zta_ack, zta_stall, timer_a,
306
                                tmra_int);
307 16 dgisselq
`ifdef  INCLUDE_SECOND_TIMER
308 11 dgisselq
        ziptimer        #(32,31)
309 16 dgisselq
                zipt_b(i_clk, cpu_reset, 1'b1, wb_cyc,
310 2 dgisselq
                                (wb_stb)&&(io_sel)&&(wb_addr[3:0]==4'h3),
311
                                wb_we, wb_data, ztb_ack, ztb_stall, timer_b,
312
                                tmrb_int);
313 16 dgisselq
`else
314
        // assign       timer_b = 32'h000;
315
        assign  timer_b = timer_a;
316
        assign  tmrb_int = 1'b0;
317
`endif
318 2 dgisselq
 
319
        wire    [31:0]   rtc_data;
320
`ifdef  INCLUDE_RTC
321
        wire    rtcd_ack, rtcd_stall, ppd;
322
        // rtcdate      thedate(i_clk, ppd, wb_cyc, (wb_stb)&&(io_sel), wb_we,
323
                        // wb_data, rtcd_ack, rtcd_stall, date_data);
324
        reg     r_rtc_ack;
325
        initial r_rtc_ack = 1'b0;
326
        always @(posedge i_clk)
327
                r_rtc_ack <= ((wb_stb)&&(rtc_sel));
328
        assign  rtc_ack = r_rtc_ack;
329
 
330
        rtclight
331 8 dgisselq
                #(23'h35afe5,23,0,0)      // 80 MHz clock
332 2 dgisselq
                thetime(i_clk, wb_cyc,
333
                        ((wb_stb)&&(rtc_sel)), wb_we,
334
                        { 1'b0, wb_addr[1:0] }, wb_data, rtc_data,
335
                        rtc_interrupt, ppd);
336
`else
337
        assign  rtc_interrupt = 1'b0;
338
        assign  rtc_data = 32'h00;
339
        assign  rtc_ack  = 1'b0;
340
`endif
341
 
342
        always @(posedge i_clk)
343
                case(wb_addr[3:0])
344
                        4'h0: io_data <= pic_data;
345
                        4'h1: io_data <= { {(32-BAW){1'b0}}, bus_err_addr };
346
                        4'h2: io_data <= timer_a;
347
                        4'h3: io_data <= timer_b;
348
                        4'h4: io_data <= pwm_data;
349
                        4'h5: io_data <= spio_data;
350
                        4'h6: io_data <= gpio_data;
351
                        4'h7: io_data <= uart_data;
352
                        default: io_data <= `DATESTAMP;
353
                        // 4'h8: io_data <= `DATESTAMP;
354
                endcase
355
        always @(posedge i_clk)
356
                io_ack <= (wb_cyc)&&(wb_stb)&&(io_sel);
357
        assign  io_stall = 1'b0;
358
 
359
        wire    pwm_ack, pwm_stall;
360 12 dgisselq
        wbpwmaudio      #(14'd10000,2,0,14)
361
                theaudio(i_clk, wb_cyc,
362
                                ((wb_stb)&&(io_sel)&&(wb_addr[3:0]==4'h4)),
363
                                        wb_we, 1'b0, wb_data,
364
                                pwm_ack, pwm_stall, pwm_data, o_pwm,
365
                                        o_pwm_aux, //={pwm_shutdown_n,pwm_gain}
366
                                        pwm_int);
367 2 dgisselq
 
368
        //
369
        // Special Purpose I/O: Keypad, button, LED status and control
370
        //
371 16 dgisselq
        wire    [3:0]    w_led;
372 2 dgisselq
        spio    thespio(i_clk, wb_cyc,(wb_stb)&&(io_sel)&&(wb_addr[3:0]==4'h5),wb_we,
373 16 dgisselq
                        wb_data, spio_data, o_kp_col, i_kp_row, i_btn, w_led,
374 2 dgisselq
                        keypad_int, button_int);
375 16 dgisselq
        assign  o_led = { w_led[3]|w_interrupt,w_led[2]|zip_cpu_int,w_led[1:0] };
376 2 dgisselq
 
377
        //
378
        // General purpose (sort of) I/O:  (Bottom two bits robbed in each
379
        // direction for an I2C link at the toplevel.v design)
380
        //
381
        wbgpio  #(16,16,16'hffff) thegpio(i_clk, wb_cyc,
382
                        (wb_stb)&&(io_sel)&&(wb_addr[3:0]==4'h6), wb_we,
383
                        wb_data, gpio_data, i_gpio, o_gpio, gpio_int);
384
 
385
        //
386
        //
387
        //      Rudimentary serial port control
388
        //
389
        reg     [7:0]    r_rx_data;
390
        // Baud rate is set by clock rate / baud rate.
391
        // Thus, 80MHz / 115200MBau
392
        //      = 694.4, or about 0x2b6. 
393
        // although the CPU might struggle to keep up at this speed without a
394
        // hardware buffer.
395
        //
396
        // We'll add the flag for two stop bits.
397 7 dgisselq
        // assign       o_uart_setup = 30'h080002b6; // 115200 MBaud @ an 80MHz clock
398
        assign  o_uart_setup = 30'h0000208d; // 9600 MBaud, 8N1
399 2 dgisselq
 
400
        initial o_tx_stb = 1'b0;
401
        initial o_tx_data = 8'h00;
402
        always @(posedge i_clk)
403 4 dgisselq
                if ((wb_stb)&&(io_sel)&&(wb_addr[3:0]==4'h7)&&(wb_we))
404 2 dgisselq
                begin
405
                        o_tx_data <= wb_data[7:0];
406
                        o_tx_stb <= 1'b1;
407
                end
408
                else if ((o_tx_stb)&&(~i_tx_busy))
409
                        o_tx_stb <= 1'b0;
410
        initial rx_rdy = 1'b0;
411
        always @(posedge i_clk)
412
                if (i_rx_stb)
413
                        r_rx_data <= i_rx_data;
414
        always @(posedge i_clk)
415
        begin
416 4 dgisselq
                if((wb_stb)&&(io_sel)&&(wb_addr[3:0]==4'h7)&&(~wb_we))
417 2 dgisselq
                        rx_rdy <= i_rx_stb;
418
                else if (i_rx_stb)
419
                        rx_rdy <= (rx_rdy | i_rx_stb);
420
        end
421 12 dgisselq
        assign  o_uart_cts = (~rx_rdy);
422 2 dgisselq
        assign  uart_data = { 23'h0, ~rx_rdy, r_rx_data };
423 4 dgisselq
        //
424
        // uart_ack gets returned as part of io_ack, since that happens when
425
        // io_sel and wb_stb are defined
426
        //
427
        // always @(posedge i_clk)
428
                // uart_ack<= ((wb_stb)&&(io_sel)&&(wb_addr[3:0]==4'h7));
429 2 dgisselq
 
430
 
431
 
432
        //
433
        //      FLASH MEMORY CONFIGURATION ACCESS
434
        //
435
        wbqspiflash #(24)       flashmem(i_clk,
436 11 dgisselq
                wb_cyc,(wb_stb)&&(flash_sel),(wb_stb)&&(flctl_sel),wb_we,
437 4 dgisselq
                        wb_addr[(24-3):0], wb_data,
438 2 dgisselq
                flash_ack, flash_stall, flash_data,
439
                o_qspi_sck, o_qspi_cs_n, o_qspi_mod, o_qspi_dat, i_qspi_dat,
440
                flash_interrupt);
441
 
442
        //
443
        //      MULTIBOOT/ICAPE2 CONFIGURATION ACCESS
444
        //
445
        wire    [31:0]   cfg_scope;
446
`ifdef  FANCY_ICAP_ACCESS
447
        wbicape6        fpga_cfg(i_clk, wb_cyc,(cfg_sel)&&(wb_stb), wb_we,
448
                                wb_addr[5:0], wb_data,
449
                                cfg_ack, cfg_stall, cfg_data,
450
                                cfg_scope);
451
`else
452
        reg     r_cfg_ack;
453
        always @(posedge i_clk)
454
                r_cfg_ack <= (wb_cyc)&&(cfg_sel)&&(wb_stb);
455
        assign  cfg_ack   = r_cfg_ack;
456
        assign  cfg_stall = 1'b0;
457
        assign  cfg_data  = 32'h00;
458
        assign  cfg_scope = 32'h00;
459
`endif
460
 
461
 
462
        //
463
        //      ON-CHIP RAM MEMORY ACCESS
464
        //
465 4 dgisselq
`ifdef  IMPLEMENT_ONCHIP_RAM
466 2 dgisselq
        memdev  #(12) ram(i_clk, wb_cyc, (wb_stb)&&(mem_sel), wb_we,
467
                        wb_addr[11:0], wb_data, mem_ack, mem_stall, mem_data);
468 4 dgisselq
`else
469
        assign  mem_data = 32'h00;
470
        assign  mem_stall = 1'b0;
471
        reg     r_mem_ack;
472
        always @(posedge i_clk)
473
                r_mem_ack <= (wb_cyc)&&(wb_stb)&&(mem_sel);
474
        assign  mem_ack = r_mem_ack;
475
`endif
476 2 dgisselq
 
477
        //
478
        //
479
        //      WISHBONE SCOPE
480
        //
481
        //
482
        //
483
        //
484
        wire    [31:0]   scop_cfg_data;
485
        wire            scop_cfg_ack, scop_cfg_stall, scop_cfg_interrupt;
486 7 dgisselq
`ifdef  DBG_SCOPE
487 2 dgisselq
        wire            scop_cfg_trigger;
488
        assign  scop_cfg_trigger = (wb_cyc)&&(wb_stb)&&(cfg_sel);
489 16 dgisselq
        // wire scop_trigger = scop_cfg_trigger;
490
        wire    scop_trigger = (zip_cpu_int) || (cpu_reset);
491
`ifdef  COMPRESSED_SCOPE
492
        wbscopc #(5'ha)
493
`else
494
        wbscope #(5'ha)
495
`endif
496
        wbcfgscope(i_clk, 1'b1, scop_trigger,
497
                // cfg_scope,
498
                zip_scope_data[30:0],
499 2 dgisselq
                // Wishbone interface
500 4 dgisselq
                i_clk, wb_cyc, (wb_stb)&&(scop_sel),
501 2 dgisselq
                                wb_we, wb_addr[0], wb_data,
502
                        scop_cfg_ack, scop_cfg_stall, scop_cfg_data,
503
                scop_cfg_interrupt);
504 4 dgisselq
`else
505
        reg     r_scop_cfg_ack;
506
        always @(posedge i_clk)
507
                r_scop_cfg_ack <= (wb_cyc)&&(wb_stb)&&(scop_sel);
508
        assign  scop_cfg_ack = r_scop_cfg_ack;
509
        assign  scop_cfg_data = 32'h000;
510
        assign  scop_cfg_stall= 1'b0;
511 2 dgisselq
`endif
512
 
513
        assign  scop_interrupt = scop_cfg_interrupt;
514
        assign  scop_ack   = scop_cfg_ack;
515
        assign  scop_stall = scop_cfg_stall;
516
        assign  scop_data  = scop_cfg_data;
517
 
518
endmodule
519
 

powered by: WebSVN 2.1.0

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