src/main.cpp
/// ***************************************************************************************************************************
/// Test the vector addition on CPU using the sequential C++ BC interpreter.
/// ***************************************************************************************************************************
Test the vector addition on CPU using the sequential C++ BC interpreter.
Test the vector addition on CPU using the sequential C ++ BC interpreter .
void testVectorAddition() {
    vector<int> vectorAdd = {
            ICONST, 0,
            DUP,
            ICONST, 10,
            IEQ,
            BRT, 23,
            DUP,    
            DUP,    
            GLOAD_INDEXED, 10,
            LOAD, 1,   
            GLOAD_INDEXED, 20,
            IADD,
            GSTORE_INDEXED, 0,
            ICONST1,
            IADD,
            BR, 2,
            POP,
            HALT
    };
    VM vm(vectorAdd,  0); 
    vm.setVMConfig(100, 100);
    vm.setTrace();
    vm.initHeap();
    vm.runInterpreter();
    vm.printHeap();
    cout << endl;
}
void testVectorAddition ( ) { vector < int > vectorAdd = { ICONST , 0 , DUP , ICONST , 10 , IEQ , BRT , 23 , DUP , DUP , GLOAD_INDEXED , 10 , LOAD , 1 , GLOAD_INDEXED , 20 , IADD , GSTORE_INDEXED , 0 , ICONST1 , IADD , BR , 2 , POP , HALT } ; VM vm ( vectorAdd , 0 ) ; vm . setVMConfig ( 100 , 100 ) ; vm . setTrace ( ) ; vm . initHeap ( ) ; vm . runInterpreter ( ) ; vm . printHeap ( ) ; cout << endl ; }
Test the vector addition on CPU using the sequential C++ BC interpreter.
Test the vector addition on CPU using the sequential C ++ BC interpreter .
// Vector addition in a LOOP // offset for each array to load // offset for each array to load // load from position 1