Ejemplo n.º 1
0
    def test_synthesize(self):
        self.f_un.sys_safety = []  # Make it realizable
        mach = gr1cint.synthesize(self.f_un,
                                  init_option="ALL_ENV_EXIST_SYS_INIT")
        assert mach is not None
        assert len(mach.inputs) == 1 and mach.inputs.has_key("x")
        assert len(mach.outputs) == 1 and mach.outputs.has_key("y")

        mach = gr1cint.synthesize(self.dcounter,
                                  init_option="ALL_ENV_EXIST_SYS_INIT")
        assert mach is not None
        assert len(mach.inputs) == 0
        assert len(mach.outputs) == 1 and mach.outputs.has_key("y")
        assert len(mach.states) == 3

        # In the notation of gr1c SYSINIT: True;, so the strategy must
        # account for every initial state, i.e., for y=0, y=1, y=2, ...
        self.dcounter.sys_init = []
        mach = gr1cint.synthesize(self.dcounter,
                                  init_option="ALL_INIT")
        assert mach is not None
        print mach
        assert len(mach.inputs) == 0
        assert len(mach.outputs) == 1 and mach.outputs.has_key("y")
        assert len(mach.states) == 7
Ejemplo n.º 2
0
    def test_synthesize(self):
        self.f_un.sys_safety = []  # Make it realizable
        mach = gr1cint.synthesize(self.f_un)
        assert mach is not None
        assert len(mach.inputs) == 1 and mach.inputs.has_key("x")
        assert len(mach.outputs) == 1 and mach.outputs.has_key("y")

        mach = gr1cint.synthesize(self.dcounter)
        assert mach is not None
        assert len(mach.inputs) == 0
        assert len(mach.outputs) == 1 and mach.outputs.has_key("y")
        assert len(mach.states) == 3
Ejemplo n.º 3
0
def synth_init_illegal_check(init_option):
    spc = GRSpec()
    gr1cint.synthesize(spc, init_option=init_option)