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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [Projects/] [opencores.org/] [adv_debug_sys/] [Hardware/] [adv_dbg_if/] [rtl/] [verilog/] [adbg_jfifo.v] - Blame information for rev 131

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 131 jt_eaton
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  adbg_top.v                                                  ////
4
////                                                              ////
5
////                                                              ////
6
////  This file is part of the SoC Advanced Debug Interface.      ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////       Nathan Yawn (nathan.yawn@opencores.org)                ////
10
////                                                              ////
11
////                                                              ////
12
////                                                              ////
13
//////////////////////////////////////////////////////////////////////
14
////                                                              ////
15
//// Copyright (C) 2008-2010 Authors                              ////
16
////                                                              ////
17
//// This source file may be used and distributed without         ////
18
//// restriction provided that this copyright statement is not    ////
19
//// removed from the file and that any derivative work contains  ////
20
//// the original copyright notice and the associated disclaimer. ////
21
////                                                              ////
22
//// This source file is free software; you can redistribute it   ////
23
//// and/or modify it under the terms of the GNU Lesser General   ////
24
//// Public License as published by the Free Software Foundation; ////
25
//// either version 2.1 of the License, or (at your option) any   ////
26
//// later version.                                               ////
27
////                                                              ////
28
//// This source is distributed in the hope that it will be       ////
29
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
30
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
31
//// PURPOSE.  See the GNU Lesser General Public License for more ////
32
//// details.                                                     ////
33
////                                                              ////
34
//// You should have received a copy of the GNU Lesser General    ////
35
//// Public License along with this source; if not, download it   ////
36
//// from http://www.opencores.org/lgpl.shtml                     ////
37
////                                                              ////
38
//////////////////////////////////////////////////////////////////////
39
 
40
 
41
 
42
 
43
 
44
// Top module
45
module `VARIANT (
46
                // JTAG signals
47
                tck_i,
48
                tdi_i,
49
                tdo_o,
50
                rst_i,
51
 
52
 
53
                // TAP states
54
                shift_dr_i,
55
                update_dr_i,
56
                capture_dr_i,
57
 
58
                // Instructions
59
                debug_select_i
60
 
61
 
62
                ,
63
                wb_clk_i,
64
 
65
                // WISHBONE target interface
66
                wb_jsp_dat_i,
67
                wb_jsp_stb_i,
68
                biu_wr_strobe,
69
                jsp_data_out
70
 
71
 
72
                );
73
 
74
 
75
   // JTAG signals
76
   input   tck_i;
77
   input   tdi_i;
78
   output  tdo_o;
79
   input   rst_i;
80
 
81
   // TAP states
82
   input   shift_dr_i;
83
   input   update_dr_i;
84
   input   capture_dr_i;
85
 
86
   // Module select from TAP
87
   input   debug_select_i;
88
 
89
 
90
 
91
 
92
 
93
 
94
 
95
   input   wb_clk_i;
96
 
97
   input [7:0]  wb_jsp_dat_i;
98
   input         wb_jsp_stb_i;
99
   output        biu_wr_strobe;
100
   output [7:0]   jsp_data_out;
101
 
102
 
103
   reg           tdo_o;
104
   wire          tdo_wb;
105
   wire          tdo_cpu0;
106
   wire          tdo_cpu1;
107
   wire          tdo_jsp;
108
 
109
   // Registers
110
   reg [`DBG_TOP_MODULE_DATA_LEN-1:0] input_shift_reg;  // 1 bit sel/cmd, 4 bit opcode, 32 bit address, 16 bit length = 53 bits
111
   //reg output_shift_reg;  // Just 1 bit for status (valid module selected)
112
   reg [`DBG_TOP_MODULE_ID_LENGTH -1:0] module_id_reg;   // Module selection register
113
 
114
 
115
   // Control signals
116
   wire                                       select_cmd;  // True when the command (registered at Update_DR) is for top level/module selection
117
   wire [(`DBG_TOP_MODULE_ID_LENGTH - 1) : 0] module_id_in;    // The part of the input_shift_register to be used as the module select data
