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

Subversion Repositories dbg_interface

[/] [dbg_interface/] [tags/] [rel_1/] [rtl/] [verilog/] [dbg_registers.v] - Blame information for rev 5

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

powered by: WebSVN 2.1.0

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