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

Subversion Repositories cop

[/] [cop/] [trunk/] [rtl/] [verilog/] [cop_top.v] - Blame information for rev 11

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

Line No. Rev Author Line
1 2 rehayes
////////////////////////////////////////////////////////////////////////////////
2
//
3
//  WISHBONE revB.2 compliant Computer Operating Properly - Top-level
4
//
5
//  Author: Bob Hayes
6
//          rehayes@opencores.org
7
//
8
//  Downloaded from: http://www.opencores.org/projects/cop.....
9
//
10
////////////////////////////////////////////////////////////////////////////////
11
// Copyright (c) 2009, Robert Hayes
12
//
13
// All rights reserved.
14
//
15
// Redistribution and use in source and binary forms, with or without
16
// modification, are permitted provided that the following conditions are met:
17
//     * Redistributions of source code must retain the above copyright
18
//       notice, this list of conditions and the following disclaimer.
19
//     * Redistributions in binary form must reproduce the above copyright
20
//       notice, this list of conditions and the following disclaimer in the
21
//       documentation and/or other materials provided with the distribution.
22
//     * Neither the name of the <organization> nor the
23
//       names of its contributors may be used to endorse or promote products
24
//       derived from this software without specific prior written permission.
25
//
26
// THIS SOFTWARE IS PROVIDED BY Robert Hayes ''AS IS'' AND ANY
27
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29
// DISCLAIMED. IN NO EVENT SHALL Robert Hayes BE LIABLE FOR ANY
30
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
33
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
////////////////////////////////////////////////////////////////////////////////
37
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
38
 
39
module cop_top #(parameter ARST_LVL = 1'b0,      // asynchronous reset level
40
                 parameter INIT_ENA = 1'b1,      // COP Enabled after reset
41
                 parameter SERV_WD_0 = 16'h5555, // First Service Word
42
                 parameter SERV_WD_1 = 16'haaaa, // Second Service Word
43
                 parameter COUNT_SIZE = 16,      // Main counter size
44
                 parameter SINGLE_CYCLE = 1'b0,  // No bus wait state added
45
                 parameter DWIDTH = 16)          // Data bus width
46
  (
47
  // Wishbone Signals
48
  output [DWIDTH-1:0] wb_dat_o,     // databus output
49
  output              wb_ack_o,     // bus cycle acknowledge output
50
  input               wb_clk_i,     // master clock input
51
  input               wb_rst_i,     // synchronous active high reset
52
  input               arst_i,       // asynchronous reset
53
  input         [2:0] wb_adr_i,     // lower address bits
54
  input  [DWIDTH-1:0] wb_dat_i,     // databus input
55
  input               wb_we_i,      // write enable input
56
  input               wb_stb_i,     // stobe/core select signal
57
  input               wb_cyc_i,     // valid bus cycle input
58
  input         [1:0] wb_sel_i,     // Select byte in word bus transaction
59
  // COP IO Signals
60
  output              cop_rst_o,    // COP reset output, active low
61
  output              cop_irq_o,    // COP interrupt request signal output
62
  input               por_reset_i,  // System Power On Reset, active low
63
  input               startup_osc_i,// System Startup Oscillator
64
  input               stop_mode_i,  // System STOP Mode
65
  input               wait_mode_i,  // System WAIT Mode
66
  input               debug_mode_i, // System DEBUG Mode
67
  input               scantestmode  // Chip in in scan test mode
68
  );
69
 
70
  wire                  cop_event;     // COP status bit
71
  wire            [1:0] cop_irq_en;    // COP Interrupt request enable
72
  wire [COUNT_SIZE-1:0] cop_counter;   // COP Counter Value
73
  wire [COUNT_SIZE-1:0] cop_capture;   // Counter value syncronized to bus_clk domain
74
  wire                  async_rst_b;   // Asyncronous reset
75
  wire                  sync_reset;    // Syncronous reset
76
  wire           [ 4:0] write_regs;    // Control register write strobes
77
  wire                  prescale_out;  //
78
  wire                  stop_ena;      // Clear COP Rollover Status Bit
79
  wire                  debug_ena;     // COP in Slave Mode, ext_sync_i selected
80
  wire                  wait_ena;      // Enable COP in system wait mode
81
  wire                  cop_ena;       // Enable COP Timout Counter
82
  wire                  cwp;           // COP write protect
83
  wire                  clck;          // COP lock
84
  wire                  reload_count;  // COP System service complete
