Spartan-3 devices have a configuration register called IDCODE. What is it, and how do I access it?
The IDCODE register is a configuration register that is separate from the JTAG register of the same name. The beginning of the bitstream contains a command that writes a value, which represents the IDCODE of the target device, to this IDCODE register. This value is compared to an internal constant that represents the true IDCODE of the device. If these values are the same, configuration can continue. If they are different, the bitstream is incorrectly targeted, configuration stops, and the INIT pin goes Low. Consequently, it is impossible to configure a Spartan-3 device with a bitstream intended for a different device size or architecture.
To read the IDCODE register through the SelectMAP port (readback cannot be done via serial modes), the SelectMAP port must persist after configuration (set the BitGen option "-g Persist:Yes"). This forces the configuration pins to retain their function after configuration is complete.
1. Send the synchronization word (0xAA995566).
2. Send the command to read the IDCODE register. The packet contains the type ("001"), read operation ("01), the address ("00000000001110"), RSVD bits ("00"), and the word count ("00000000001"). This produces a 32-bit packet header: 0x2801C001.
3. Send a 32-bit word of all 0's to flush the command pipe of the target device. This ensures the read command is properly handled by the configuration logic.
4. De-assert /CS and /RDWR for one CCLK cycle, and place the data bus into a 3-state condition.
5. Assert /CS.
6. Read the IDCODE from the SelectMAP data bus -- one byte per cycle for four cycles.