################################################################################ File Name: morphio.tcl Version: 1.0 Disclaimer: Copyright (c) 2003 Altera Corporation. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ################################################################################ Introduction ============== The MorphIO software enables user to generate SVF, JAM and RAW files from a given SOF to reconfigure I/Os of Altera devices that supports CONFIG_IO instruction. Package Contents ================== The package contains this "Readme.txt" file as well as "morphio.tcl" file. The "Readme.txt" file describes how to use the "morphio.tcl" Tcl script. The "morphio.tcl" is a Tcl script that generate SVF, JAM, and RAW files from a given SOF to reconfigure I/O pins of Altera devices that supports CONFIG_IO instruction. How to Use MorphIO ==================== Syntax -------- The syntax of using MorphIO software is: morphio ?options? where is the SOF input file together with the path leading to it is the output filename together with the path leading to it ?options? -s or –S generate SVF file -j or –J generate JAM file -r or –R generate RAW file There is no need to put extension to the field as MorphIO will append the appropriate extension to the output files: - The generated SVF file will be named .svf - The generated JAM file will be named .jam - The generated RAW file will be named @.raw The field in the generated RAW file signify the length of the IOCSR shift register. Since a byte (8 bits) is the smallest unit a computer can write to the file system, the field serves as the exact number of bits the user needs to clock into the IOCSR shift register during I/O. Any variation in clocking number will damage the device. The field is not found in the output filename of SVF and JAM format because the routines inside already specify the exact number of bits to be clocked in appropriately. Examples: 1) morphio design1.sof design1 This example generates “design1.svf” as default output file. 2) morphio design2.sof dsgn2 –j -r This example generates “dsgn2.jam” and “dsgn2@13646.raw” as output files. Note that using optional switches will override the default settings i.e. generate SVF file. Also note the output filename does not need to be same as the input SOF filename. 3) morphio “c:/My Design/design3.sof” “d:/Test Design/test” –s -j This example generates “test.svf” and “test.jam” as output files in their respective paths. Note that forward slash is used in the path as opposed to backslash in Windows environment. This is due to the way Tcl handles paths. Executing MorphIO =================== Altera Quartus II software contains a built-in Tcl interpreter and can be used to run the MorphIO software. The MorphIO software can be used: - Interactively in Quartus II Tcl Console Window - Interactively in any Tcl interpreter shell such as Tclsh and Wish - DOS or UNIX command line prompt via quartus_cmd executable - DOS or UNIX command line prompt via any Tcl interpreter shell Using MorphIO Interactively ----------------------------- In Quartus II Tcl Console Window or any Tcl interpreter shell, type: source morphio.tcl morphio ?options? The user can also embed the above lines in a batch job Tcl script to automate generations. Using MorphIO via Command Line Prompt --------------------------------------- The user need to create a Tcl script containing the above lines first. Then, type: - quartus_cmd -f if using quartus_cmd executable, or - tclsh if using any Tcl interpreter shell. Likewise, the user can also embed it in a batch job Tcl script to automate generations. Using SVF Output File ======================= Below shows the contents of the generated SVF file: TRST ABSENT; ENDDR IDLE; ENDIR IDLE; STATE IDLE; SIR 10 TDI (00D); SDR 13646 TDI (...); STATE RESET; STATE IDLE; The first line denotes that the TRST pin is unused. The two subsequent lines prompt the SVF parser to bring the JTAG state machine back to IDLE state after every instruction and data. The I/O reconfiguration process starts in IDLE state and proceed to execute the CONFIG_IO instruction (with code 00D). This is followed by the long IOCSR data being shifted in (shown by “…”). Since there is no more JTAG instruction follows, a cycle through the RESET state and back to IDLE state is executed. The algorithm is very straight forward and simple. The user can copy and embed this routine into any existing SVF-based test routines to perform I/O reconfiguration. Using JAM Output File ======================== Below shows the contents of the generated SVF file: NOTE MAX_FREQ "10000000"; ACTION CONFIG_IO = EXECUTE; PROCEDURE EXECUTE; BOOLEAN X = 0; DRSTOP IDLE; IRSTOP IDLE; STATE IDLE; IRSCAN 10, $00D; DRSCAN 13646, $...; STATE RESET; STATE IDLE; EXIT 0; ENDPROC; The first line denotes that the recommended maximum frequency for TCK is 10MHz. The action name for I/O reconfiguration procedure is “CONFIG_IO”. The rest is the same as stated in “Using SVF Output File” section. Again, the user can copy and embed this procedure into any existing JAM-based test routines to perform I/O reconfiguration. To use it with Altera’s JAM Player, type: jam –aCONFIG_IO .jam Using RAW Output File ======================= The data in RAW output file is in packed binary format, meaning that each bit in the file is an IOCSR data. The RAW output file is generated in “little endian” order. Therefore, the LSB bit of the first byte read from the file is the IOCSR LSB bit. To reconfigure I/Os, the IOCSR LSB bit is the first bit to be shifted into the IOCSR shift register. Note that the field in the filename should be taken into account when the last byte is read from the file. It is the LSB portion, not MSB, of the last byte to be shifted into IOCSR. For example, supposed there is remaining 3 bits left to be shifted into the IOCSR, the user should read the 3 LSB bits of the last byte to shift them into the IOCSR. Support ========= For more information and support, please contact Altera Applications at 1-800-800-3753 or visit www.altera.com.