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 44

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

powered by: WebSVN 2.1.0

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