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 12

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

powered by: WebSVN 2.1.0

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