This is an automated email from Gerrit.

Tim Ansell ([email protected]) just uploaded a new patch set to Gerrit, which 
you can find at http://openocd.zylin.com/2960

-- gerrit

commit 92a5624929f5b2ec9713cbbdaac5c3b368a21fe0
Author: Tim 'mithro' Ansell <[email protected]>
Date:   Sun Sep 27 20:09:38 2015 +1000

    Support for reading "Device DNA" from Spartan 6 devices.
    
    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.
    
    Debugging was done in https://github.com/timvideos/HDMI2USB/issues/36
    
    Change-Id: Iad03eafb40887f0321a4dc22858a7c3bf37a12b3
    Signed-off-by: Tim 'mithro' Ansell <[email protected]>

diff --git a/tcl/cpld/xilinx-xc6s.cfg b/tcl/cpld/xilinx-xc6s.cfg
index b705ea1..c7f42f0 100644
--- a/tcl/cpld/xilinx-xc6s.cfg
+++ b/tcl/cpld/xilinx-xc6s.cfg
@@ -52,3 +52,34 @@ 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
+
+proc xc6s_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 to binary string
+       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]]]
+       # Hex version of binary
+       scan [format "0b%s" $bin_dna] "%i" hex_dna
+
+       # Print out the DNA in the format that impact uses
+       puts -nonewline "DNA = "
+       puts -nonewline $bin_dna
+       puts -nonewline [format " (0x%x)" $hex_dna]
+       puts ""
+
+       return $hex_dna
+}

-- 

------------------------------------------------------------------------------
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to