Changeset 20

Show
Ignore:
Timestamp:
05/12/08 04:22:16 (2 years ago)
Author:
amirh
Message:
 
Location:
XilinxTools
Files:
4 added
1 modified

Legend:

Unmodified
Added
Removed
  • XilinxTools/xilinx_compile.py

    r18 r20  
    1 run, runXST, runNGDBuild, runMAP, runPAR, runBitgen = True, False, False, False, False, True 
    2  
     1run, runXST, runNGDBuild, runMAP, runPAR, runBitgen = True, True, True, True, True, True 
     2getXDL = True 
    33import os 
    44import subprocess 
     
    1515XilinxBin = os.path.join(XilinxPath,'bin\\nt') 
    1616 
     17 
     18tmp_dir = "tmp" 
     19hdp_dir = "xst" 
     20        
    1721syn_param = """ 
    1822# 
     
    8488 
    8589"""% locals() 
    86  
    87 tmp_dir = "tmp" 
    88 hdp_dir = "xst" 
    89  
    9090#Generate XST file 
    9191xst_file = open("%s.xst"%topmodule, mode='w') 
     
    156156 
    157157 
    158  
     158class XSTFile: 
     159    def __init__(self,name): 
     160        if os.path.exists(name): 
     161            self.File = open(name) 
     162         
     163 
     164class Synthesizer: 
     165    def __init__(self): 
     166        self.xst_path = os.path.join(XilinxBin,"xst") 
     167        self.XST_Attr_Map = {} 
     168         
     169        self.InputFileName 
     170        self.XST_Attr         
     171        self.InputFormat 
     172 
     173         
     174    def Run(self): 
     175        RunReq = [self.xst_path,"-ifn", "%s.xst"%topmodule, "-ofn", "%s_xst_log.syr"%topmodule] 
     176        print "Invoking Synthesis Tool: " + RunReq 
     177        self.retcode = subprocess.call(RunReq) 
     178  
     179def LogPrint(Port,File): 
     180    ln = Port.readline() 
     181    print ln 
     182    File.write(ln) 
     183     
     184#todo: define classes for each of the synthesis and placement files 
     185#create XML-RPC interface to marshal and demarshal components and invoke toolchain 
    159186if __name__ == "__main__": 
    160187    if run: 
     
    163190            xst_path = os.path.join(XilinxBin,"xst") 
    164191            retcode = subprocess.call([xst_path,"-ifn", "%s.xst"%topmodule, "-ofn", "%s_xst_log.syr"%topmodule]) 
    165  
    166192        if runNGDBuild:     
    167193            #Invoke NGDBuild 
     
    174200            map_path = os.path.join(XilinxBin,"map") 
    175201            retcode = subprocess.call([map_path, '-p', part, '-cm', 'area', '-pr', 'b', '-k', '4', '-c', '100', '-tx', 'off', '-o', '%s_map.ncd'%topmodule, '%s.ngd'%topmodule, '%s.pcf'%topmodule]) 
    176  
     202            if genXDL: 
     203                xdl_path = os.path.join(XilinxBin,"xdl") 
     204                retcode = subprocess.call([xdl_path,'-ncd2xdl','%s_map.ncd'%topmodule]) 
    177205        if runPAR: 
    178206            #Invoke PAR 
    179207            par_path = os.path.join(XilinxBin,"par") 
    180208            retcode = subprocess.call([par_path, '-w', '-ol', 'std', '-t', '1', '%s_map.ncd'%topmodule, '%s_par.ncd'%topmodule, '%s.pcf'%topmodule]) 
    181  
     209            if genXDL: 
     210                xdl_path = os.path.join(XilinxBin,"xdl") 
     211                retcode = subprocess.call([xdl_path,'-ncd2xdl','%s_par.ncd'%topmodule]) 
    182212        if runBitgen: 
    183213            #Invoke Bitgen 
     
    186216            for opt in bit_gen_g_options: 
    187217                bitgen_arglist.append('-g') 
    188                 bitgen_arglist.append(opt) 
     218                bitgen_arglist.append('%s'%opt) 
    189219            retcode = subprocess.call(bitgen_arglist)