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

Subversion Repositories dbg_interface

[/] [dbg_interface/] [tags/] [sdram_test_working/] [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 47 mohor
// Revision 1.6  2002/04/22 12:54:11  mohor
49
// Signal names changed to lower case.
50
//
51 44 mohor
// Revision 1.5  2001/11/26 10:47:09  mohor
52
// Crc generation is different for read or write commands. Small synthesys fixes.
53
//
54 20 mohor
// Revision 1.4  2001/10/19 11:40:02  mohor
55
// dbg_timescale.v changed to timescale.v This is done for the simulation of
56
// few different cores in a single project.
57
//
58 17 mohor
// Revision 1.3  2001/10/15 09:55:47  mohor
59
// Wishbone interface added, few fixes for better performance,
60
// hooks for boundary scan testing added.
61
//
62 12 mohor
// Revision 1.2  2001/09/18 14:13:47  mohor
63
// Trace fixed. Some registers changed, trace simplified.
64
//
65 5 mohor
// Revision 1.1.1.1  2001/09/13 13:49:19  mohor
66
// Initial official release.
67
//
68 2 mohor
// Revision 1.3  2001/06/01 22:22:35  mohor
69
// This is a backup. It is not a fully working version. Not for use, yet.
70
//
71
// Revision 1.2  2001/05/18 13:10:00  mohor
72
// Headers changed. All additional information is now avaliable in the README.txt file.
73
//
74
// Revision 1.1.1.1  2001/05/18 06:35:10  mohor
75
// Initial release
76
//
77
//
78
 
79 20 mohor
// synopsys translate_off
80 17 mohor
`include "timescale.v"
81 20 mohor
// synopsys translate_on
82 2 mohor
`include "dbg_defines.v"
83
 
84 44 mohor
module dbg_registers(data_in, data_out, address, rw, access, clk, bp, reset,
85 2 mohor
                     `ifdef TRACE_ENABLED
86
                     ContinMode,
87 5 mohor
                     TraceEnable, WpTrigger, BpTrigger, LSSTrigger,
88 2 mohor
                     ITrigger, TriggerOper, WpQualif, BpQualif, LSSQualif, IQualif,
89 5 mohor
                     QualifOper, RecordPC, RecordLSEA, RecordLDATA,
90
                     RecordSDATA, RecordReadSPR, RecordWriteSPR, RecordINSTR,
91 2 mohor
                     WpTriggerValid, BpTriggerValid, LSSTriggerValid, ITriggerValid,
92
                     WpQualifValid, BpQualifValid, LSSQualifValid, IQualifValid,
93
                     WpStop, BpStop, LSSStop, IStop, StopOper, WpStopValid, BpStopValid,
94 5 mohor
                     LSSStopValid, IStopValid,
95 2 mohor
                     `endif
96 47 mohor
                     risc_stall, risc_reset, mon_cntl_o
97 2 mohor
                    );
98
 
99
parameter Tp = 1;
100
 
101 44 mohor
input [31:0] data_in;
102
input [4:0] address;
103 2 mohor
 
104 44 mohor
input rw;
105
input access;
106
input clk;
107
input bp;
108
input reset;
109 2 mohor
 
110 44 mohor
output [31:0] data_out;
111
reg    [31:0] data_out;
112 2 mohor
 
113
`ifdef TRACE_ENABLED
114
  output ContinMode;
115
  output TraceEnable;
116
 
117
  output [10:0] WpTrigger;
118
  output        BpTrigger;
119
  output [3:0]  LSSTrigger;
120
  output [1:0]  ITrigger;
121
  output [1:0]  TriggerOper;
122
 
123
  output        WpTriggerValid;
124
  output        BpTriggerValid;
125
  output        LSSTriggerValid;
126
  output        ITriggerValid;
127
 
128
  output [10:0] WpQualif;
129
  output        BpQualif;
130
  output [3:0]  LSSQualif;
131
  output [1:0]  IQualif;
132
  output [1:0]  QualifOper;
133
 
134
  output        WpQualifValid;
135
  output        BpQualifValid;
136
  output        LSSQualifValid;
137
  output        IQualifValid;
138
 
139
  output [10:0] WpStop;
140
  output        BpStop;
141
  output [3:0]  LSSStop;
142
  output [1:0]  IStop;
143
  output [1:0]  StopOper;
144
 
145
  output WpStopValid;
146
  output BpStopValid;
147
  output LSSStopValid;
148
  output IStopValid;
149
 
150 5 mohor
  output RecordPC;
151
  output RecordLSEA;
152
  output RecordLDATA;
153
  output RecordSDATA;
154
  output RecordReadSPR;
155
  output RecordWriteSPR;
156
  output RecordINSTR;
157 2 mohor
`endif
158
 
159 44 mohor
  output risc_stall;
160
  output risc_reset;
161 47 mohor
  output [3:0] mon_cntl_o;
162 5 mohor
 
163 47 mohor
  wire MODER_Acc     = (address == `MODER_ADR)    & access;
164
  wire RISCOP_Acc    = (address == `RISCOP_ADR)   & access;
165
  wire MON_CNTL_Acc  = (address == `MON_CNTL_ADR) & access;
166 2 mohor
`ifdef TRACE_ENABLED
167 47 mohor
  wire TSEL_Acc      = (address == `TSEL_ADR)     & access;
168
  wire QSEL_Acc      = (address == `QSEL_ADR)     & access;
169
  wire SSEL_Acc      = (address == `SSEL_ADR)     & access;
170
  wire RECSEL_Acc    = (address == `RECSEL_ADR)   & access;
171 5 mohor
`endif
172
 
173 2 mohor
 
174 47 mohor
  wire MODER_Wr      = MODER_Acc    &  rw;
175
  wire RISCOP_Wr     = RISCOP_Acc   &  rw;
176
  wire MON_CNTL_Wr   = MON_CNTL_Acc &  rw;
177 5 mohor
`ifdef TRACE_ENABLED
178 47 mohor
  wire TSEL_Wr       = TSEL_Acc     &  rw;
179
  wire QSEL_Wr       = QSEL_Acc     &  rw;
180
  wire SSEL_Wr       = SSEL_Acc     &  rw;
181
  wire RECSEL_Wr     = RECSEL_Acc   &  rw;
182 5 mohor
`endif
183
 
184
 
185 2 mohor
 
186 47 mohor
  wire MODER_Rd      = MODER_Acc    & ~rw;
187
  wire RISCOP_Rd     = RISCOP_Acc   & ~rw;
188
  wire MON_CNTL_Rd   = MON_CNTL_Acc & ~rw;
189 5 mohor
`ifdef TRACE_ENABLED
190 47 mohor
  wire TSEL_Rd       = TSEL_Acc     & ~rw;
191
  wire QSEL_Rd       = QSEL_Acc     & ~rw;
192
  wire SSEL_Rd       = SSEL_Acc     & ~rw;
193
  wire RECSEL_Rd     = RECSEL_Acc   & ~rw;
194 2 mohor
`endif
195
 
196
 
197 5 mohor
  wire [31:0] MODEROut;
198 12 mohor
  wire [1:1]  RISCOPOut;
199 47 mohor
  wire [3:0]  MONCNTLOut;
200 5 mohor
 
201 2 mohor
`ifdef TRACE_ENABLED
202
  wire [31:0] TSELOut;
203
  wire [31:0] QSELOut;
204
  wire [31:0] SSELOut;
205 5 mohor
  wire [6:0]  RECSELOut;
206 2 mohor
`endif
207
 
208
 
209
`ifdef TRACE_ENABLED
210 5 mohor
  assign MODEROut[15:0] = 16'h0001;
211
  assign MODEROut[31:18] = 14'h0;
212
`else
213
  assign MODEROut[31:0] = 32'h0000;
214 2 mohor
`endif
215
 
216
 
217 12 mohor
  reg RiscStallBp;
218 44 mohor
  always @(posedge clk or posedge reset)
219 12 mohor
  begin
220 44 mohor
    if(reset)
221 12 mohor
      RiscStallBp <= 1'b0;
222
    else
223 44 mohor
    if(bp)                      // Breakpoint sets bit
224 12 mohor
      RiscStallBp <= 1'b1;
225
    else
226
    if(RISCOP_Wr)               // Register access can set or clear bit
227 44 mohor
      RiscStallBp <= data_in[0];
228 12 mohor
  end
229 5 mohor
 
230 47 mohor
  dbg_register #(1)  RISCOP  (.data_in(data_in[1]),   .data_out(RISCOPOut[1]),    .write(RISCOP_Wr),   .clk(clk), .reset(reset), .defaulty(1'b0));
231
  dbg_register #(4)  MONCNTL (.data_in(data_in[3:0]), .data_out(MONCNTLOut[3:0]), .write(MON_CNTL_Wr), .clk(clk), .reset(reset), .defaulty(`MON_CNTL_DEF));
232 12 mohor
 
233
 
234 2 mohor
`ifdef TRACE_ENABLED
235 44 mohor
  dbg_register #(2)  MODER  (.data_in(data_in[17:16]), .data_out(MODEROut[17:16]), .write(MODER_Wr),   .clk(clk), .reset(reset), .defaulty(`MODER_DEF));
