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

Subversion Repositories dbg_interface

[/] [dbg_interface/] [tags/] [rel_3/] [rtl/] [verilog/] [dbg_registers.v] - Blame information for rev 158

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mohor
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  dbg_registers.v                                             ////
4
////                                                              ////
5
////                                                              ////
6
////  This file is part of the SoC/OpenRISC Development Interface ////
7
////  http://www.opencores.org/cores/DebugInterface/              ////
8
////                                                              ////
9
////                                                              ////
10
////  Author(s):                                                  ////
11
////       Igor Mohor                                             ////
12
////       igorm@opencores.org                                    ////
13
////                                                              ////
14
////                                                              ////
15
////  All additional information is avaliable in the README.txt   ////
16
////  file.                                                       ////
17
////                                                              ////
18
//////////////////////////////////////////////////////////////////////
19
////                                                              ////
20
//// Copyright (C) 2000,2001 Authors                              ////
21
////                                                              ////
22
//// This source file may be used and distributed without         ////
23
//// restriction provided that this copyright statement is not    ////
24
//// removed from the file and that any derivative work contains  ////
25
//// the original copyright notice and the associated disclaimer. ////
26
////                                                              ////
27
//// This source file is free software; you can redistribute it   ////
28
//// and/or modify it under the terms of the GNU Lesser General   ////
29
//// Public License as published by the Free Software Foundation; ////
30
//// either version 2.1 of the License, or (at your option) any   ////
31
//// later version.                                               ////
32
////                                                              ////
33
//// This source is distributed in the hope that it will be       ////
34
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
35
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
36
//// PURPOSE.  See the GNU Lesser General Public License for more ////
37
//// details.                                                     ////
38
////                                                              ////
39
//// You should have received a copy of the GNU Lesser General    ////
40
//// Public License along with this source; if not, download it   ////
41
//// from http://www.opencores.org/lgpl.shtml                     ////
42
////                                                              ////
43
//////////////////////////////////////////////////////////////////////
44
//
45
// CVS Revision History
46
//
47
// $Log: not supported by cvs2svn $
48 57 simons
// Revision 1.8  2002/10/10 02:42:55  mohor
49
// WISHBONE Scan Chain is changed to reflect state of the WISHBONE access (WBInProgress bit added). Internal counter is used (counts 256 wb_clk cycles) and when counter exceeds that value, wb_cyc_o is negated.
50
//
51 51 mohor
// Revision 1.7  2002/05/07 14:43:59  mohor
52
// mon_cntl_o signals that controls monitor mux added.
53
//
54 47 mohor
// Revision 1.6  2002/04/22 12:54:11  mohor
55
// Signal names changed to lower case.
56
//
57 44 mohor
// Revision 1.5  2001/11/26 10:47:09  mohor
58
// Crc generation is different for read or write commands. Small synthesys fixes.
59
//
60 20 mohor
// Revision 1.4  2001/10/19 11:40:02  mohor
61
// dbg_timescale.v changed to timescale.v This is done for the simulation of
62
// few different cores in a single project.
63
//
64 17 mohor
// Revision 1.3  2001/10/15 09:55:47  mohor
65
// Wishbone interface added, few fixes for better performance,
66
// hooks for boundary scan testing added.
67
//
68 12 mohor
// Revision 1.2  2001/09/18 14:13:47  mohor
69
// Trace fixed. Some registers changed, trace simplified.
70
//
71 5 mohor
// Revision 1.1.1.1  2001/09/13 13:49:19  mohor
72
// Initial official release.
73
//
74 2 mohor
// Revision 1.3  2001/06/01 22:22:35  mohor
75
// This is a backup. It is not a fully working version. Not for use, yet.
76
//
77
// Revision 1.2  2001/05/18 13:10:00  mohor
78
// Headers changed. All additional information is now avaliable in the README.txt file.
79
//
80
// Revision 1.1.1.1  2001/05/18 06:35:10  mohor
81
// Initial release
82
//
83
//
84
 
85 20 mohor
// synopsys translate_off
86 17 mohor
`include "timescale.v"
87 20 mohor
// synopsys translate_on
88 2 mohor
`include "dbg_defines.v"
89
 
