Hi,
In a few words: jtag pins give you an access to two registers, IR (instruction) and DR (data, a set of registers actually, value in IR selects particular register to access). With SAMPLE instruction in IR you can read state of all pins from DR (one very long register with bit count ~ 3x pin count will be seen). Read this sampled value, then flip bits for pins you want to control, set EXTEST instruction into IR, write that prepared value into DR - pins will change. Now just use SAMPLE again to see the results.
More details: find a BSDL file for your particular device. It will look like this
http://bsdl.info/view.htm?sid=907f2d83182655ef88ca59b002289d77 A section beginning with "attribute INSTRUCTION_OPCODE" contains IR instruction values (i.e. EXTEST is 00000, SAMPLE is 00010)
"attribute BOUNDARY_LENGTH" is length of DR for sample/extest in bits (yes, huge 740 bits there)
"attribute BOUNDARY_REGISTER" section contains description of every bit of DR for sample/extest:
- bit position
- cell type (ignore it)
- port name (translate to real pin number using attribute PIN_MAP)
- cell function (single physical pin usually has 3 associated cells - an INPUT cell to read pin value, an OUTPUT cell to set pin value and an INTERNAL or CoNTROL type cell to control output enable)
- safe value (ignore it)
- control cell number (bit position of corresponding output enable cell for this output cell)
- control cell value that disables this output
- output value in disabled state
Example:
" 738 (BC_1, IO_0, INPUT, X)," &
" 737 (BC_1, IO_0, OUTPUT3, X, 736, 0,Z),"&
" 736 (BC_1, *, CONTROL, 0)," &
- these 3 cells are for pin E18 (from PIN_MAP attribute IO_0:E18), bit 738 is used to read pin state (in SAMPLE state), bit 737 holds an output value, to activate output we need to write 1 (inverted disval) to cell 736, which is, surprise, of type CONTROL