236
  dbg_register #(32) TSEL   (.data_in(data_in),      .data_out(TSELOut),    .write(TSEL_Wr),    .clk(clk), .reset(reset), .defaulty(`TSEL_DEF));
237
  dbg_register #(32) QSEL   (.data_in(data_in),      .data_out(QSELOut),    .write(QSEL_Wr),    .clk(clk), .reset(reset), .defaulty(`QSEL_DEF));
238
  dbg_register #(32) SSEL   (.data_in(data_in),      .data_out(SSELOut),    .write(SSEL_Wr),    .clk(clk), .reset(reset), .defaulty(`SSEL_DEF));
239
  dbg_register #(7) RECSEL  (.data_in(data_in[6:0]), .data_out(RECSELOut),  .write(RECSEL_Wr),  .clk(clk), .reset(reset), .defaulty(`RECSEL_DEF));
240 5 mohor
`endif
241
 
242
 
243
 
244 44 mohor
always @ (posedge clk)
245 2 mohor
begin
246 44 mohor
  if(MODER_Rd)    data_out<= #Tp MODEROut;
247 2 mohor
  else
248 44 mohor
  if(RISCOP_Rd)   data_out<= #Tp {30'h0, RISCOPOut[1], risc_stall};
249 47 mohor
  else
250
  if(MON_CNTL_Rd) data_out<= #Tp {28'h0, MONCNTLOut};
251 5 mohor
`ifdef TRACE_ENABLED
252
  else