118
   reg [(`DBG_TOP_MAX_MODULES - 1) : 0]       module_selects;  // Select signals for the individual modules
119
   wire                                       select_inhibit;  // OR of inhibit signals from sub-modules, prevents latching of a new module ID
120
   wire [3:0]                                  module_inhibit;  // signals to allow submodules to prevent top level from latching new module ID
121
 
122
   ///////////////////////////////////////
123
   // Combinatorial assignments
124
 
125
assign select_cmd = input_shift_reg[52];
126
assign module_id_in = input_shift_reg[51:50];
127
 
128
//////////////////////////////////////////////////////////
129
// Module select register and select signals
130
 
131
always @ (posedge tck_i or posedge rst_i)
132
begin
133
  if (rst_i)                             module_id_reg <= 2'b0;
134
  else if(debug_select_i && select_cmd && update_dr_i && !select_inhibit)       // Chain select
135
    module_id_reg <= module_id_in;
136
end
137
 
138
 
139
always @ (module_id_reg)
140
begin
141
        module_selects                 = `DBG_TOP_MAX_MODULES'h0;
142
        module_selects[module_id_reg]  = 1'b1;
143
end
144
 
145
///////////////////////////////////////////////
146
// Data input shift register
147
 
148
always @ (posedge tck_i or posedge rst_i)
149
begin
150
  if (rst_i)
151
    input_shift_reg <= 53'h0;
152
  else if(debug_select_i && shift_dr_i)
153
    input_shift_reg <= {tdi_i, input_shift_reg[52:1]};
154
end
155
 
156
 
157
//////////////////////////////////////////////
158
// Debug module instantiations
159
 
160
assign tdo_wb = 1'b0;
161
assign module_inhibit[`DBG_TOP_WISHBONE_DEBUG_MODULE] = 1'b0;
162
 
163
 
164
 
165
 
166
assign tdo_cpu0 = 1'b0;
167
assign module_inhibit[`DBG_TOP_CPU0_DEBUG_MODULE] = 1'b0;
168
 
169
 
170
 
171
 
172
assign tdo_cpu1 = 1'b0;
173
assign module_inhibit[`DBG_TOP_CPU1_DEBUG_MODULE] = 1'b0;
174
 
175
 
176
 
177
`VARIANT`JFIFO_MODULE i_dbg_jfifo (
178
                  // JTAG signals
179
                  .tck_i            (tck_i),
180
                  .module_tdo_o     (tdo_jsp),
181
                  .tdi_i            (tdi_i),
182
 
183
                  // TAP states
184
                  .capture_dr_i     (capture_dr_i),
185
                  .shift_dr_i       (shift_dr_i),
186
                  .update_dr_i      (update_dr_i),
187
 
188
                  .data_register_i  (input_shift_reg),
189
                  .module_select_i  (debug_select_i),
190
//                  .module_select_i  (module_selects[`DBG_TOP_JSP_DEBUG_MODULE]),
191
                  .rst_i            (rst_i),
192
 
193
                  // WISHBONE common signals
194
                  .wb_clk_i         (wb_clk_i),
195
 
196
                  // WISHBONE master interface
197
                  .wb_dat_i         (wb_jsp_dat_i),
198
                  .wb_stb_i         (wb_jsp_stb_i),
199
                  .biu_wr_strobe    (biu_wr_strobe),
200
                  .jsp_data_out     (jsp_data_out)
201
            );
202
 
203
 
204
 
205
assign select_inhibit = |module_inhibit;
206
 
207
 
208
assign module_inhibit[`DBG_TOP_JSP_DEBUG_MODULE] = 1'b0;
209
 
210
/////////////////////////////////////////////////
211
// TDO output MUX
212
 
213
always @ (*)
214
begin
215
   case (debug_select_i)
216
             1:       tdo_o = tdo_jsp;
217
       default:       tdo_o = 1'b0;
218
   endcase
219
end
220
 
221
 
222
endmodule

powered by: WebSVN 2.1.0

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