Beispiel #1
0
 def test_minimal_sequence_visualize_tree(self):
     s = Sequence.from_file(testpath +
                            "/test_sequences/minimal_sequence.xml")
     s.resolve_references()
     tree = _Sequence_verification.Tree(sequence=s, control_values={})
     tree.build()
     tree.visualize()
Beispiel #2
0
 def test_detect_when_sequence_has_infinite_subloop(self):
     s = Sequence.from_file(
         testpath + "/test_sequences/minimal_sequence_with_subloop.xml")
     s.resolve_references()
     tree = _Sequence_verification.Tree(sequence=s, control_values={})
     with self.assertRaises(InvalidSequenceException):
         tree.build()
     tree.visualize()
Beispiel #3
0
 def test_detect_when_sequence_never_terminates_at_all(self):
     s = Sequence.from_file(
         testpath + "/test_sequences/minimal_sequence_with_loop.xml")
     s.resolve_references()
     tree = _Sequence_verification.Tree(sequence=s, control_values={})
     tree.build()
     tree.visualize()
     with self.assertRaises(InvalidSequenceException):
         tree.check()
Beispiel #4
0
    def _verify_variant(self, variant, length):
        control_values = self.get_control_values(variant)
        for channel in self.sequence_channels:
            channel.verify(control_values, length)

        jump_destinations = self.get_jump_destinations(variant, passing=False)
        for channel in self._control_channels:
            channel.verify_window_links(control_values, jump_destinations)
            channel.verify_order(control_values)

        jump_times = [
            jump.time.get_time(control_values)
            for jump in self.jumps.itervalues()
        ]
        if len(jump_times) != len(set(jump_times)):
            # Note: It might be that the jumps are scheduled for the same
            # FPGA time even though the times here are different, but in this
            # case it is still clear which jump is supposed to happen first.
            raise InvalidSequenceException(msg="Jumps with identical time in "
                                           "variant %i." % variant,
                                           object=self)

        start_times = [
            window.get_times(control_values)[0]
            for window in self.time_windows.values()
        ]
        end_times = [
            window.get_times(control_values)[1]
            for window in self.time_windows.values()
        ]
        window_times = start_times + end_times
        if len(set(window_times)) + len(jump_times)\
                != len(set(window_times + jump_times)):
            raise InvalidSequenceException(
                msg="At least one StartPoint/EndPoint with the same "
                "time as a JumpPoint in variant %i." % variant,
                object=self)

        tree = _Sequence_verification.Tree(self, control_values)
        tree.build()
        try:
            tree.check()
        except InvalidSequenceException as e:
            tree.visualize()
            raise e