In the XJTAG application note “Working with configured Xilinx and Altera devices” the point is made that the way to get the best test coverage is to test with blank devices.

Blanking a device has its own challenges – from generating a blank image to stopping the device from reconfiguring itself without having to blank the configuration device as well.

For Altera Cyclone III devices, if they are setup to use either Active Serial or Active Parallel configuration schemes there is an easy way to clear the devices using just a few lines of RAW JTAG. These devices support what Altera calls CONFIG_IO which has two useful instructions for clearing the configuration from a device.

The instructions are ACTIVE_DISENGAGE and PULSE_NCONFIG. These two commands are used in the following XJEase code example. First the configuration controller is halted so the device does not attempt to re-configure itself. Secondly the existing configuration is cleared.

ClearCycloneConfig ()(INT result)
  CONST INT ACTIVE_DISENGAGE := 0b1011010000;
  CONST INT PULSE_NCONFIG := 0b0000000001;

  JTAG
    IR "IC1" := ACTIVE_DISENGAGE;
    IRSCAN "IDLE";
    IR "IC1" := PULSE_NCONFIG;
    IRSCAN "IDLE";
  END;
END;

The above code is a complete XJEase function that can be called as part of a test run and will keep the Altera device blank until the power is cycled.