Programming Mimosa chips

From ift
Jump to: navigation, search

Overview

The system uses a C progarm named xsvfPlayer to read in JTAG configurations from an xsvf format binary file, and set up the JTAG pins to configure the front-end Mimosa chips. The xsvf binary file is generated from a readable text format svf file with Xilinx SVF-to-XSVF Writer - svf2xsvf.

In our system, we need to configure about 100 mimosa chips with different threshold voltages and other settings, sometime we also need to change these values online, it's not practical to generate a xsvf file for every chip. Instead, it's possible to have a template xsvf file and hack into this file to modify the corresponded byte values for every chip. So we need to know some fundamental informations of the xsvf file.

Multi-device JTAG chain

Normally when we want to access one of the devices in a JTAG chain with more than one device, we need to bypass all the others. When those devices are bypassed, they just connect their 1-bit bypass registers into the JTAG chain, it looks as below for the 1st chip in a 4-chip JTAG chain:

        _______chip1________     _2_     _3_     _4_    
TDI --> |0|1|..........|127| --> |0| ->  |0| ->  |0| -> TDO
        --------------------     ---     ---     ---

The JTAG bypass command is the one with all 1s for all command bits, and normally we can write zeros to the bypass registers.

Instead of adding bypass commands and all bypass register bits for every JTAG commands, there are header and trailer commands used to tell the JTAG controller to automatically add some header/trailer bits for instructions and data. TIR/HIR/TDR/HDR are the SVF header and trailer instructions, for Mimosa chips which have 5-bit commands, the 1st chip in a 4-chip JTAG chain should have a header/trailer setting like this:

TIR 0 ;   // No trailer in command
HIR 15 TDI (7fff) SMASK (7fff) ;  // 15 bits of bypass commands(all 1s) ahead of every command for the other 3 chips
TDR 0 ;   // No trailer in data
HDR 3 TDI (00) SMASK (00) ;     // 3 bits of 0s ahead of every data output for the three bypass registers.

SVF to XSVF

If we want to configure the 128-bit DAC register of the second Mimosa chip, normally we use svf commands like:

TIR 5 TDI (1f) SMASK (1f) ;     // 5 bits bypass command for chip1
HIR 10 TDI (3ff) SMASK (3ff) ;  // 10 bits bypass commands for chip3 and chip4;
TDR 1 TDI (00) SMASK (00) ;     // 1 bit for bypass register of chip1
HDR 2 TDI (00) SMASK (00) ;     // 2 bits for bypass registers of chip3 and chip4
SIR 5 TDI (0F) SMASK(1F);       // command: setting BIAS_DAC(0x0F)
SDR 128 TDI (64327676202076763220280a0a0a0a64);  // 128 bit output data, without input check.

After conversion we can get a text format xsvf file with commands as below:

XREPEAT(07)   0x20
XRUNTEST(04)  0x00000000
XSIR(02)      0x14 0x0fbfff
XSDRSIZE(08)  0x00000083
XTDOMASK(01)  0x0000000000000000000000000000000000
XSDRTDO(09)   0x0190c9d9d88081d9d8c880a02828282990 0x0000000000000000000000000000000000
XCOMPLETE(00) 

Notes: the numbers in bracket are the codes for the corresponded commands.

Dump of the binary format xsvf file:

00000000h: 07 20 04 00 00 00 00 02 14 0F BF FF 08 00 00 00
00000010h: 83 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000020h: 00 00 00 09 01 90 C9 D9 D8 80 81 D9 D8 C8 80 A0
00000030h: 28 28 28 29 90 00 00 00 00 00 00 00 00 00 00 00
00000040h: 00 00 00 00 00 00 00                           

Descriptions of xsvf file

Firstly specify the XREPEAT value, which is the number of times that TDO is tested against the expected value before a failure is issued:

XREPEAT(07)   0x20

then specify the number of TCK cycles to be applied in the Run-Test/Idle state after the end of one instruction/data command:

XRUNTEST(04)  0x00000000

the instruction becomes: 5 bits of bypass command 0x1F for chip1, 5 bits of 0x0F and two other five bits of 0x1F = b'11111011111111111111 = 0x0fbfff;

XSIR(02)      0x14 0x0fbfff     //0x14 is the number of instruction bits.

then follows with the number of data bits:

XSDRSIZE(08)  0x00000083        //128 bits + 3 bypass bits.

here we don't check the TDO out, so TDOMASK is set to all 0s, with 0s being added at the beginning(17 bytes):

XTDOMASK(01)  0x0000000000000000000000000000000000

shift out the number of bits as specified above, the value is added with one 0 at the begining and two 0s at the end: b'0 + 0x64327676202076763220280a0a0a0a64 + b'00 = 0x0190c9d9d88081d9d8c880a02828282990, compare the TDO value with the second argument, here we don't check, it is filled with all 0s. 0s being added to these two numbers at the beginning(17 bytes):

XSDRTDO(09)   0x0190c9d9d88081d9d8c880a02828282990 0x0000000000000000000000000000000000

finish the operation:

XCOMPLETE(00) 

Programming Mimosa chips

To be added.

Useful Links

  1. Serial Vector Format(SVF) Specification
  2. SVF and XSVF File Formats for Xilinx Devices