<commit_before>from hdl_toolkit.hdlObjects.portItem import PortItem


class SimSignal():
    """
    Class of signal simulation functions
    
    @ivar _writeCallbacks: list of callback functions(signal, simulator) which is called
                           when new (changed) value is written to this signal
    """

    def __init__(self):
        self._writeCallbacks = []
        self.simSensProcs = set()
        self.simRisingSensProcs = set()
        self.simFallingSensProcs = set()
        
    
    def simPropagateChanges(self, simulator):
        v = self._val
        self._oldVal = v

        for e in self.endpoints:
            if isinstance(e, PortItem) and e.dst is not None:
                e.dst.simUpdateVal(simulator, lambda v: (True, self._val))
        
        # run all sensitive processes    
        log = simulator.config.logPropagation
        for p in self.simSensProcs:        
            if log:
                log(simulator, self, p)
                
            simulator.addHwProcToRun(p)

        if self.simRisingSensProcs or self.simFallingSensProcs: 
            if v.val or not v.vldMask:
                for p in self.simRisingSensProcs:        
                    if log:
                        log(simulator, self, p)
                
                    simulator.addHwProcToRun(p)
            if not v.val or not v.vldMask:
                for p in self.simFallingSensProcs:        
                    if log:
                        log(simulator, self, p)<commit_msg>rm propagation to port connection, because it is managed by hdlSimulator<commit_after>from hdl_toolkit.hdlObjects.portItem import PortItem


class SimSignal():
    """
    Class of signal simulation functions
    
    @ivar _writeCallbacks: list of callback functions(signal, simulator) which is called
                           when new (changed) value is written to this signal
    """

    def __init__(self):
        self._writeCallbacks = []
        self.simSensProcs = set()
        self.simRisingSensProcs = set()
        self.simFallingSensProcs = set()
        
    
    def simPropagateChanges(self, simulator):
        v = self._val
        self._oldVal = v

        # run all sensitive processes    
        log = simulator.config.logPropagation
        for p in self.simSensProcs:        
            if log:
                log(simulator, self, p)
                
            simulator.addHwProcToRun(p)

        if self.simRisingSensProcs or self.simFallingSensProcs: 
            if v.val or not v.vldMask:
                for p in self.simRisingSensProcs:        
                    if log:
                        log(simulator, self, p)
                
                    simulator.addHwProcToRun(p)
            if not v.val or not v.vldMask:
                for p in self.simFallingSensProcs:        
                    if log:
                        log(simulator, self, p)
{'fraction_non_alphanumeric': 0.06639288158795345, 'fraction_numerical': 0.0, 'mean_word_length': 1.4855442176870748, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7246734', 'n_tokens_mistral': 836, 'n_tokens_neox': 802, 'n_words': 218}