//Info: Sample template for programming XILINX XCFxx PROMS
//Info: Created with output from Impact

--LITERAL START
TRST OFF;
ENDIR IDLE;
ENDDR IDLE;
STATE RESET;
STATE IDLE;
TIR 0 ;
HIR 0 ;
TDR 0 ;
HDR 0 ;
TIR 0 ;
HIR 0 ;
HDR 0 ;
TDR 0 ;
//Loading device with 'idcode' instruction.
SIR 8 TDI (fe) SMASK (ff) ;
SDR 32 TDI (00000000) SMASK (ffffffff) TDO ($ID$) MASK ($IDMASK$) ;
//Loading device with 'conld' instruction.
SIR 8 TDI (f0) ;
RUNTEST 110000 TCK;
//Check for Read/Write Protect.
SIR 8 TDI (ff) TDO (01) MASK (07) ;
TIR 0 ;
HIR 0 ;
TDR 0 ;
HDR 0 ;
TIR 0 ;
HIR 0 ;
TDR 0 ;
HDR 0 ;
STATE RESET;
// Loading devices with 'ispen' or 'bypass'  instruction.
SIR 8 TDI (e8) ;
SDR 6 TDI (34) SMASK (3f) ;
// Loading device with 'faddr' instruction.
SIR 8 TDI (eb) ;
SDR 16 TDI (0001) SMASK (ffff) ;
RUNTEST 1 TCK;
RUNTEST 1 TCK;
// Loading device with 'ferase' instruction.
SIR 8 TDI (ec) ;
RUNTEST 1 TCK;
RUNTEST 15000000 TCK;
// Loading devices with 'conld' or 'bypass' instruction.
SIR 8 TDI (f0) ;
RUNTEST 110000 TCK;
STATE RESET;
// Loading devices with 'ispen' or 'bypass'  instruction.
SIR 8 TDI (e8) ;
SDR 6 TDI (34) SMASK (3f) ;
--END

$ADDRESS(0x0000)$
$STEP(0x0020)$

--REPEAT START
// Loading device with a 'fdata0' instruction.
SIR 8 TDI (ed) ;
SDR $BSIZE$ TDI ($DATA_INV(BSIZEB)$) SMASK ($FILL(0xFF,BSIZEB)$) ;
ENDIR IDLE;
RUNTEST 1 TCK;
RUNTEST 1 TCK;
// Loading device with a 'faddr' instruction.
SIR 8 TDI (eb) ;
SDR 16 TDI ($ADDRESS$) SMASK (ffff) ;
RUNTEST 1 TCK;
RUNTEST 1 TCK;
// Loading device with a 'fpgm' instruction.
ENDIR IRPAUSE;
SIR 8 TDI (ea) ;
RUNTEST 1 TCK;
RUNTEST 14000 TCK;
--END

--LITERAL START
// Loading device with a 'faddr' instruction. 
SIR 8 TDI (eb) ;
SDR 16 TDI (0001) ;
ENDIR IDLE;
RUNTEST 1 TCK;
// Loading device with 'serase' instruction.
SIR 8 TDI (0a) ;
RUNTEST 37000 TCK;
// Loading devices with 'conld' or 'bypass' instruction.
SIR 8 TDI (f0) ;
RUNTEST 110000 TCK;
TIR 0 ;
HIR 0 ;
HDR 0 ;
TDR 0 ;
//Loading device with 'ispen' instruction.
SIR 8 TDI (e8) ;
SDR 6 TDI (34) SMASK (3f) ;
//Loading device with 'conld' instruction.
SIR 8 TDI (f0) ;
RUNTEST 110000 TCK;
//Loading device with 'ispen' instruction.
SIR 8 TDI (e8) ;
SDR 6 TDI (34) ;
--END

$REWIND$
$ADDRESS(0x0000)$
$STEP(0x0040)$

--REPEAT START
// Loading device with a 'faddr' instruction. 
SIR 8 TDI (eb) ;
SDR 16 TDI ($ADDRESS$) SMASK (ffff) ;
RUNTEST 1 TCK;
RUNTEST 1 TCK;
// Loading device with a 'fvfy0' instruction. 
SIR 8 TDI (ef) ;
RUNTEST 1 TCK;
RUNTEST 50 TCK;
SDR $BSIZE2$ TDI ($FILL(0x00,BSIZEB2)$) SMASK ($FILL(0xFF,BSIZEB2)$) TDO ($DATA_INV(BSIZEB2)$) MASK ($FILL(0xFF,BSIZEB2)$) ;
--END

--REPEAT UNTIL MSIZE
// Loading device with a 'faddr' instruction. 
SIR 8 TDI (eb) ;
SDR 16 TDI ($ADDRESS$) SMASK (ffff) ;
RUNTEST 1 TCK;
RUNTEST 1 TCK;
// Loading device with a 'fvfy0' instruction. 
SIR 8 TDI (ef) ;
RUNTEST 1 TCK;
RUNTEST 50 TCK;
SDR $BSIZE2$ TDI ($FILL(0xFF,BSIZEB2)$) SMASK ($FILL(0xFF,BSIZEB2)$) TDO ($FILL(0xFF,BSIZEB2)$) MASK ($FILL(0xFF,BSIZEB2)$) ;
--END

--LITERAL START
//Loading device with 'conld' instruction.
SIR 8 TDI (f0) ;
RUNTEST 110000 TCK;
//Loading device with 'ispen' instruction.
SIR 8 TDI (e8) ;
SDR 6 TDI (34) SMASK (3f) ;
//Loading device with 'ispen' instruction.
SIR 8 TDI (e8) ;
SDR 6 TDI (34) ;
// Loading device with a 'faddr' instruction. 
SIR 8 TDI (eb) TDO (00) MASK (00) ;
SDR 16 TDI (8000) SMASK (ffff) ;
RUNTEST 1 TCK;
RUNTEST 1 TCK;
// Loading device with a 'fdata3' instruction. 
SIR 8 TDI (f3) TDO (00) ;
SDR 3 TDI (07) SMASK (07) TDO (00) MASK (00) ;
// Loading device with a 'fpgm' instruction. 
SIR 8 TDI (ea) TDO (00) ;
RUNTEST 1 TCK;
RUNTEST 14000 TCK;
// Loading device with a 'fvfy3' instruction. 
SIR 8 TDI (e2) TDO (00) ;
RUNTEST 1 TCK;
RUNTEST 50 TCK;
SDR 3 TDI (07) TDO (07) ;
//Loading device with 'conld' instruction.
SIR 8 TDI (f0) ;
RUNTEST 110000 TCK;
//Loading device with 'ispen' instruction.
SIR 8 TDI (e8) ;
SDR 6 TDI (34) SMASK (3f) ;
//Loading device with 'conld' instruction.
SIR 8 TDI (f0) ;
RUNTEST 110000 TCK;
// Loading device with a 'config' instruction. 
SIR 8 TDI (ee) TDO (00) ;
RUNTEST 50 TCK;
//Loading device with 'bypass' instruction.
SIR 8 TDI (ff) ;
TIR 0 ;
HIR 0 ;
HDR 0 ;
TDR 0 ;
TIR 0 ;
HIR 0 ;
HDR 0 ;
TDR 0 ;
TIR 0 ;
HIR 0 ;
TDR 0 ;
HDR 0 ;
SIR 8 TDI (ff) ;
SDR 1 TDI (00) SMASK (01) ;
--END
