OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [rtl/] [src_peripheral/] [jtag/] [jtag_wb/] [pronoc_jtag_source_probe.v] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 alirezamon
/**********************************************************************
2
**  File:  pronoc_jtag_source_probe.v
3
**
4
**
5
**  Copyright (C) 2020  Alireza Monemi
6
**
7
**  This file is part of ProNoC
8
**
9
**  ProNoC ( stands for Prototype Network-on-chip)  is free software:
10
**  you can redistribute it and/or modify it under the terms of the GNU
11
**  Lesser General Public License as published by the Free Software Foundation,
12
**  either version 2 of the License, or (at your option) any later version.
13
**
14
**  ProNoC is distributed in the hope that it will be useful, but WITHOUT
15
**  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16
**  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
17
**  Public License for more details.
18
**
19
**  You should have received a copy of the GNU Lesser General Public
20
**  License along with ProNoC. If not, see <http:**www.gnu.org/licenses/>.
21
**
22
**
23
**  Description:
24
**  A source/probe that can be controled using xilinx bscan chain or Altera vjtag.
25
**
26
*******************************************************************/
27
 
28
 
29
// synthesis translate_off
30
`timescale 1ns / 1ps
31
// synthesis translate_on
32
 
33
 
34
module pronoc_jtag_source_probe #(
35
    parameter Dw=2,  //probe/probe width in bits 
36
 
37
    parameter JTAG_CONNECT= "XILINX_JTAG_WB" ,// "ALTERA_JTAG_WB" , "XILINX_JTAG_WB"  
38
    parameter JTAG_INDEX= 0,
39
    parameter JDw =32,// should be a fixed value for all IPs coneccting to JTAG
40
    parameter JAw=32, // should be a fixed value for all IPs coneccting to JTAG
41
    parameter JINDEXw=8,
42
    parameter JSTATUSw=8,
43
    parameter J2WBw = (JTAG_CONNECT== "XILINX_JTAG_WB") ? 1+1+JDw+JAw : 1,
44
    parameter WB2Jw= (JTAG_CONNECT== "XILINX_JTAG_WB") ? 1+JSTATUSw+JINDEXw+1+JDw  : 1
45
 
46
 
47
)(
48
        reset,
49
        clk,
50
        source_o,
51
        probe_i,
52
        //jtag o wb interface. Valid only for XILINX_JTAG_WB 
53
    jtag_to_wb,
54
    wb_to_jtag
55
);
56
 
57
    input reset,clk;
58
        input           [Dw-1   :0]  probe_i;
59
        output  reg [Dw-1       :0]  source_o;
60
 
61
    input  [J2WBw-1 : 0] jtag_to_wb;
62
    output [WB2Jw-1: 0] wb_to_jtag;
63
 
64
    wire we;
65
    wire [JDw-1 : 0] wb_to_jtag_dat;
66
    wire [JDw-1 : 0] jtag_to_wb_dat;
67
 
68
    generate
69
    /* verilator lint_off WIDTH */
70
    if(JTAG_CONNECT == "ALTERA_JTAG_WB")begin:altera_jwb
71
    /* verilator lint_on WIDTH */
72
        reg jtag_ack;
73
        wire    jtag_we_o, jtag_stb_o;
74
 
75
 
76
        vjtag_wb #(
77
            .VJTAG_INDEX(JTAG_INDEX),
78
            .DW(Dw),
79
            .AW(2),
80
            .SW(1),
81
 
82
            //wishbone port parameters
83
            .M_Aw(2),
84
            .TAGw(3)
85
        )
86
        vjtag_inst
87
        (
88
            .clk(clk),
89
            .reset(reset),
90
            .status_i(0), // Jtag can read memory size as status
91
             //wishbone master interface signals
92
            .m_sel_o(),
93
            .m_dat_o(jtag_to_wb_dat),
94
            .m_addr_o( ),
95
            .m_cti_o(),
96
            .m_stb_o(jtag_stb_o),
97
            .m_cyc_o(),
98
            .m_we_o(jtag_we_o),
99
            .m_dat_i(wb_to_jtag_dat),
100
            .m_ack_i(jtag_ack)
101
 
102
        );
103
 
104
            assign we = jtag_stb_o & jtag_we_o;
105
 
106
            always @(posedge clk )begin
107
                jtag_ack<=jtag_stb_o;
108
            end
109
            assign wb_to_jtag[0] = clk;
110
 
111
    end//altera_jwb
112
 
113
 
114
 
115
/* verilator lint_off WIDTH */
116
    else if(JTAG_CONNECT == "XILINX_JTAG_WB")begin: xilinx_jwb
117
/* verilator lint_on WIDTH */
118
 
119
 
120
 
121
        wire [JSTATUSw-1 : 0] wb_to_jtag_status;
122
        wire [JINDEXw-1 : 0] wb_to_jtag_index;
123
 
124
        wire [JAw-1 : 0] jtag_to_wb_addr;
125
        wire jtag_to_wb_stb;
126
        wire jtag_to_wb_we;
127
 
128
        wire wb_to_jtag_ack;
129
 
130
        assign wb_to_jtag = {wb_to_jtag_status,wb_to_jtag_ack,wb_to_jtag_dat,wb_to_jtag_index,clk};
131
        assign {jtag_to_wb_addr,jtag_to_wb_stb,jtag_to_wb_we,jtag_to_wb_dat} = jtag_to_wb;
132
 
133
 
134
        reg ack_reg;
135
        assign  we = jtag_to_wb_stb & jtag_to_wb_we;
136
 
137
        assign wb_to_jtag_status = 0;
138
        assign wb_to_jtag_index = JTAG_INDEX;
139
 
140
 
141
        assign wb_to_jtag_ack = ack_reg;
142
        always @(posedge clk )begin
143
            ack_reg<=jtag_to_wb_stb;
144
        end
145
 
146
    end else begin
147
        assign wb_to_jtag[0] = clk;
148
    end
149
 
150
    endgenerate
151
 
152
 
153
 
154
 
155
      always @(posedge clk) begin
156
            if(reset) begin
157
                source_o <= {Dw{1'b0}};
158
            end else begin
159
                if (we) source_o <= jtag_to_wb_dat[Dw-1 : 0];
160
            end
161
        end
162
 
163
 
164
        assign wb_to_jtag_dat [Dw-1 : 0] = probe_i;
165
 
166
 
167
 
168
endmodule

powered by: WebSVN 2.1.0

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