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

# xilinx virtex 5
# https://docs.xilinx.com/v/u/en-US/ug191

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

# the 4 top bits (28:31) are the die stepping. ignore it.
jtag newtap $_CHIPNAME tap -irlen 10 -ignore-version \
	-expected-id 0x0286E093 \
	-expected-id 0x02896093 \
	-expected-id 0x028AE093 \
	-expected-id 0x028D6093 \
	-expected-id 0x028EC093 \
	-expected-id 0x0290C093 \
	-expected-id 0x0295C093 \
	-expected-id 0x02A56093 \
	-expected-id 0x02A6E093 \
	-expected-id 0x02A96093 \
	-expected-id 0x02AAE093 \
	-expected-id 0x02AD6093 \
	-expected-id 0x02AEC093 \
	-expected-id 0x02B0C093 \
	-expected-id 0x02B5C093 \
	-expected-id 0x02E72093 \
	-expected-id 0x02E9A093 \
	-expected-id 0x02ECE093 \
	-expected-id 0x02F3E093 \
	-expected-id 0x03276093 \
	-expected-id 0x032C6093 \
	-expected-id 0x04502093 \
	-expected-id 0x0453E093

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
