Factorial

 

Aim:

To implement a program that computes the factorial of a numbers.

 

Instructions:

The program to compute the factorial and its equivalent low-level instructions executed by the hardware. The low-level instructions used are:

assign It assigns a value to a variable
load It loads a value of a global or local variable to the given register
store It stores the value from the given register to the global or local variable
out It prints the output value to the screen.
in It reads the input from to user and stores in a variable
incr It increments a register value by 1
mul It multiplies the values contained in two registers and puts the result in the first register.
lte Check if the value in the first register is less than or equal to that of second register.
if_true Checks if the condition evaluated to true.
if_false Checks if the condition evaluated to false.
label Is used to mark the position in the low-level instructions to enable jumping to the marked position.
exit Signifies the end of program