コード例 #1
0
        public void ConstructorTest4()
        {
            const string sourceName = "test";

            RoutineBuilder rb = new RoutineBuilder("main", sourceName);
            {
                var r0 = rb.Load(Parameter.GetBoolean(true), RoutineBuilder.NewAssign);
                var r1 = rb.Load(Parameter.GetBoolean(true), RoutineBuilder.NewAssign);

                rb.Store(r0, Parameter.GetReference("x"));
                rb.Store(r1, Parameter.GetReference("y"));

                var r2 = rb.Load(Parameter.GetReference("x"), RoutineBuilder.NewAssign);
                var r3 = rb.Load(Parameter.GetReference("y"), RoutineBuilder.NewAssign);

                var r4 = rb.Not(Parameter.GetRegister(r2), RoutineBuilder.NewAssign);
                var r5 = rb.Not(Parameter.GetRegister(r3), RoutineBuilder.NewAssign);

                var r6 = rb.BitwiseAnd(Parameter.GetRegister(r2), Parameter.GetRegister(r5), RoutineBuilder.NewAssign);
                var r7 = rb.BitwiseAnd(Parameter.GetRegister(r3), Parameter.GetRegister(r4), RoutineBuilder.NewAssign);

                var r8 = rb.BitwiseOr(Parameter.GetRegister(r6), Parameter.GetRegister(r7), RoutineBuilder.NewAssign);

                rb.Return(Parameter.GetRegister(r8));
            }
            Routine routine = rb.Build();
            var     k       = routine.Dump();

            RoutineVerifier rv = new RoutineVerifier(routine);

            Assert.IsTrue(rv.Verify());

            ExecuteEngine ee         = new ExecuteEngine(routine);
            var           luryObject = ee.Execute();
        }
コード例 #2
0
        public void ConstructorTest3()
        {
            const string sourceName = "test";

            RoutineBuilder rb = new RoutineBuilder("main", sourceName);
            {
                var inputX = Parameter.GetBoolean(true);
                var inputY = Parameter.GetBoolean(false);

                var r0 = rb.Not(inputX, RoutineBuilder.NewAssign);
                var r1 = rb.Not(inputY, RoutineBuilder.NewAssign);

                var r2 = rb.BitwiseAnd(inputX, Parameter.GetRegister(r1), RoutineBuilder.NewAssign);
                var r3 = rb.BitwiseAnd(Parameter.GetRegister(r0), inputY, RoutineBuilder.NewAssign);

                var r4 = rb.BitwiseOr(Parameter.GetRegister(r2), Parameter.GetRegister(r3), RoutineBuilder.NewAssign);

                rb.Return(Parameter.GetRegister(r4));
            }
            Routine routine = rb.Build();
            var     k       = routine.Dump();

            RoutineVerifier rv = new RoutineVerifier(routine);

            Assert.IsTrue(rv.Verify());

            ExecuteEngine ee         = new ExecuteEngine(routine);
            var           luryObject = ee.Execute();
        }