Learn with SHAKTI

Factorial of a number


The following assembly program calculates the factorial of a number. The number to calculate factorial is stored in a memory location (_data1 + 4). The result is stored in memory location (_data1+8). The '_data1' is a label.

Before starting, please ensure spiking folder is downloaded .

Open a file in a text editor and save it inside spiking folder


or

factorial.S content:

Compile


Before starting compilation, Please check if the shakti-tools are successfully installed.

Please ensure you're inside spiking folder and run the below command

On successful compilation, an executable binary named factorial.elf will be generated.

Execute


The asm program can be run using spike, or with RISC-V GDB or using Axtix-7 100t