253 44 mohor
  if(TSEL_Rd)     data_out<= #Tp TSELOut;
254 2 mohor
  else
255 44 mohor
  if(QSEL_Rd)     data_out<= #Tp QSELOut;
256 2 mohor
  else
257 44 mohor
  if(SSEL_Rd)     data_out<= #Tp SSELOut;
258 2 mohor
  else
259 44 mohor
  if(RECSEL_Rd)   data_out<= #Tp {25'h0, RECSELOut};
260 5 mohor
`endif
261 44 mohor
  else            data_out<= #Tp 'h0;
262 2 mohor
end
263
 
264
`ifdef TRACE_ENABLED
265 5 mohor
  assign TraceEnable       = MODEROut[16];
266
  assign ContinMode        = MODEROut[17];
267 2 mohor
 
268
  assign WpTrigger[10:0]   = TSELOut[10:0];
269
  assign WpTriggerValid    = TSELOut[11];
270
  assign BpTrigger         = TSELOut[12];
271
  assign BpTriggerValid    = TSELOut[13];
272
  assign LSSTrigger[3:0]   = TSELOut[19:16];
273
  assign LSSTriggerValid   = TSELOut[20];
274
  assign ITrigger[1:0]     = TSELOut[22:21];
275
  assign ITriggerValid     = TSELOut[23];
276
  assign TriggerOper[1:0]  = TSELOut[31:30];
277
 
278
  assign WpQualif[10:0]    = QSELOut[10:0];
279
  assign WpQualifValid     = QSELOut[11];
280
  assign BpQualif          = QSELOut[12];
281
  assign BpQualifValid     = QSELOut[13];
282
  assign LSSQualif[3:0]    = QSELOut[19:16];
283
  assign LSSQualifValid    = QSELOut[20];
284
  assign IQualif[1:0]      = QSELOut[22:21];
285
  assign IQualifValid      = QSELOut[23];
286
  assign QualifOper[1:0]   = QSELOut[31:30];
287
 
288
  assign WpStop[10:0]    = SSELOut[10:0];
289
  assign WpStopValid     = SSELOut[11];
290
  assign BpStop          = SSELOut[12];
291
  assign BpStopValid     = SSELOut[13];
292
  assign LSSStop[3:0]    = SSELOut[19:16];
293
  assign LSSStopValid    = SSELOut[20];
294
  assign IStop[1:0]      = SSELOut[22:21];
295
  assign IStopValid      = SSELOut[23];
296
  assign StopOper[1:0]   = SSELOut[31:30];
297
 
298
 
299 5 mohor
  assign RecordPC           = RECSELOut[0];
300
  assign RecordLSEA         = RECSELOut[1];
301
  assign RecordLDATA        = RECSELOut[2];
302
  assign RecordSDATA        = RECSELOut[3];
303
  assign RecordReadSPR      = RECSELOut[4];
304
  assign RecordWriteSPR     = RECSELOut[5];
305
  assign RecordINSTR        = RECSELOut[6];
306 2 mohor
`endif
307
 
308 44 mohor
  assign risc_stall          = bp | RiscStallBp;   // bp asynchronously sets the risc_stall, then RiscStallBp (from register) holds it active
309
  assign risc_reset          = RISCOPOut[1];
310 47 mohor
  assign mon_cntl_o          = MONCNTLOut;
311 2 mohor
 
312
endmodule

powered by: WebSVN 2.1.0

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