1 |
3 |
nyawn |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// altera_virtual_jtag.vhd ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// ////
|
6 |
|
|
//// ////
|
7 |
|
|
//// Author(s): ////
|
8 |
|
|
//// Nathan Yawn (nathan.yawn@opencores.org) ////
|
9 |
|
|
//// ////
|
10 |
|
|
//// ////
|
11 |
|
|
//// ////
|
12 |
|
|
//////////////////////////////////////////////////////////////////////
|
13 |
|
|
//// ////
|
14 |
|
|
//// Copyright (C) 2003-2008 Authors ////
|
15 |
|
|
//// ////
|
16 |
|
|
//// This source file may be used and distributed without ////
|
17 |
|
|
//// restriction provided that this copyright statement is not ////
|
18 |
|
|
//// removed from the file and that any derivative work contains ////
|
19 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
20 |
|
|
//// ////
|
21 |
|
|
//// This source file is free software; you can redistribute it ////
|
22 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
23 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
24 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
25 |
|
|
//// later version. ////
|
26 |
|
|
//// ////
|
27 |
|
|
//// This source is distributed in the hope that it will be ////
|
28 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
29 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
30 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
31 |
|
|
//// details. ////
|
32 |
|
|
//// ////
|
33 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
34 |
|
|
//// Public License along with this source; if not, download it ////
|
35 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
36 |
|
|
//// ////
|
37 |
|
|
//////////////////////////////////////////////////////////////////////
|
38 |
|
|
// //
|
39 |
|
|
// This file is a wrapper for the Altera Virtual JTAG device. //
|
40 |
|
|
// It is designed to take the place of a separate TAP //
|
41 |
|
|
// controller in Altera systems, to allow a user to access a CPU //
|
42 |
|
|
// debug module (such as that of the OR1200) through the FPGA's //
|
43 |
|
|
// dedicated JTAG / configuration port. //
|
44 |
|
|
// //
|
45 |
|
|
//////////////////////////////////////////////////////////////////////
|
46 |
|
|
//
|
47 |
|
|
// CVS Revision History
|
48 |
|
|
//
|
49 |
|
|
// $Log: altera_virtual_jtag.vhd,v $
|
50 |
14 |
nyawn |
// Revision 1.3 2009/06/16 02:53:19 Nathan
|
51 |
|
|
// Changed some signal names for better consistency between different hardware modules.
|
52 |
3 |
nyawn |
//
|
53 |
14 |
nyawn |
// Revision 1.2 2009/05/17 20:54:47 Nathan
|
54 |
|
|
// Changed email address to opencores.org
|
55 |
|
|
//
|
56 |
3 |
nyawn |
// Revision 1.1 2008/07/18 20:09:31 Nathan
|
57 |
|
|
// Changed directory structure to match existing projects.
|
58 |
|
|
//
|
59 |
|
|
// Revision 1.2 2008/05/22 19:55:20 Nathan
|
60 |
|
|
// Added added copyright, CVS log, and brief description.
|
61 |
|
|
//
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
LIBRARY ieee;
|
65 |
|
|
USE ieee.std_logic_1164.all;
|
66 |
|
|
|
67 |
|
|
LIBRARY altera_mf;
|
68 |
|
|
USE altera_mf.all;
|
69 |
|
|
|
70 |
|
|
ENTITY altera_virtual_jtag IS
|
71 |
|
|
PORT
|
72 |
|
|
(
|
73 |
|
|
tck_o : OUT STD_LOGIC;
|
74 |
14 |
nyawn |
debug_tdo_o : IN STD_LOGIC;
|
75 |
|
|
tdi_o : OUT STD_LOGIC;
|
76 |
3 |
nyawn |
test_logic_reset_o : OUT STD_LOGIC;
|
77 |
|
|
run_test_idle_o : OUT STD_LOGIC;
|
78 |
|
|
shift_dr_o : OUT STD_LOGIC;
|
79 |
|
|
capture_dr_o : OUT STD_LOGIC;
|
80 |
|
|
pause_dr_o : OUT STD_LOGIC;
|
81 |
|
|
update_dr_o : OUT STD_LOGIC;
|
82 |
|
|
debug_select_o : OUT STD_LOGIC
|
83 |
|
|
);
|
84 |
|
|
END altera_virtual_jtag;
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
ARCHITECTURE OC OF altera_virtual_jtag IS
|
88 |
|
|
|
89 |
|
|
CONSTANT CMD_DEBUG : STD_LOGIC_VECTOR (3 downto 0) := "1000";
|
90 |
|
|
|
91 |
|
|
SIGNAL ir_value : STD_LOGIC_VECTOR (3 DOWNTO 0);
|
92 |
|
|
SIGNAL exit1_dr : STD_LOGIC;
|
93 |
|
|
SIGNAL exit2_dr : STD_LOGIC;
|
94 |
|
|
SIGNAL capture_ir : STD_LOGIC;
|
95 |
|
|
SIGNAL update_ir : STD_LOGIC;
|
96 |
|
|
|
97 |
|
|
COMPONENT sld_virtual_jtag
|
98 |
|
|
GENERIC (
|
99 |
|
|
sld_auto_instance_index : STRING;
|
100 |
|
|
sld_instance_index : NATURAL;
|
101 |
|
|
sld_ir_width : NATURAL;
|
102 |
|
|
sld_sim_action : STRING;
|
103 |
|
|
sld_sim_n_scan : NATURAL;
|
104 |
|
|
sld_sim_total_length : NATURAL;
|
105 |
|
|
lpm_type : STRING
|
106 |
|
|
);
|
107 |
|
|
PORT (
|
108 |
|
|
tdi : OUT STD_LOGIC ;
|
109 |
|
|
jtag_state_rti : OUT STD_LOGIC ;
|
110 |
|
|
jtag_state_e1dr : OUT STD_LOGIC ;
|
111 |
|
|
jtag_state_e2dr : OUT STD_LOGIC ;
|
112 |
|
|
tms : OUT STD_LOGIC ;
|
113 |
|
|
jtag_state_pir : OUT STD_LOGIC ;
|
114 |
|
|
jtag_state_tlr : OUT STD_LOGIC ;
|
115 |
|
|
tck : OUT STD_LOGIC ;
|
116 |
|
|
jtag_state_sir : OUT STD_LOGIC ;
|
117 |
|
|
ir_in : OUT STD_LOGIC_VECTOR (3 DOWNTO 0);
|
118 |
|
|
virtual_state_cir : OUT STD_LOGIC ;
|
119 |
|
|
virtual_state_pdr : OUT STD_LOGIC ;
|
120 |
|
|
ir_out : IN STD_LOGIC_VECTOR (3 DOWNTO 0);
|
121 |
|
|
virtual_state_uir : OUT STD_LOGIC ;
|
122 |
|
|
jtag_state_cir : OUT STD_LOGIC ;
|
123 |
|
|
jtag_state_uir : OUT STD_LOGIC ;
|
124 |
|
|
jtag_state_pdr : OUT STD_LOGIC ;
|
125 |
|
|
tdo : IN STD_LOGIC ;
|
126 |
|
|
jtag_state_sdrs : OUT STD_LOGIC ;
|
127 |
|
|
virtual_state_sdr : OUT STD_LOGIC ;
|
128 |
|
|
virtual_state_cdr : OUT STD_LOGIC ;
|
129 |
|
|
jtag_state_sdr : OUT STD_LOGIC ;
|
130 |
|
|
jtag_state_cdr : OUT STD_LOGIC ;
|
131 |
|
|
virtual_state_udr : OUT STD_LOGIC ;
|
132 |
|
|
jtag_state_udr : OUT STD_LOGIC ;
|
133 |
|
|
jtag_state_sirs : OUT STD_LOGIC ;
|
134 |
|
|
jtag_state_e1ir : OUT STD_LOGIC ;
|
135 |
|
|
jtag_state_e2ir : OUT STD_LOGIC ;
|
136 |
|
|
virtual_state_e1dr : OUT STD_LOGIC ;
|
137 |
|
|
virtual_state_e2dr : OUT STD_LOGIC
|
138 |
|
|
);
|
139 |
|
|
END COMPONENT;
|
140 |
|
|
|
141 |
|
|
BEGIN
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
sld_virtual_jtag_component : sld_virtual_jtag
|
146 |
|
|
GENERIC MAP (
|
147 |
|
|
sld_auto_instance_index => "YES",
|
148 |
|
|
sld_instance_index => 0,
|
149 |
|
|
sld_ir_width => 4,
|
150 |
|
|
sld_sim_action => "",
|
151 |
|
|
sld_sim_n_scan => 0,
|
152 |
|
|
sld_sim_total_length => 0,
|
153 |
|
|
lpm_type => "sld_virtual_jtag"
|
154 |
|
|
)
|
155 |
|
|
PORT MAP (
|
156 |
|
|
ir_out => ir_value,
|
157 |
14 |
nyawn |
tdo => debug_tdo_o,
|
158 |
|
|
tdi => tdi_o,
|
159 |
3 |
nyawn |
jtag_state_rti => run_test_idle_o,
|
160 |
|
|
tck => tck_o,
|
161 |
|
|
ir_in => ir_value,
|
162 |
|
|
jtag_state_tlr => test_logic_reset_o,
|
163 |
|
|
virtual_state_cir => capture_ir,
|
164 |
|
|
virtual_state_pdr => pause_dr_o,
|
165 |
|
|
virtual_state_uir => update_ir,
|
166 |
|
|
virtual_state_sdr => shift_dr_o,
|
167 |
|
|
virtual_state_cdr => capture_dr_o,
|
168 |
|
|
virtual_state_udr => update_dr_o,
|
169 |
|
|
virtual_state_e1dr => exit1_dr,
|
170 |
|
|
virtual_state_e2dr => exit2_dr
|
171 |
|
|
);
|
172 |
|
|
|
173 |
|
|
debug_select_o <= '1' when (ir_value = CMD_DEBUG) else '0';
|
174 |
|
|
|
175 |
|
|
END OC;
|