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

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [Altera/] [ip.hwp.cpu/] [nios_ii_sram/] [1.0/] [hdl/] [cpu_0_jtag_debug_module_tck.v] - Blame information for rev 154

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 147 lanttu
//Legal Notice: (C)2012 Altera Corporation. All rights reserved.  Your
2
//use of Altera Corporation's design tools, logic functions and other
3
//software and tools, and its AMPP partner logic functions, and any
4
//output files any of the foregoing (including device programming or
5
//simulation files), and any associated documentation or information are
6
//expressly subject to the terms and conditions of the Altera Program
7
//License Subscription Agreement or other applicable license agreement,
8
//including, without limitation, that your use is for the sole purpose
9
//of programming logic devices manufactured by Altera and sold by Altera
10
//or its authorized distributors.  Please refer to the applicable
11
//agreement for further details.
12
 
13
// synthesis translate_off
14
`timescale 1ns / 1ps
15
// synthesis translate_on
16
 
17
// turn off superfluous verilog processor warnings 
18
// altera message_level Level1 
19
// altera message_off 10034 10035 10036 10037 10230 10240 10030 
20
 
21
module cpu_0_jtag_debug_module_tck (
22
                                     // inputs:
23
                                      MonDReg,
24
                                      break_readreg,
25
                                      dbrk_hit0_latch,
26
                                      dbrk_hit1_latch,
27
                                      dbrk_hit2_latch,
28
                                      dbrk_hit3_latch,
29
                                      debugack,
30
                                      ir_in,
31
                                      jtag_state_rti,
32
                                      monitor_error,
33
                                      monitor_ready,
34
                                      reset_n,
35
                                      resetlatch,
36
                                      tck,
37
                                      tdi,
38
                                      tracemem_on,
39
                                      tracemem_trcdata,
40
                                      tracemem_tw,
41
                                      trc_im_addr,
42
                                      trc_on,
43
                                      trc_wrap,
44
                                      trigbrktype,
45
                                      trigger_state_1,
46
                                      vs_cdr,
47
                                      vs_sdr,
48
                                      vs_uir,
49
 
50
                                     // outputs:
51
                                      ir_out,
52
                                      jrst_n,
53
                                      sr,
54
                                      st_ready_test_idle,
55
                                      tdo
56
                                   )
57
;
58
 
59
  output  [  1: 0] ir_out;
60
  output           jrst_n;
61
  output  [ 37: 0] sr;
62
  output           st_ready_test_idle;
63
  output           tdo;
64
  input   [ 31: 0] MonDReg;
65
  input   [ 31: 0] break_readreg;
66
  input            dbrk_hit0_latch;
67
  input            dbrk_hit1_latch;
68
  input            dbrk_hit2_latch;
69
  input            dbrk_hit3_latch;
70
  input            debugack;
71
  input   [  1: 0] ir_in;
72
  input            jtag_state_rti;
73
  input            monitor_error;
74
  input            monitor_ready;
75
  input            reset_n;
76
  input            resetlatch;
77
  input            tck;
78
  input            tdi;
79
  input            tracemem_on;
80
  input   [ 35: 0] tracemem_trcdata;
81
  input            tracemem_tw;
82
  input   [  6: 0] trc_im_addr;
83
  input            trc_on;
84
  input            trc_wrap;
85
  input            trigbrktype;
86
  input            trigger_state_1;
87
  input            vs_cdr;
88
  input            vs_sdr;
89
  input            vs_uir;
90
 
91
  reg     [  2: 0] DRsize /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\""  */;
92
  wire             debugack_sync;
93
  reg     [  1: 0] ir_out;
94
  wire             jrst_n;
95
  wire             monitor_ready_sync;
96
  reg     [ 37: 0] sr /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\""  */;
97
  wire             st_ready_test_idle;
98
  wire             tdo;
99
  wire             unxcomplemented_resetxx0;
100
  wire             unxcomplemented_resetxx1;
101
  always @(posedge tck)
102
    begin
103
      if (vs_cdr)
104
          case (ir_in)
105
 
106
              2'b00: begin
107
                  sr[35] <= debugack_sync;
108
                  sr[34] <= monitor_error;
109
                  sr[33] <= resetlatch;
110
                  sr[32 : 1] <= MonDReg;
111
                  sr[0] <= monitor_ready_sync;
112
              end // 2'b00 
113
 
114
              2'b01: begin
115
                  sr[35 : 0] <= tracemem_trcdata;
116
                  sr[37] <= tracemem_tw;
117
                  sr[36] <= tracemem_on;
118
              end // 2'b01 
119
 
120
              2'b10: begin
121
                  sr[37] <= trigger_state_1;
122
                  sr[36] <= dbrk_hit3_latch;
123
                  sr[35] <= dbrk_hit2_latch;
124
                  sr[34] <= dbrk_hit1_latch;
125
                  sr[33] <= dbrk_hit0_latch;
126
                  sr[32 : 1] <= break_readreg;
127
                  sr[0] <= trigbrktype;
128
              end // 2'b10 
129
 
130
              2'b11: begin
131
                  sr[15 : 12] <= 1'b0;
132
                  sr[11 : 2] <= trc_im_addr;
133
                  sr[1] <= trc_wrap;
134
                  sr[0] <= trc_on;
135
              end // 2'b11 
136
 
137
          endcase // ir_in
138
      if (vs_sdr)
139
          case (DRsize)
140
 
141
              3'b000: begin
142
                  sr <= {tdi, sr[37 : 2], tdi};
143
              end // 3'b000 
144
 
145
              3'b001: begin
146
                  sr <= {tdi, sr[37 : 9], tdi, sr[7 : 1]};
147
              end // 3'b001 
148
 
149
              3'b010: begin
150
                  sr <= {tdi, sr[37 : 17], tdi, sr[15 : 1]};
151
              end // 3'b010 
152
 
153
              3'b011: begin
154
                  sr <= {tdi, sr[37 : 33], tdi, sr[31 : 1]};
155
              end // 3'b011 
156
 
157
              3'b100: begin
158
                  sr <= {tdi, sr[37],         tdi, sr[35 : 1]};
159
              end // 3'b100 
160
 
161
              3'b101: begin
162
                  sr <= {tdi, sr[37 : 1]};
163
              end // 3'b101 
164
 
165
              default: begin
166
                  sr <= {tdi, sr[37 : 2], tdi};
167
              end // default
168
 
169
          endcase // DRsize
170
      if (vs_uir)
171
          case (ir_in)
172
 
173
              2'b00: begin
174
                  DRsize <= 3'b100;
175
              end // 2'b00 
176
 
177
              2'b01: begin
178
                  DRsize <= 3'b101;
179
              end // 2'b01 
180
 
181
              2'b10: begin
182
                  DRsize <= 3'b101;
183
              end // 2'b10 
184
 
185
              2'b11: begin
186
                  DRsize <= 3'b010;
187
              end // 2'b11 
188
 
189
          endcase // ir_in
190
    end
191
 
192
 
193
  assign tdo = sr[0];
194
  assign st_ready_test_idle = jtag_state_rti;
195
  assign unxcomplemented_resetxx0 = jrst_n;
196
  altera_std_synchronizer the_altera_std_synchronizer
197
    (
198
      .clk (tck),
199
      .din (debugack),
200
      .dout (debugack_sync),
201
      .reset_n (unxcomplemented_resetxx0)
202
    );
203
 
204
  defparam the_altera_std_synchronizer.depth = 2;
205
 
206
  assign unxcomplemented_resetxx1 = jrst_n;
207
  altera_std_synchronizer the_altera_std_synchronizer1
208
    (
209
      .clk (tck),
210
      .din (monitor_ready),
211
      .dout (monitor_ready_sync),
212
      .reset_n (unxcomplemented_resetxx1)
213
    );
214
 
215
  defparam the_altera_std_synchronizer1.depth = 2;
216
 
217
  always @(posedge tck or negedge jrst_n)
218
    begin
219
      if (jrst_n == 0)
220
          ir_out <= 2'b0;
221
      else
222
        ir_out <= {debugack_sync, monitor_ready_sync};
223
    end
224
 
225
 
226
 
227
//synthesis translate_off
228
//////////////// SIMULATION-ONLY CONTENTS
229
  assign jrst_n = reset_n;
230
 
231
//////////////// END SIMULATION-ONLY CONTENTS
232
 
233
//synthesis translate_on
234
//synthesis read_comments_as_HDL on
235
//  assign jrst_n = 1;
236
//synthesis read_comments_as_HDL off
237
 
238
endmodule
239
 

powered by: WebSVN 2.1.0

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