Altera_Forum
Honored Contributor
10 years agoVirtual JTAG counter to TDO
Hi everyone,
I'm new in FPGA verilog system. I have a DE0 nano from Terasic (http://www.terasic.com.tw/cgi-bin/page/archive.pl?language=english&no=593&from=fb-like). During my little training (principally on the internet), I heard about the virtual JTAG. After searching examples and Altera documents, I create a project where I would like us the vJTAG. I create a simple counter where I implement a virtual JTAG to see which value this counter have. My counter work correctly, and I can communicate with FPGA. But I have a little problem and I can not resolve it. When the value of my counter go to TDO, I read a read a wrong value (when I have 0000 0001, I have 0000 0010). I really don't understand. Maybe I do something wrong and miss something in the process of the vJTAG. Here is my code : Verilog code :
module vjiInterface(
input out_data,
output reg visual
);
wire tck, tdi;
reg tdo;
wire ir_in;
wire ir_out;
wire v_cdr, v_sdr,v_udr,v_e1dr,v_pdr,v_e2dr,v_cir,v_uir;
reg dr1_tmp_reg =0;
assign ir_out = ir_out;
reg cdr_delayed, sdr_delayed;
myVJI myVJI(
.tdi(tdi),
.tdo(tdo),
.ir_in(ir_in),
.ir_out(ir_out),
.virtual_state_cdr(v_cdr),
.virtual_state_sdr(v_sdr),
.virtual_state_e1dr(v_e1dr),
.virtual_state_pdr(v_pdr),
.virtual_state_e2dr(v_e2dr),
.virtual_state_udr(v_udr),
.virtual_state_cir(v_cir),
.virtual_state_uir(v_uir),
.tck(tck)
);
always @(negedge tck)
begin
cdr_delayed = v_cdr;
sdr_delayed = v_sdr;
end
always @(posedge tck)
begin
case (ir_in)
00 :
begin
if (cdr_delayed)
begin
dr1_tmp_reg = out_data;
visual = dr1_tmp_reg;
end
else
begin
if(sdr_delayed)
tdo = dr1_tmp_reg;
dr1_tmp_reg = {dr1_tmp_reg,dr1_tmp_reg};
end
end
endcase
end
endmodule
TCL code (part where I catch data from TDO)
proc recv {} {
device_virtual_ir_shift -instance_index 0 -ir_value 0 -no_captured_ir_value
set tdi
return $tdi
}
Visualization : Counter value : 0000 0011 / and after a TDO operation : 0000 0110 http://www.alteraforum.com/forum/attachment.php?attachmentid=10461&stc=1 Thanks for the help. Sorry for my english's mistakes. Hellikandra