# SPDX-License-Identifier: GPL-2.0-or-later

# xilinx virtex 6
# https://www.xilinx.com/support/documentation/user_guides/ug360.pdf

if { [info exists CHIPNAME] } {
	set _CHIPNAME $CHIPNAME
} else {
	set _CHIPNAME xc6v
}

# the 4 top bits (28:31) are the die stepping. ignore it.
jtag newtap $_CHIPNAME tap -irlen 10 -ignore-version \
	-expected-id 0x042A2093 \
	-expected-id 0x042A4093 \
	-expected-id 0x042A8093 \
	-expected-id 0x042AC093 \
	-expected-id 0x04244093 \
	-expected-id 0x0424A093 \
	-expected-id 0x0424C093 \
	-expected-id 0x04250093 \
	-expected-id 0x04252093 \
	-expected-id 0x04256093 \
	-expected-id 0x0423A093 \
	-expected-id 0x04286093 \
	-expected-id 0x04288093 \
	-expected-id 0x042C4093 \
	-expected-id 0x042CA093 \
	-expected-id 0x042CC093 \
	-expected-id 0x042D0093

pld create $_CHIPNAME.pld virtex2 -chain-position $_CHIPNAME.tap
# cfg_out cfg_in jprogb jstart jshutdown user1-4
virtex2 set_instr_codes $_CHIPNAME.pld 0x3C4 0x3C5 0x3CB 0x3CC 0x3CD
virtex2 set_user_codes $_CHIPNAME.pld 0x3C2 0x3C3 0x3E2 0x3E3
