1 |
2 |
dimamali |
------------------------------------------------------------------------------
|
2 |
|
|
-- This file is a part of the GRLIB VHDL IP LIBRARY
|
3 |
|
|
-- Copyright (C) 2003, Gaisler Research
|
4 |
|
|
--
|
5 |
|
|
-- This program is free software; you can redistribute it and/or modify
|
6 |
|
|
-- it under the terms of the GNU General Public License as published by
|
7 |
|
|
-- the Free Software Foundation; either version 2 of the License, or
|
8 |
|
|
-- (at your option) any later version.
|
9 |
|
|
--
|
10 |
|
|
-- This program is distributed in the hope that it will be useful,
|
11 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
|
|
-- GNU General Public License for more details.
|
14 |
|
|
--
|
15 |
|
|
-- You should have received a copy of the GNU General Public License
|
16 |
|
|
-- along with this program; if not, write to the Free Software
|
17 |
|
|
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
18 |
|
|
-----------------------------------------------------------------------------
|
19 |
|
|
-- Entity: ahbjtag
|
20 |
|
|
-- File: ahbjtag.vhd
|
21 |
|
|
-- Author: Edvin Catovic, Jiri Gaisler - Gaisler Research
|
22 |
|
|
-- Description: JTAG communication link with AHB master interface
|
23 |
|
|
------------------------------------------------------------------------------
|
24 |
|
|
|
25 |
|
|
library ieee;
|
26 |
|
|
use ieee.std_logic_1164.all;
|
27 |
|
|
library grlib;
|
28 |
|
|
use grlib.amba.all;
|
29 |
|
|
use grlib.stdlib.all;
|
30 |
|
|
use grlib.devices.all;
|
31 |
|
|
library techmap;
|
32 |
|
|
use techmap.gencomp.all;
|
33 |
|
|
library gaisler;
|
34 |
|
|
use gaisler.misc.all;
|
35 |
|
|
use gaisler.libjtagcom.all;
|
36 |
|
|
use gaisler.jtag.all;
|
37 |
|
|
|
38 |
|
|
entity ahbjtag is
|
39 |
|
|
generic (
|
40 |
|
|
tech : integer range 0 to NTECH := 0;
|
41 |
|
|
hindex : integer := 0;
|
42 |
|
|
nsync : integer range 1 to 2 := 1;
|
43 |
|
|
idcode : integer range 0 to 255 := 9;
|
44 |
|
|
manf : integer range 0 to 2047 := 804;
|
45 |
|
|
part : integer range 0 to 65535 := 0;
|
46 |
|
|
ver : integer range 0 to 15 := 0;
|
47 |
|
|
ainst : integer range 0 to 255 := 2;
|
48 |
|
|
dinst : integer range 0 to 255 := 3;
|
49 |
|
|
scantest : integer := 0);
|
50 |
|
|
port (
|
51 |
|
|
rst : in std_ulogic;
|
52 |
|
|
clk : in std_ulogic;
|
53 |
|
|
tck : in std_ulogic;
|
54 |
|
|
tms : in std_ulogic;
|
55 |
|
|
tdi : in std_ulogic;
|
56 |
|
|
tdo : out std_ulogic;
|
57 |
|
|
ahbi : in ahb_mst_in_type;
|
58 |
|
|
ahbo : out ahb_mst_out_type;
|
59 |
|
|
tapo_tck : out std_ulogic;
|
60 |
|
|
tapo_tdi : out std_ulogic;
|
61 |
|
|
tapo_inst : out std_logic_vector(7 downto 0);
|
62 |
|
|
tapo_rst : out std_ulogic;
|
63 |
|
|
tapo_capt : out std_ulogic;
|
64 |
|
|
tapo_shft : out std_ulogic;
|
65 |
|
|
tapo_upd : out std_ulogic;
|
66 |
|
|
tapi_tdo : in std_ulogic;
|
67 |
|
|
trst : in std_ulogic := '1';
|
68 |
|
|
tdoen : out std_ulogic
|
69 |
|
|
);
|
70 |
|
|
end;
|
71 |
|
|
|
72 |
|
|
architecture struct of ahbjtag is
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
constant REVISION : integer := 0;
|
76 |
|
|
constant TAPSEL : integer := has_tapsel(tech);
|
77 |
|
|
|
78 |
|
|
signal dmai : ahb_dma_in_type;
|
79 |
|
|
signal dmao : ahb_dma_out_type;
|
80 |
|
|
signal ltapi : tap_in_type;
|
81 |
|
|
signal ltapo : tap_out_type;
|
82 |
|
|
signal taprst : std_ulogic;
|
83 |
|
|
|
84 |
|
|
begin
|
85 |
|
|
|
86 |
|
|
taprst <= trst and rst;
|
87 |
|
|
|
88 |
|
|
ahbmst0 : ahbmst
|
89 |
|
|
generic map (hindex => hindex, venid => VENDOR_GAISLER, devid => GAISLER_AHBJTAG)
|
90 |
|
|
port map (rst, clk, dmai, dmao, ahbi, ahbo);
|
91 |
|
|
|
92 |
|
|
tap0 : tap generic map (tech => tech, irlen => 6, idcode => idcode,
|
93 |
|
|
manf => manf, part => part, ver => ver, scantest => scantest)
|
94 |
|
|
port map (taprst, tck, tms, tdi, tdo, ltapo.tck, ltapo.tdi, ltapo.inst, ltapo.reset, ltapo.capt,
|
95 |
|
|
ltapo.shift, ltapo.upd, ltapo.asel, ltapo.dsel, ltapi.en, ltapi.tdo, tapi_tdo,
|
96 |
|
|
ahbi.testen, ahbi.testrst, tdoen);
|
97 |
|
|
|
98 |
|
|
jtagcom0 : jtagcom generic map (isel => TAPSEL, nsync => nsync, ainst => ainst, dinst => dinst)
|
99 |
|
|
port map (rst, clk, ltapo, ltapi, dmao, dmai);
|
100 |
|
|
|
101 |
|
|
tapo_tck <= ltapo.tck; tapo_tdi <= ltapo.tdi; tapo_inst <= ltapo.inst;
|
102 |
|
|
tapo_rst <= ltapo.reset; tapo_capt <= ltapo.capt; tapo_shft <= ltapo.shift;
|
103 |
|
|
tapo_upd <= ltapo.upd;
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
-- pragma translate_off
|
107 |
|
|
bootmsg : report_version
|
108 |
|
|
generic map ("ahbjtag AHB Debug JTAG rev " & tost(REVISION));
|
109 |
|
|
-- pragma translate_on
|
110 |
|
|
|
111 |
|
|
end;
|