85
  wire                  clear_event;   // Reset COP Event register
86
  wire [COUNT_SIZE-1:0] timeout_value; // Prescaler modulo
87
  wire                  counter_sync;  // 
88
 
89
  // Wishbone Bus interface
90
  cop_wb_bus #(.ARST_LVL(ARST_LVL),
91
               .SINGLE_CYCLE(SINGLE_CYCLE),
92
               .DWIDTH(DWIDTH))
93
    wishbone(
94
    .wb_dat_o     ( wb_dat_o ),
95
    .wb_ack_o     ( wb_ack_o ),
96
    .wb_clk_i     ( wb_clk_i ),
97
    .wb_rst_i     ( wb_rst_i ),
98
    .arst_i       ( arst_i ),
99
    .wb_adr_i     ( wb_adr_i ),
100
    .wb_dat_i     ( wb_dat_i ),
101
    .wb_we_i      ( wb_we_i ),
102
    .wb_stb_i     ( wb_stb_i ),
103
    .wb_cyc_i     ( wb_cyc_i ),
104
    .wb_sel_i     ( wb_sel_i ),
105
 
106
    // outputs
107
    .write_regs   ( write_regs ),
108
    .sync_reset   ( sync_reset ),
109
    // inputs    
110
    .async_rst_b  ( async_rst_b ),
111
    .irq_source   ( cnt_flag_o ),
112
    .read_regs    (               // in  -- read register bits
113
                   { cop_capture,
114
                     timeout_value,
115
                     {7'b0, cop_event, cop_irq_en, debug_ena, stop_ena, wait_ena,
116
                      cop_ena, cwp, clck}
117
                   }
118
                  )
119
  );
120
 
121
// -----------------------------------------------------------------------------
122
  cop_regs #(.ARST_LVL(ARST_LVL),
123
             .INIT_ENA(INIT_ENA),
124
             .SERV_WD_0(SERV_WD_0),
125
             .SERV_WD_1(SERV_WD_1),
126
             .COUNT_SIZE(COUNT_SIZE),
127
             .DWIDTH(DWIDTH))
128
    regs(
129
    // outputs
130
    .cop_irq_en     ( cop_irq_en ),
131
    .timeout_value  ( timeout_value ),
132
    .debug_ena      ( debug_ena ),
133
    .stop_ena       ( stop_ena ),
134
    .wait_ena       ( wait_ena ),
135
    .cop_ena        ( cop_ena ),
136
    .cwp            ( cwp ),
137
    .clck           ( clck ),
138
    .reload_count   ( reload_count ),
139
    .clear_event    ( clear_event ),
140
    // inputs
141
    .async_rst_b    ( async_rst_b ),
142
    .sync_reset     ( sync_reset ),
143
    .bus_clk        ( wb_clk_i ),
144
    .write_bus      ( wb_dat_i ),
145 9 rehayes
    .write_regs     ( write_regs )
146 2 rehayes
  );
147
 
148
// -----------------------------------------------------------------------------
149
  cop_count #(.COUNT_SIZE(COUNT_SIZE))
150
    counter(
151
    // outputs
152
    .cop_counter       ( cop_counter ),
153
    .cop_capture       ( cop_capture ),
154
    .cop_rst_o         ( cop_rst_o ),
155
    .cop_irq_o         ( cop_irq_o ),
156
    .cop_event         ( cop_event ),
157
    // inputs
158
    .por_reset_i       ( por_reset_i ),
159
    .async_rst_b       ( async_rst_b ),
160
    .sync_reset        ( sync_reset ),
161
    .startup_osc_i     ( startup_osc_i ),
162
    .bus_clk           ( wb_clk_i ),
163
    .reload_count      ( reload_count ),
164
    .clear_event       ( clear_event ),
165
    .debug_ena         ( debug_ena ),
166
    .debug_mode_i      ( debug_mode_i ),
167
    .wait_ena          ( wait_ena ),
168
    .wait_mode_i       ( wait_mode_i ),
169
    .stop_ena          ( stop_ena ),
170
    .stop_mode_i       ( stop_mode_i ),
171
    .cop_ena           ( cop_ena ),
172
    .cop_irq_en        ( cop_irq_en ),
173
    .timeout_value     ( timeout_value ),
174
    .scantestmode      ( scantestmode )
175
  );
176
 
177
endmodule // cop_top

powered by: WebSVN 2.1.0

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