Exemplo n.º 1
0
def setupMain(Env):
    params = logs.parse_args()
    Env.systemverilog = '-sv' in params
    Env.params = params
    if (len(params.keys()) == 1):
        if (params['fnames'] == []):
            print_help()
            logs.log_info('nothing given to do. exiting.')
            return
    Fnames = params['fnames']
    logs.log_info('fnames: %s' % (str(Fnames)))
    if ('-rundir' in params):
        Env.rundir = params['-rundir'][0]
        if not os.path.exists(Env.rundir):
            os.mkdir(Env.rundir)
    else:
        Env.rundir = '.'

    if ('-y' in params):
        Env.SearchDirs.extend(params['-y'])
    if ('-ext' in params):
        Env.VerilogExtensions.extend(params['-ext'])
    Env.GateLevelRead = ('-glv' in params)

    Env.read_verilog_file = read_verilog_file
    Env.read_gate_level_verilog_file = read_gate_level_verilog_file
    Env.params = params
    for Fname in Fnames:
        if Env.GateLevelRead:
            Env.read_gate_level_verilog_file(Fname, Env.rundir)
        else:
            Env.read_verilog_file(Fname, Env.rundir, Env)
        logs.record_directory(Fname, Env.SearchDirs)
Exemplo n.º 2
0
def main():
    Params = logs.parse_args()
    print(Params)
    Dirnames = Params['fnames']
    if '-lim' in Params:
        db.sizeLimit = int(Params['-lim'][0])
    if '-ignore' in Params:
        db.ignores = Params['-ignore']
    if '-m' in Params:
        db.MMM = Params['-m']
    db.DONT = '-dont' in Params
    if Dirnames == []:
        help()
        return
    for Dir in Dirnames:
        workOn(Dir)
Exemplo n.º 3
0
def main():
    global LIB_DFF, LIB_ABC
    if len(sys.argv) == 1:
        print(helpString)
        sys.exit()

    Args = logs.parse_args()
    print(Args)
    mvlgFile = Args['fnames'][0]
    wrds = mvlgFile.split('/')
    wrds = wrds[-1].split('.')
    Top = wrds[0]

    if '-top' in Args:
        Top = Args['-top'][0]

    if '-dff' in Args:
        LIB_DFF = Args['-dff'][0]

    if '-abc' in Args:
        LIB_ABC = Args['-abc'][0]

    STR = INCFILE

    if '-flat' in Args:
        STR += FLAT
    if '-scheme' in Args:
        STR += SCHEME

    wrds = mvlgFile.split('.')
    if wrds[-1] == 'mvlg':
        os.system('mvlg_to_one_file.py %s %s.all' % (mvlgFile, Top))
    else:
        os.system('/bin/cp %s %s.all' % (mvlgFile, Top))
    INC = STR.replace('ALLRTL', '%s.all' % (Top))
    INC = INC.replace('TOP', Top)
    INC = INC.replace('LIB_DFF', LIB_DFF)
    INC = INC.replace('LIB_ABC', LIB_ABC)
    Finc = open('%s.inc' % Top, 'w')
    Finc.write(INC)
    Finc.close()
    #    os.system('/usr/local//Cellar/yosys/0.9_2/bin/yosys -s %s.inc | tee log.yosys | tee %s.yosys.log '%(Top,Top))
    os.system(
        '~/external_software/tmp/yosys/yosys -s %s.inc | tee log.yosys | tee %s.yosys.log '
        % (Top, Top))
Exemplo n.º 4
0
def main():
    Params = parse_args()
    run_main(Params)
Exemplo n.º 5
0
def main():
    global observer
    if len(sys.argv)==1: 
        print HELP
        print PROTOTYPE
        return
    Args = logs.parse_args()
    if '-help' in Args:
        print HELP
        print PROTOTYPE
        return
        
    Fnames =Args['fnames']
    Fname= Fnames[0]
        
    if len(Fnames)>1:
        Python = Fnames[1]
    else:
        Python = False
    if '-end' in Args:
        endTime = int(Args['-end'][-1])
    else:
        endTime = -1
    if '-start' in Args:
        startTime = int(Args['-start'][-1])
    else:
        startTime = 0

    if Python:
        if '.py' in Python: 
            Python = Python[:-3]
        if '/' in Python:
            ww = string.split(Python,'/')
            Path = string.join(ww[:-1],'/')
            Module = ww[-1]
        else:
            Path = '.'
            Module = Python
        sys.path.append(Path)
     
        exec('global observer; from %s import observer,setVar'%Module)
    File = open(Fname)


    if '-path' in Args:
        mainPaths = Args['-path']
    else:
        mainPaths = False
    read_headers(File,mainPaths)
    logs.log_info('loaded %d nets and regs'%(len(Codes.keys())))
    if '-print' in Args:
        Whats = Args['-print']
        if 'paths' in Whats:
            for Path in allPaths:
                logs.log_info('path %s'%Path)
        if 'nets' in Whats:
            for Code in Codes:
                LL = Codes[Code]
                for Sig in LL:
                    logs.log_info('net %s %s'%(Code,Sig))
        return
        


    setVar('startTime',startTime)
    setVar('endTime',endTime)
#    skip_to_enddefinitions(File)
    if Python:
        work(File,startTime,endTime)
Exemplo n.º 6
0
def main():
    global observer
    if len(sys.argv) == 1:
        print HELP
        print PROTOTYPE
        return
    Args = logs.parse_args()
    if '-help' in Args:
        print HELP
        print PROTOTYPE
        return

    Fnames = Args['fnames']
    Fname = Fnames[0]

    if len(Fnames) > 1:
        Python = Fnames[1]
    else:
        Python = False
    if '-end' in Args:
        endTime = int(Args['-end'][-1])
    else:
        endTime = -1
    if '-start' in Args:
        startTime = int(Args['-start'][-1])
    else:
        startTime = 0

    if Python:
        if '.py' in Python:
            Python = Python[:-3]
        if '/' in Python:
            ww = string.split(Python, '/')
            Path = string.join(ww[:-1], '/')
            Module = ww[-1]
        else:
            Path = '.'
            Module = Python
        sys.path.append(Path)

        #        exec('global observer; from %s import observer,setVar'%Module)
        exec('global %s; import %s;   addMons(%s. Monitors); %s.peek=peek' %
             (Module, Module, Module, Module))

    Dump = '-dump' in Args
    if Dump:
        Foutname = Args['-dump'][0]
        if '.vcd' not in Foutname: Foutname += '.vcd'
        Dump = open(Foutname, 'w')

    if '-path' in Args:
        mainPaths = Args['-path']
    else:
        mainPaths = False

    File = open(Fname)
    read_headers(File, mainPaths, Dump)
    logs.log_info('loaded %d nets and regs' % (len(Codes.keys())))
    if '-print' in Args:
        Whats = Args['-print']
        if 'paths' in Whats:
            for Path in allPaths:
                logs.log_info('path %s' % Path)
        if 'nets' in Whats:
            for Code in Codes:
                LL = Codes[Code]
                for Sig in LL:
                    logs.log_info('net %s %s' % (Code, Sig))
        return

    if Python:
        setVar('startTime', startTime)
        setVar('endTime', endTime)
        work(File, startTime, endTime)

    if Dump:
        workDump(File, startTime, endTime, Dump)
        Dump.close()