Visible to Intel only — GUID: bhc1411109390194
Ixiasoft
Visible to Intel only — GUID: bhc1411109390194
Ixiasoft
Instantiating Directly in HDL
- The tck output from the Virtual JTAG Intel® FPGA IP core is the clock used for shifting the data in and out on the TDI and TDO pins.
- The TMS output of the Virtual JTAG Intel® FPGA IP core reflects the TMS input to the main JTAG circuit.
- The ir_in output port of the Virtual JTAG Intel® FPGA IP core is the parallel output of the contents that get shifted into the virtual IR of the Virtual JTAG instance. This port is used for decoding logic to select the active virtual DR chain.
The purpose of instantiating a Virtual JTAG instance in this example is to load my_counter through the JTAG port using a software application built with Tcl commands and the quartus_stp executable. In this design, the Virtual JTAG instance is called my_vji. Whenever a Virtual JTAG Intel® FPGA IP core is instantiated in a design, three logic blocks are usually needed: a decode logic block, a TDO logic block, and a Data Register block. The example below combines the Virtual JTAG instance, the decode logic, the TDO logic and the Data Register blocks.
You can use the following Verilog HDL template as a guide for instantiating and connecting various signals of the IP cores in your design.
module counter (clock, my_counter); input clock; output [3:0] my_counter; reg [3:0] my_counter; always @ (posedge clock) if (load && e1dr) // decode logic: used to load the counter my_counter my_counter <= tmp_reg; else my_counter <= my_counter + 1; // Signals and registers declared for VJI instance wire tck, tdi; reg tdo; wire cdr, eldr, e2dr, pdr, sdr, udr, uir, cir; wire [1:0] ir_in; // Instantiation of VJI my_vji VJI_INST( .tdo (tdo), .tck (tck), .tdi (tdi), .tms(), .ir_in(ir_in), .ir_out(), .virtual_state_cdr (cdr), .virtual_state_e1dr(e1dr), .virtual_state_e2dr(e2dr), .virtual_state_pdr (pdr), .virtual_state_sdr (sdr), .virtual_state_udr (udr), .virtual_state_uir (uir), .virtual_state_cir (cir) ); // Declaration of data register reg [3:0] tmp_reg; // Deocde Logic Block // Making some decode logic from ir_in output port of VJI wire load = ir_in[1] && ~ir_in[0]; // Bypass used to maintain the scan chain continuity for // tdi and tdo ports bypass_reg <= tdi; // Data Register Block always @ (posedge tck) if ( load && sdr ) tmp_reg <= {tdi, tmp_reg[3:1]}; // tdo Logic Block always @ (tmp_reg[0] or bypass_reg) if(load) tdo <= tmp_reg[0] else tdo <= bypass_reg; endmodule
The decode logic is produced by defining a wire load to be active high whenever the IR of the Virtual JTAG Intel® FPGA IP core is 01. The IR scan shift is used to load the data into the IR of the Virtual JTAG Intel® FPGA IP core. The ir_in output port reflects the IR contents.
The Data Register logic contains a 4-bit shift register named tmp_reg. The always blocks shown for the Data Register logic also contain the decode logic consisting of the load and sdr signals. The sdr signal is the output of the Virtual JTAG Intel® FPGA IP core that is asserted high during a DR scan shift operation. The time during which the sdr output is asserted high is the time in which the data on tdi is valid. During that time period, the data is shifted into the tmp_reg shift register. Therefore, tmp_reg gets the data from the Virtual JTAG Intel® FPGA IP core on the tdi output port during a DR scan operation.
There is a 1‑bit register named bypass_reg whose output is connected with tdo logic to maintain the continuity of the scan chain during idle or IR scan shift operation of the Virtual JTAG Intel® FPGA IP core. The tdo logic consists of outputs coming from tmp_reg and bypass_reg and connecting to the tdo input of the Virtual JTAG Intel® FPGA IP core. The tdo logic passes the data from tmp_reg to the Virtual JTAG Intel® FPGA IP core during DR scan shift operations.
The always block of a 4-bit counter also consists of some decode logic. This decode logic uses the load signal and e1dr output signal of the Virtual JTAG Intel® FPGA IP core to load the counter with the contents of tmp_reg. The Virtual JTAG output signal e1dr is asserted high during a DR scan shift operation when all the data is completely shifted into the tmp_reg and sdr has been de-asserted. In addition to sdr and e1dr, there are other outputs from the Virtual JTAG Intel® FPGA IP core that are asserted high to show various states of the TAP controller and internal states of the Virtual JTAG Intel® FPGA IP core. All of these signals can be used to perform different logic operations as needed in your design.