Hello fellows! so far we have talk about basics about the JTAG. So I was thinking about explain how the JTAG state machine works will be more helpful for those who new to FPGA.

So, before we talk about the state machine, lets see what is the state machine?
So, this is the state machine of the JTAG state machine. At first I will assume you know nothing about this states or anything.
Well, the Test-Logic-Reset is ware JTAG does not do anything, just keep in rest until a communication happen. So, when you start a communication, JTAG will cange it’s state to Run-Test/Idle state. So, on last post (Part 2) we talk about 4 wires (TMS, TDI, TDO and Clk). The TMS is the wire which control the state of this state machine. TDI input data to the JTAG and TDO get output from the JTAG(This is just for you to understand, I have explain this on part 2 post)
When you gives only ‘1’ for TMS, the JTAG will goes to Test-Logic-Reset from where ever your current state is. As long as you sent ‘1’ for TMS, it keep on Test-Logic-Reset.
Let’s assume we are now at Test-Logic-Reset. If you sent ‘0’ to TMS now, you will got to Run-Test/Idle state. So now you are about to start a communication. As we talked early, there are many kind of instructions you can sent from JTAG. For that you need to refer the datasheet of the FPGA. So there are bits for different commands. For eg: lets say for the ID code, you need to enter ‘111’ (NOTE: This may different from FPGA to FPGA) To enter ID code, first we need to got to Shift-IR state (IR is refer to Instruction Register). To go to Shift-IR state, first we need to go to from Run-Test/Idle to Select DR-Scan state. For that sent TMS = ‘1’. Then we need to go to Select IR-Scan. For that we need to sent another TMS = ‘1’ with the clock pulse. Then we have to go the Capture-IR state. For that sent TMS = ‘0’. Then to go to Shift-IR state, sent TMS = ‘0’. Then keep TMS = ‘0’ until you sent the data to the Shift-IR state. Then sent TDI = ‘1’ and TDI = ‘1’ for sent first 2 bits in our example. So while sending the last TDI bit, you can change the state. For that according to out example, sent TDI = ‘1’ and TMS = ‘1’ at once. Then we change to state Exit-IR. After that to update the IR, sent ‘1’ to TMS again. Then you can sent ‘1’s for TMS to go to Test-Logic-Reset or you can sent bit to go to Shift-DR to read the ID code. 
If you are reading the ID code, then you need to go to Shift-DR first, then read the value from the TDO. So this is how basically JTAG works.
I think it contain a big information, hope you got everything clearly 🙂

***Please note that all of the content on this post was originally published on champlnx.blogspot.com. We have migrated these posts to www.champlnx.com for your convenience and continued access.

Leave a Reply

Your email address will not be published. Required fields are marked *