90 44 mohor
module dbg_registers(data_in, data_out, address, rw, access, clk, bp, reset,
91 2 mohor
                     `ifdef TRACE_ENABLED
92
                     ContinMode,
93 5 mohor
                     TraceEnable, WpTrigger, BpTrigger, LSSTrigger,
94 2 mohor
                     ITrigger, TriggerOper, WpQualif, BpQualif, LSSQualif, IQualif,
95 5 mohor
                     QualifOper, RecordPC, RecordLSEA, RecordLDATA,
96
                     RecordSDATA, RecordReadSPR, RecordWriteSPR, RecordINSTR,
97 2 mohor
                     WpTriggerValid, BpTriggerValid, LSSTriggerValid, ITriggerValid,
98
                     WpQualifValid, BpQualifValid, LSSQualifValid, IQualifValid,
99
                     WpStop, BpStop, LSSStop, IStop, StopOper, WpStopValid, BpStopValid,
100 5 mohor
                     LSSStopValid, IStopValid,
101 2 mohor
                     `endif
102 57 simons
                     risc_stall, risc_sall_all, risc_sel, risc_reset, mon_cntl_o
103 2 mohor
                    );
104
 
105
parameter Tp = 1;
106
 
107 44 mohor
input [31:0] data_in;
108
input [4:0] address;
109 2 mohor
 
110 44 mohor
input rw;
111
input access;
112
input clk;
113
input bp;
114
input reset;
115 2 mohor
 
116 44 mohor
output [31:0] data_out;
117
reg    [31:0] data_out;
118 2 mohor
 
119
`ifdef TRACE_ENABLED
120
  output ContinMode;
121
  output TraceEnable;
122
 
123
  output [10:0] WpTrigger;
124
  output        BpTrigger;
125
  output [3:0]  LSSTrigger;
126
  output [1:0]  ITrigger;
127
  output [1:0]  TriggerOper;
128
 
129
  output        WpTriggerValid;
130
  output        BpTriggerValid;
131
  output        LSSTriggerValid;
132
  output        ITriggerValid;
133
 
134
  output [10:0] WpQualif;
135
  output        BpQualif;
136
  output [3:0]  LSSQualif;
137
  output [1:0]  IQualif;
138
  output [1:0]  QualifOper;
139
 
140
  output        WpQualifValid;
141
  output        BpQualifValid;
142
  output        LSSQualifValid;
143
  output        IQualifValid;
144
 
145
  output [10:0] WpStop;
146
  output        BpStop;
147
  output [3:0]  LSSStop;
148
  output [1:0]  IStop;
149
  output [1:0]  StopOper;
150
 
151
  output WpStopValid;
152
  output BpStopValid;
153
  output LSSStopValid;
154
  output IStopValid;
155
 
156 5 mohor
  output RecordPC;
157
  output RecordLSEA;
158
  output RecordLDATA;
159
  output RecordSDATA;
160
  output RecordReadSPR;
161
  output RecordWriteSPR;
162
  output RecordINSTR;
163 2 mohor
`endif
164
 
165 44 mohor
  output risc_stall;
166 57 simons
  output risc_stall_all;
167
  output [`RISC_NUM-1:0] risc_sel;
168 44 mohor
  output risc_reset;
169 47 mohor
  output [3:0] mon_cntl_o;
170 5 mohor
 
171 47 mohor
  wire MODER_Acc     = (address == `MODER_ADR)    & access;
172
  wire RISCOP_Acc    = (address == `RISCOP_ADR)   & access;
173 57 simons
  wire RISCSEL_Acc   = (address == `RISCSEL_ADR)  & access;
