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 17

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

powered by: WebSVN 2.1.0

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