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/] [jtag_system_en.v] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 alirezamon
/**********************************************************************
2
**      File:  jtag_system_en.v
3
**
4
**
5
**      Copyright (C) 2014-2017  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
**      each system single core or many core must have one jtag_system_en module in order
25
**      to allow mmeory programming.
26
**      This module has two output ports which can be programed using jtag interface:
27
**      cpu_en: which can enable/disable the cpu cores. This port must be connected to all
28
**              cpus enable port in order tio deactiavte them during memory programming
29
**      system_reset: This pin must be ored by sytem global reset pin. The jtag memory
30
**              programmer will reset the system before and after perogramming the memories.
31
**
32
*******************************************************************/
33
 
34
 
35
// synthesis translate_off
36
`timescale 1ns / 1ps
37
// synthesis translate_on
38
 
39
 
40
module jtag_system_en #(
41
    parameter FPGA_VENDOR = "ALTERA"
42
)
43
(
44
        cpu_en,
45
        system_reset
46
 
47
);
48
        output cpu_en,  system_reset;
49
 
50
        generate
51
        if(FPGA_VENDOR =="ALTERA")  begin : altera
52
 
53
        wire [1 :       0] jtag_out;
54
        jtag_control_port #(
55
                .VJTAG_INDEX(127),
56
                .DW(2)
57
 
58
        )enable(
59
                .jtag_out(jtag_out)
60
        );
61
 
62
        assign system_reset=jtag_out[0];
63
        assign cpu_en=~jtag_out[1];
64
 
65
    end else begin :xilinx
66
 
67
        xilinx_jtag_wb  #(
68
            .JTAG_CHAIN(4),
69
            .JWB_NUM(1)
70
        )
71
        jwb
72
        (
73
 
74
            .reset(1'b0),
75
            .cpu_en(cpu_en),
76
            .system_reset(system_reset),
77
            .wb_to_jtag_all( ),
78
            .jtag_to_wb_all( )
79
        );
80
 
81
    end
82
    endgenerate
83
 
84
endmodule
85
 
86
 
87
 
88
module jtag_control_port #(
89
        parameter VJTAG_INDEX=127,
90
        parameter DW=2
91
 
92
)(
93
        jtag_out
94
);
95
 
96
 
97
        output [DW-1    :       0] jtag_out;
98
 
99
 
100
 
101
        //vjtag vjtag signals declaration
102
        wire    [2:0]  ir_out ,  ir_in;
103
        wire      tdo, tck,       tdi;
104
        wire      cdr ,cir,e1dr,e2dr,pdr,sdr,udr,uir;
105
 
106
 
107
        vjtag   #(
108
         .VJTAG_INDEX(VJTAG_INDEX)
109
        )
110
        vjtag_inst (
111
        .ir_out ( ir_out ),
112
        .tdo ( tdo ),
113
        .ir_in ( ir_in ),
114
        .tck ( tck ),
115
        .tdi ( tdi ),
116
        .virtual_state_cdr      ( cdr ),
117
        .virtual_state_cir      ( cir ),
118
        .virtual_state_e1dr     ( e1dr ),
119
        .virtual_state_e2dr     ( e2dr ),
120
        .virtual_state_pdr      ( pdr ),
121
        .virtual_state_sdr      ( sdr ),
122
        .virtual_state_udr      ( udr ),
123
        .virtual_state_uir      ( uir )
124
        );
125
 
126
 
127
 
128
 
129
        reg [2:0] ir;
130
        reg bypass_reg;
131
        reg [DW-1       :       0] shift_buffer,shift_buffer_next;
132
        reg cdr_delayed,sdr_delayed;
133
        reg [DW-1       :       0] status,status_next;
134
 
135
        assign jtag_out = status ;
136
 /*
137
        always @(negedge tck)
138
        begin
139
                //  Delay the CDR signal by one half clock cycle
140
                cdr_delayed = cdr;
141
                sdr_delayed = sdr;
142
        end
143
        */
144
 
145
        assign ir_out = ir_in;  // Just pass the IR out
146
        assign tdo = (ir == 3'b000) ? bypass_reg : shift_buffer[0];
147
 
148
 
149
 
150
 
151
 
152
        always @(posedge tck )
153
        begin
154
                        if( uir ) ir <= ir_in; // Capture the instruction provided
155
                        bypass_reg <= tdi;
156
                        shift_buffer<=shift_buffer_next;
157
                        status<=status_next;
158
 
159
        end
160
 
161
generate
162
        if(DW==1)begin :DW1
163
                always @ (*)begin
164
                        shift_buffer_next=shift_buffer;
165
                        status_next = status;
166
                        if( sdr ) shift_buffer_next= tdi; //,shift_buffer[DW-1:1]};// shift buffer
167
                        if((ir == 3'b001) &  cdr ) shift_buffer_next  = status;
168
                        if((ir == 3'b001) &  udr ) status_next = shift_buffer;
169
                end
170
        end
171
        else begin :DWB
172
                always @ (*)begin
173
                        shift_buffer_next=shift_buffer;
174
                        status_next = status;
175
                        if( sdr ) shift_buffer_next= {tdi, shift_buffer[DW-1:1]};// shift buffer
176
                        if((ir == 3'b001) &  cdr ) shift_buffer_next  = status;
177
                        if((ir == 3'b001) &  udr ) status_next = shift_buffer;
178
                end
179
 
180
        end
181
endgenerate
182
 
183
 
184
endmodule
185
 
186
 

powered by: WebSVN 2.1.0

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