174 47 mohor
  wire MON_CNTL_Acc  = (address == `MON_CNTL_ADR) & access;
175 2 mohor
`ifdef TRACE_ENABLED
176 47 mohor
  wire TSEL_Acc      = (address == `TSEL_ADR)     & access;
177
  wire QSEL_Acc      = (address == `QSEL_ADR)     & access;
178
  wire SSEL_Acc      = (address == `SSEL_ADR)     & access;
179
  wire RECSEL_Acc    = (address == `RECSEL_ADR)   & access;
180 5 mohor
`endif
181
 
182 2 mohor
 
183 47 mohor
  wire MODER_Wr      = MODER_Acc    &  rw;
184
  wire RISCOP_Wr     = RISCOP_Acc   &  rw;
185 57 simons
  wire RISCSEL_Wr    = RISCSEL_Acc  &  rw;
186 47 mohor
  wire MON_CNTL_Wr   = MON_CNTL_Acc &  rw;
187 5 mohor
`ifdef TRACE_ENABLED
188 47 mohor
  wire TSEL_Wr       = TSEL_Acc     &  rw;
189
  wire QSEL_Wr       = QSEL_Acc     &  rw;
190
  wire SSEL_Wr       = SSEL_Acc     &  rw;
191
  wire RECSEL_Wr     = RECSEL_Acc   &  rw;
192 5 mohor
`endif
193
 
194
 
195 2 mohor
 
196 47 mohor
  wire MODER_Rd      = MODER_Acc    & ~rw;
197
  wire RISCOP_Rd     = RISCOP_Acc   & ~rw;
198 57 simons
  wire RISCSEL_Rd    = RISCSEL_Acc  & ~rw;
199 47 mohor
  wire MON_CNTL_Rd   = MON_CNTL_Acc & ~rw;
200 5 mohor
`ifdef TRACE_ENABLED
201 47 mohor
  wire TSEL_Rd       = TSEL_Acc     & ~rw;
202
  wire QSEL_Rd       = QSEL_Acc     & ~rw;
203
  wire SSEL_Rd       = SSEL_Acc     & ~rw;
204
  wire RECSEL_Rd     = RECSEL_Acc   & ~rw;
205 2 mohor
`endif
206
 
207
 
208 57 simons
  wire [31:0]           MODEROut;
209
  wire [2:1]            RISCOPOut;
210
  wire [`RISC_NUM-1:0]  RISCSELOut;
211
  wire [3:0]            MONCNTLOut;
212 5 mohor
 
213 2 mohor
`ifdef TRACE_ENABLED
214 57 simons
  wire [31:0]           TSELOut;
215
  wire [31:0]           QSELOut;
216
  wire [31:0]           SSELOut;
217
  wire [6:0]            RECSELOut;
218 2 mohor
`endif
219
 
220
 
221
`ifdef TRACE_ENABLED
222 5 mohor
  assign MODEROut[15:0] = 16'h0001;
223
  assign MODEROut[31:18] = 14'h0;
224
`else
225
  assign MODEROut[31:0] = 32'h0000;
