We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Showing results for 
Search instead for 
Did you mean: 
Visitor andreaerdna
Registered: ‎10-09-2014

Tcl commands to read FPGA pins

Hi, I'd like to read (and then write...) all pins of a Virtex 4 XC4VFX12 - FF668 FPGA through tcl commands. I'm following this user guide ( http://www.xilinx.com/support/documentation/sw_manuals/xilinx12_1/chipscope_pro_sw_cores_ug029.pdf ) and I'm editing this script ( C:\Xilinx\14.7\ISE_DS\ISE\cse\tcl\csejtag_example1.tcl ) to achieve my aim like this:




    for {set deviceIndex 0} {$deviceIndex < $deviceCount} {incr deviceIndex} {
        scanDevice $handle $deviceIndex $deviceCount $idcodeBuffer


#here starts my edit


set goldstring [csejtag_tap shift_device_dr $handle 2 $CSEJTAG_SHIFT_READ $CSEJTAG_RUN_TEST_IDLE 0 150 0]

csejtag_session send_message $handle $CSE_MSG_INFO $goldsring


#here finishes






Here is the output:




Info:DEVICE 0, idcode:a001093, Scanned idcode:a001093, IRLength:8, System_ACE_CF
Info:DEVICE 1, idcode:f5059093, Scanned idcode:f5059093, IRLength:16, XCF32P
Info:DEVICE 2, idcode:21e58093, Scanned idcode:21e58093, IRLength:10, XC4VFX12
Info:DEVICE 3, idcode:59608093, Scanned idcode:59608093, IRLength:8, XC9500XL


The last string should be the boundary scan of my virtex4.

My question is: if I change the state of a pin (like pressing a button or shortcircuit a pin) why I don't see this string change someway?


Am I doing/thinking something wrong? Thank you so much.

0 Kudos
2 Replies
Visitor andreaerdna
Registered: ‎10-09-2014

Re: Tcl commands to read FPGA pins

Ok guys I edited my code and now seems to work:


#here starts my edit


set ISTRUCTION_REGISTER [csejtag_tap shift_device_ir $handle 2 $CSEJTAG_SHIFT_WRITE $CSEJTAG_RUN_TEST_IDLE 0 10 1111000000]

  #1111000000 extest
  #1111000001 sample


set DATA_REGISTER [csejtag_tap shift_device_dr $handle 2 $CSEJTAG_SHIFT_READ $CSEJTAG_RUN_TEST_IDLE 0 983 0]


csejtag_session send_message $handle $CSE_MSG_INFO [format "\n%s" $DATA_REGISTER]


#here finishes


I programmed my FPGA with one button which lights up a LED when pressed.

The button is the E7 and the led is E2.


First string aquired when nothing is pressed:



Second string aquired when the button is pressed:



These bits change:

240, 291, 411, 413 (if you count from right to left)


if you see the BSDL file:



" 240 (BC_2, IO_D2, input, X)," & -- PAD241


" 241 (BC_2, *, controlr, 1)," &


" 242 (BC_2, IO_E2, output3, X, 241, 1, PULL0)," & -- PAD240


" 243 (BC_2, IO_E2, input, X)," & -- PAD240



" 287 (BC_2, IO_E7, output3, X, 286, 1, PULL0)," & -- PAD225


" 288 (BC_2, IO_E7, input, X)," & -- PAD225


" 289 (BC_2, *, controlr, 1)," &


" 290 (BC_2, IO_D4, output3, X, 289, 1, PULL0)," & -- PAD224


" 291 (BC_2, IO_D4, input, X)," & -- PAD224



These are the lines associated to my I/O, they are nearly there, but they don't match perfectly.

What's wrong?


Thank you so much.



0 Kudos
Registered: ‎01-16-2013

Re: Tcl commands to read FPGA pins

Hi @andreaerdna ,


Thanks for providing the answer for your own question.

It's really helpful for other users.


Please close your thread with marking accepted solution. It will help others to know there is answer for query and they can directly look into your post for their referance.




0 Kudos