Documentation: fix warning "unbalanced square brackets"
[openocd.git] / tcl / cpld / xilinx-xc6s.cfg
index b705ea1fd1c606a4cad4064441ce53653630bd42..92b26057746950599954c713c103e05e16dbdcfa 100644 (file)
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
 # xilinx spartan6
 # http://www.xilinx.com/support/documentation/user_guides/ug380.pdf
 
@@ -23,7 +25,8 @@ jtag newtap $_CHIPNAME tap -irlen 6 -ignore-version \
        -expected-id 0x0401D093 \
        -expected-id 0x0403D093
 
-pld device virtex2 $_CHIPNAME.tap
+pld create $_CHIPNAME.pld virtex2 -chain-position $_CHIPNAME.tap
+virtex2 set_user_codes $_CHIPNAME.pld 0x02 0x03 0x1A 0x1B
 
 set XC6S_CFG_IN 0x05
 set XC6S_JSHUTDOWN 0x0d
@@ -32,6 +35,7 @@ set XC6S_JSTART 0x0c
 set XC6S_BYPASS 0x3f
 
 proc xc6s_program {tap} {
+       echo "DEPRECATED! use 'virtex2 program ...' not 'xc6s_program'"
        global XC6S_JSHUTDOWN XC6S_JPROGRAM XC6S_JSTART XC6S_BYPASS
        irscan $tap $XC6S_JSHUTDOWN
        irscan $tap $XC6S_JPROGRAM
@@ -41,6 +45,7 @@ proc xc6s_program {tap} {
 
 #xtp038 and xc3sprog approach
 proc xc6s_program_iprog {tap} {
+       echo "DEPRECATED! use 'virtex2 program ...' not 'xc6s_program_iprog'"
        global XC6S_JSHUTDOWN XC6S_JSTART XC6S_BYPASS XC6S_CFG_IN
        irscan $tap $XC6S_JSHUTDOWN
        runtest 16
@@ -52,3 +57,39 @@ proc xc6s_program_iprog {tap} {
        irscan $tap $XC6S_BYPASS
        runtest 1
 }
+
+set XC6S_ISC_ENABLE 0x10
+set XC6S_ISC_DISABLE 0x16
+set XC6S_ISC_DNA 0x30
+
+# Get the "Device DNA" from the Spartan 6.
+# Most Xilinx FPGA devices contain an embedded, unique device identifier called
+# the "Device DNA". The identifier is nonvolatile, permanently programmed into
+# the FPGA, and is unchangeable providing a great serial / tracking number.
+proc xc6s_get_dna {tap} {
+       global XC6S_ISC_ENABLE XC6S_ISC_DISABLE XC6S_ISC_DNA
+       irscan $tap $XC6S_ISC_ENABLE
+       runtest 64
+       irscan $tap $XC6S_ISC_DNA
+       # Device DNA is 57 bits long, but we can only read 32bits at a time
+       # with OpenOCD.
+       set dna [drscan $tap 16 0 16 0 16 0 9 0]
+       runtest 64
+       irscan $tap $XC6S_ISC_DISABLE
+       runtest 64
+
+       # Convert the binary data into the order impact uses
+       scan $dna "%x %x %x %x" v1 v2 v3 v4
+       set bin_dna [string reverse [concat [format "%09b" $v4][format "%016b" $v3][format "%016b" $v2][format "%016b" $v1]]]
+
+       # Return a hex version of binary
+       scan [format "0b%s" $bin_dna] "%i" hex_dna
+       return $hex_dna
+}
+
+# Print out the "Device DNA" in the same format that impact uses.
+proc xc6s_print_dna {tap} {
+       set hex_dna [xc6s_get_dna $tap]
+
+       puts [format "DNA = %57b (0x%x)\n" $hex_dna $hex_dna]
+}

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)