226 2 mohor
`endif
227
 
228
 
229 12 mohor
  reg RiscStallBp;
230 44 mohor
  always @(posedge clk or posedge reset)
231 12 mohor
  begin
232 44 mohor
    if(reset)
233 12 mohor
      RiscStallBp <= 1'b0;
234
    else
235 44 mohor
    if(bp)                      // Breakpoint sets bit
236 12 mohor
      RiscStallBp <= 1'b1;
237
    else
238
    if(RISCOP_Wr)               // Register access can set or clear bit
239 44 mohor
      RiscStallBp <= data_in[0];
240 12 mohor
  end
241 5 mohor
 
242 57 simons
  dbg_register #(2, 0)  RISCOP  (.data_in(data_in[2:1]),   .data_out(RISCOPOut[2:1]),    .write(RISCOP_Wr),   .clk(clk), .reset(reset));
243
  dbg_register #(`RISC_NUM, 0)  RISCSEL  (.data_in(data_in[`RISC_NUM-1:0]),   .data_out(RISCSELOut),    .write(RISCSEL_Wr),   .clk(clk), .reset(reset));
244 51 mohor
  dbg_register #(4, `MON_CNTL_DEF)  MONCNTL (.data_in(data_in[3:0]), .data_out(MONCNTLOut[3:0]), .write(MON_CNTL_Wr), .clk(clk), .reset(reset));
245 12 mohor
 
246
 
247 2 mohor
`ifdef TRACE_ENABLED
248 51 mohor
  dbg_register #(2, `MODER_DEF)  MODER  (.data_in(data_in[17:16]), .data_out(MODEROut[17:16]), .write(MODER_Wr),   .clk(clk), .reset(reset));
249
  dbg_register #(32, `TSEL_DEF) TSEL   (.data_in(data_in),      .data_out(TSELOut),    .write(TSEL_Wr),    .clk(clk), .reset(reset));
250
  dbg_register #(32, `QSEL_DEF) QSEL   (.data_in(data_in),      .data_out(QSELOut),    .write(QSEL_Wr),    .clk(clk), .reset(reset));
251
  dbg_register #(32, `SSEL_DEF) SSEL   (.data_in(data_in),      .data_out(SSELOut),    .write(SSEL_Wr),    .clk(clk), .reset(reset));
252
  dbg_register #(7, `RECSEL_DEF) RECSEL  (.data_in(data_in[6:0]), .data_out(RECSELOut),  .write(RECSEL_Wr),  .clk(clk), .reset(reset));
253 5 mohor
`endif
254
 
255
 
256
 
257 44 mohor
always @ (posedge clk)
258 2 mohor
begin
259 44 mohor
  if(MODER_Rd)    data_out<= #Tp MODEROut;
260 2 mohor
  else
261 57 simons
  if(RISCOP_Rd)   data_out<= #Tp {29'h0, RISCOPOut[2:1], risc_stall};
262 47 mohor
  else
263 57 simons
  if(RISCSEL_Rd)  data_out<= #Tp {{(32-`RISC_NUM){1'b0}}, RISCSELOut};
264
  else
265 47 mohor
  if(MON_CNTL_Rd) data_out<= #Tp {28'h0, MONCNTLOut};
266 5 mohor
`ifdef TRACE_ENABLED
267
  else
268 44 mohor
  if(TSEL_Rd)     data_out<= #Tp TSELOut;
269 2 mohor
  else
270 44 mohor
  if(QSEL_Rd)     data_out<= #Tp QSELOut;
271 2 mohor
  else
272 44 mohor
  if(SSEL_Rd)     data_out<= #Tp SSELOut;
273 2 mohor
  else
274 44 mohor
  if(RECSEL_Rd)   data_out<= #Tp {25'h0, RECSELOut};
275 5 mohor
`endif
276 44 mohor
  else            data_out<= #Tp 'h0;
277 2 mohor
end
278
 
279
`ifdef TRACE_ENABLED
280 5 mohor
  assign TraceEnable       = MODEROut[16];
281
  assign ContinMode        = MODEROut[17];
282 2 mohor
 
283
  assign WpTrigger[10:0]   = TSELOut[10:0];
284
  assign WpTriggerValid    = TSELOut[11];
285
  assign BpTrigger         = TSELOut[12];
286
  assign BpTriggerValid    = TSELOut[13];
287
  assign LSSTrigger[3:0]   = TSELOut[19:16];
288
  assign LSSTriggerValid   = TSELOut[20];
289
  assign ITrigger[1:0]     = TSELOut[22:21];
290
  assign ITriggerValid     = TSELOut[23];
291
  assign TriggerOper[1:0]  = TSELOut[31:30];
292
 
293
  assign WpQualif[10:0]    = QSELOut[10:0];
294
  assign WpQualifValid     = QSELOut[11];
295
  assign BpQualif          = QSELOut[12];
296
  assign BpQualifValid     = QSELOut[13];
297
  assign LSSQualif[3:0]    = QSELOut[19:16];
298
  assign LSSQualifValid    = QSELOut[20];
299
  assign IQualif[1:0]      = QSELOut[22:21];
300
  assign IQualifValid      = QSELOut[23];
301
  assign QualifOper[1:0]   = QSELOut[31:30];
302
 
303
  assign WpStop[10:0]    = SSELOut[10:0];
304
  assign WpStopValid     = SSELOut[11];
305
  assign BpStop          = SSELOut[12];
306
  assign BpStopValid     = SSELOut[13];
307
  assign LSSStop[3:0]    = SSELOut[19:16];
308
  assign LSSStopValid    = SSELOut[20];
309
  assign IStop[1:0]      = SSELOut[22:21];
310
  assign IStopValid      = SSELOut[23];
311
  assign StopOper[1:0]   = SSELOut[31:30];
312
 
313
 
314 5 mohor
  assign RecordPC           = RECSELOut[0];
315
  assign RecordLSEA         = RECSELOut[1];
316
  assign RecordLDATA        = RECSELOut[2];
317
  assign RecordSDATA        = RECSELOut[3];
318
  assign RecordReadSPR      = RECSELOut[4];
319
  assign RecordWriteSPR     = RECSELOut[5];
320
  assign RecordINSTR        = RECSELOut[6];
321 2 mohor
`endif
322
 
323 44 mohor
  assign risc_stall          = bp | RiscStallBp;   // bp asynchronously sets the risc_stall, then RiscStallBp (from register) holds it active
324 57 simons
  assign risc_stall_all      = RISCOPOut[2];       // this signal is used to stall all the cpus except the one that is selected in riscsel register
325
  assign risc_sel            = RISCSELOut;
326 44 mohor
  assign risc_reset          = RISCOPOut[1];
327 47 mohor
  assign mon_cntl_o          = MONCNTLOut;
328 2 mohor
 
329
endmodule

powered by: WebSVN 2.1.0

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