What is the difference between stack based VM and register based VM?
The stack based VM use a memory structure where the operands are stored in a stack data structure. They generally use the LIFO to push and POP value to do the operations. This mean that the VM don't really care about the operands addresses because the POP will give the next one. And the register based implementation is the oposite. They are ni PUSH or POP operation. The instruction need to contains the addresses (the registers) of the operands. Simple exemple of an addition with assembler look alike code: Stack base: POP 2 # get value POP 3 # get Value ADD 2, 2, result # make the addition PUSH result # store the value Register based: ADD R1, R2, R3 ; # We had the contant of R1 and R2 in R3
Problem Statement Given two integers a and b, your task is to calculate and print the following four values:
Please help, any idea?
Loop question, I've tried everything that I knew I just don't know. Please help me solve it out
Help me solve this (using loop)