以下 Tcl 脚本可自动执行内存初始化文件 (。mif) 以 Hexadecimal (Intel-Format) 文件(.hex)为一个称为mif2hex的 Quartus® II 软件实用程序进行转换。将下面的脚本复制并粘贴到名为mif_to_hex.tcl的文件中,并使用以下命令运行:quartus_sh -t mif_to_hex.tcl *.mif
global quartus if { 0 == [llength (args)] } { post_message "Usage: quartus_sh -t [info script] " } else { set file_pattern [lindex (args) 0] foreach mif_name [glob ] { # Rename to .hex set rootname [file rootname ] set hex_name .hex if { [catch { qexec "[file join (binpath) mif2hex] " } res] } { post_message -type error break } else { post_message "Converted to " } } }