1 |
746 |
lampret |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// dbg_defines.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 |
|
|
// Revision 1.8 2002/01/25 07:58:34 mohor
|
49 |
|
|
// IDCODE bug fixed, chains reused to decreas size of core. Data is shifted-in
|
50 |
|
|
// not filled-in. Tested in hw.
|
51 |
|
|
//
|
52 |
|
|
// Revision 1.7 2001/12/06 10:08:06 mohor
|
53 |
|
|
// Warnings from synthesys tools fixed.
|
54 |
|
|
//
|
55 |
|
|
// Revision 1.6 2001/11/28 09:38:30 mohor
|
56 |
|
|
// Trace disabled by default.
|
57 |
|
|
//
|
58 |
|
|
// Revision 1.5 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 |
|
|
// Revision 1.4 2001/09/24 14:06:42 mohor
|
63 |
|
|
// Changes connected to the OpenRISC access (SPR read, SPR write).
|
64 |
|
|
//
|
65 |
|
|
// Revision 1.3 2001/09/20 10:11:25 mohor
|
66 |
|
|
// Working version. Few bugs fixed, comments added.
|
67 |
|
|
//
|
68 |
|
|
// Revision 1.2 2001/09/18 14:13:47 mohor
|
69 |
|
|
// Trace fixed. Some registers changed, trace simplified.
|
70 |
|
|
//
|
71 |
|
|
// Revision 1.1.1.1 2001/09/13 13:49:19 mohor
|
72 |
|
|
// Initial official release.
|
73 |
|
|
//
|
74 |
|
|
// Revision 1.3 2001/06/01 22:22:35 mohor
|
75 |
|
|
// This is a backup. It is not a fully working version. Not for use, yet.
|
76 |
|
|
//
|
77 |
|
|
// Revision 1.2 2001/05/18 13:10:00 mohor
|
78 |
|
|
// Headers changed. All additional information is now avaliable in the README.txt file.
|
79 |
|
|
//
|
80 |
|
|
// Revision 1.1.1.1 2001/05/18 06:35:08 mohor
|
81 |
|
|
// Initial release
|
82 |
|
|
//
|
83 |
|
|
//
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
// Enable TRACE
|
88 |
|
|
//`define TRACE_ENABLED // Uncomment this define to activate the trace
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
// Define IDCODE Value
|
92 |
|
|
`define IDCODE_VALUE 32'hdeadbeef
|
93 |
|
|
|
94 |
|
|
// Define master clock (RISC clock)
|
95 |
|
|
//`define RISC_CLOCK 50 // Half period = 50 ns => MCLK = 10 Mhz
|
96 |
|
|
`define RISC_CLOCK 2.5 // Half period = 5 ns => MCLK = 200 Mhz
|
97 |
|
|
|
98 |
|
|
// Length of the Instruction register
|
99 |
|
|
`define IR_LENGTH 4
|
100 |
|
|
|
101 |
|
|
// Length of the Data register (must be equal to the longest scan chain for shifting the data in)
|
102 |
|
|
`define DR_LENGTH 74
|
103 |
|
|
|
104 |
|
|
// Length of the CHAIN ID register
|
105 |
|
|
`define CHAIN_ID_LENGTH 4
|
106 |
|
|
|
107 |
|
|
// Length of the CRC
|
108 |
|
|
`define CRC_LENGTH 8
|
109 |
|
|
|
110 |
|
|
// Trace buffer size and counter and write/read pointer width. This can be expanded when more RAM is avaliable
|
111 |
|
|
`define TRACECOUNTERWIDTH 5
|
112 |
|
|
`define TRACEBUFFERLENGTH 32 // 2^5
|
113 |
|
|
|
114 |
|
|
`define TRACESAMPLEWIDTH 36
|
115 |
|
|
|
116 |
|
|
// OpSelect width
|
117 |
|
|
`define OPSELECTWIDTH 3
|
118 |
|
|
`define OPSELECTIONCOUNTER 8 //2^3
|
119 |
|
|
|
120 |
|
|
// OpSelect (dbg_op_i) signal meaning
|
121 |
|
|
`define DEBUG_READ_PC 0
|
122 |
|
|
`define DEBUG_READ_LSEA 1
|
123 |
|
|
`define DEBUG_READ_LDATA 2
|
124 |
|
|
`define DEBUG_READ_SDATA 3
|
125 |
|
|
`define DEBUG_READ_SPR 4
|
126 |
|
|
`define DEBUG_WRITE_SPR 5
|
127 |
|
|
`define DEBUG_READ_INSTR 6
|
128 |
|
|
//`define Reserved 7
|
129 |
|
|
|
130 |
|
|
// Supported Instructions
|
131 |
|
|
`define EXTEST 4'b0000
|
132 |
|
|
`define SAMPLE_PRELOAD 4'b0001
|
133 |
|
|
`define IDCODE 4'b0010
|
134 |
|
|
`define CHAIN_SELECT 4'b0011
|
135 |
|
|
`define INTEST 4'b0100
|
136 |
|
|
`define CLAMP 4'b0101
|
137 |
|
|
`define CLAMPZ 4'b0110
|
138 |
|
|
`define HIGHZ 4'b0111
|
139 |
|
|
`define DEBUG 4'b1000
|
140 |
|
|
`define BYPASS 4'b1111
|
141 |
|
|
|
142 |
|
|
// Chains
|
143 |
|
|
`define GLOBAL_BS_CHAIN 4'b0000
|
144 |
|
|
`define RISC_DEBUG_CHAIN 4'b0001
|
145 |
|
|
`define RISC_TEST_CHAIN 4'b0010
|
146 |
|
|
`define TRACE_TEST_CHAIN 4'b0011
|
147 |
|
|
`define REGISTER_SCAN_CHAIN 4'b0100
|
148 |
|
|
`define WISHBONE_SCAN_CHAIN 4'b0101
|
149 |
|
|
|
150 |
|
|
// Registers addresses
|
151 |
|
|
`define MODER_ADR 5'h00
|
152 |
|
|
`define TSEL_ADR 5'h01
|
153 |
|
|
`define QSEL_ADR 5'h02
|
154 |
|
|
`define SSEL_ADR 5'h03
|
155 |
|
|
`define RISCOP_ADR 5'h04
|
156 |
|
|
`define RECSEL_ADR 5'h10
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
// Registers default values (after reset)
|
160 |
|
|
`define MODER_DEF 2'h0
|
161 |
|
|
`define TSEL_DEF 32'h00000000
|
162 |
|
|
`define QSEL_DEF 32'h00000000
|
163 |
|
|
`define SSEL_DEF 32'h00000000
|
164 |
|
|
`define RISCOP_DEF 2'h0
|
165 |
|
|
`define RECSEL_DEF 7'h0
|