Esempio n. 1
0
    def __init__(self, file_path):
        DataFile.__init__(self, file_path)
        self.hspo = HSPICEOutput(self.file_path, True)

        # build hierarcical signal list
        self.circuit = Circuit(self.hspo.title, self)
        indep_name = self.hspo.signalnames[0]
        indep_type = self.hspo.get_signal_type(0)
        indep_signal = Signal(indep_name, indep_name, None, indep_type)
        indep_signal._set_parent(self.circuit)
        for i in range(len(self.hspo.get_signal_names()[1:])):
            signal_name = self.hspo.get_signal_name(i+1)
            signal_type = types[self.hspo.get_signal_type(i+1)]
            currentSubckt = self.circuit
            if signal_type == type.V:
                node_name = signal_name[2:-1]
                levels = node_name.split(".")
                if len(levels) > 1:
                    for level in levels[:-1]:
                        try:
                            currentSubckt = currentSubckt[level]
                        except:
                            newSubckt = Subcircuit(level)
                            currentSubckt.add_subcircuit(newSubckt)
                            currentSubckt = newSubckt
                signal = Signal("v(" + levels[-1] + ")", signal_name, indep_signal, signal_type)
            else:
                signal = Signal(signal_name, signal_name, indep_signal, signal_type)
            currentSubckt.add_signal(signal)
Esempio n. 2
0
 def test(file_path):
     try:
         hspo = HSPICEOutput(file_path, True)
         del hspo
         return True
     except:
         return False
Esempio n. 3
0
class HSPICEFile(DataFile):
    """Class to represent binary (post=1) HSPICE output (ac0, tr0, hb0, ss0, ls0, ...)"""

    @staticmethod
    def extensions():
        raise NotImplementedError

    @staticmethod
    def test(file_path):
        try:
            hspo = HSPICEOutput(file_path, True)
            del hspo
            return True
        except:
            return False

    def __init__(self, file_path):
        DataFile.__init__(self, file_path)
        self.hspo = HSPICEOutput(self.file_path, True)

        # build hierarcical signal list
        self.circuit = Circuit(self.hspo.title, self)
        indep_name = self.hspo.signalnames[0]
        indep_type = self.hspo.get_signal_type(0)
        indep_signal = Signal(indep_name, indep_name, None, indep_type)
        indep_signal._set_parent(self.circuit)
        for i in range(len(self.hspo.get_signal_names()[1:])):
            signal_name = self.hspo.get_signal_name(i+1)
            signal_type = types[self.hspo.get_signal_type(i+1)]
            currentSubckt = self.circuit
            if signal_type == type.V:
                node_name = signal_name[2:-1]
                levels = node_name.split(".")
                if len(levels) > 1:
                    for level in levels[:-1]:
                        try:
                            currentSubckt = currentSubckt[level]
                        except:
                            newSubckt = Subcircuit(level)
                            currentSubckt.add_subcircuit(newSubckt)
                            currentSubckt = newSubckt
                signal = Signal("v(" + levels[-1] + ")", signal_name, indep_signal, signal_type)
            else:
                signal = Signal(signal_name, signal_name, indep_signal, signal_type)
            currentSubckt.add_signal(signal)

    def get_sweep_names(self):
        return self.hspo.get_sweep_names()

    def get_sweep_data(self):
        return self.hspo.get_sweep_data()

    def get_data(self, signal):
        signal_index = self.hspo.get_signal_index(signal.full_name)
        return self.hspo.get_signal(signal_index)