コード例 #1
0
ファイル: cardoon.py プロジェクト: AndySze/cardoon
def parse_net(filename, ckt = None):
    """
    Parse netlist file given in filename. If ckt is not given it
    parses in the circuit named 'main'. Returns analysisQueue with
    analyses to be performed.
    """
    if not ckt:
        ckt = cir.get_mainckt()
    return parse_file(filename, ckt)
コード例 #2
0
def parse_net(filename, ckt = None):
    """
    Parse netlist file given in filename. 

    If ckt is not given parses the circuit named 'main'. Returns
    analysisQueue with analyses to be performed.
    """
    if not ckt:
        ckt = cir.get_mainckt()
    return parse_file(filename, ckt)
コード例 #3
0
def run_netlist(fileName, circuitName=None, reset=True):
    """
    Read circuit and run analyses in netlist given in fileName 

    circuitName: name of circuit instance to be created, if None, use
    main circuit

    If reset == True, clear simulator state before reading netlist,
    otherwise append to any existing data.
    """
    if reset:
        reset_all()

    if circuitName:
        ckt = cir.Circuit(circuitName)
    else:
        ckt = cir.get_mainckt()        

    analysisQueue = parse_net(fileName, ckt)
    run_analyses(analysisQueue, ckt)
コード例 #4
0
ファイル: simulator.py プロジェクト: Jackieee/cardoon
def run_netlist(fileName, circuitName=None, reset=True):
    """
    Read circuit and run analyses in netlist given in fileName 

    circuitName: name of circuit instance to be created, if None, use
    main circuit

    If reset == True, clear simulator state before reading netlist,
    otherwise append to any existing data.
    """
    if reset:
        reset_all()

    if circuitName:
        ckt = cir.Circuit(circuitName)
    else:
        ckt = cir.get_mainckt()

    analysisQueue = parse_net(fileName, ckt)
    run_analyses(analysisQueue, ckt)
コード例 #5
0
def run_analyses(analysisQueue, ckt = None):
    """
    Run all analyses in analysisQueue applied to the provided circuit
    (or 'main' if no circuit provided). If queue is empty just print
    circuit.
    """
    if not ckt:
        ckt = cir.get_mainckt()
    # Perform requested analyses
    if analysisQueue:
        for an in analysisQueue:
            try:
                start = time.clock()
                an.run(ckt)
                elapsed = time.clock() - start
                print('{0} analysis time: {1} s\n'.format(an.anType, elapsed))
            except analyses.AnalysisError as ae:
                print(ae)
    else:
        print('Nothing to do. Printing circuit:\n')
        print(ckt.netlist_string())
        print(ckt.globals_to_str())
コード例 #6
0
ファイル: simulator.py プロジェクト: Jackieee/cardoon
def run_analyses(analysisQueue, ckt=None):
    """
    Run all analyses in analysisQueue applied to the provided circuit
    (or 'main' if no circuit provided). If queue is empty just print
    circuit.
    """
    if not ckt:
        ckt = cir.get_mainckt()
    # Perform requested analyses
    if analysisQueue:
        for an in analysisQueue:
            try:
                start = time.clock()
                an.run(ckt)
                elapsed = time.clock() - start
                print("{0} analysis time: {1} s\n".format(an.anType, elapsed))
            except analyses.AnalysisError as ae:
                print(ae)
    else:
        print("Nothing to do. Printing circuit:\n")
        print(ckt.netlist_string())
        print(ckt.globals_to_str())