// ********************************************************************************************* // Description : C Program to calculate the Fibonacci numbers until a given number of terms // File : v1.0 // Project Version : [BCDC] Microtec Academy Course: Building a RISC-V CPU with SystemVerilog // Project : RISCV_IN3DAYS // ----- // Copyright (c) : 2025 Fraunhofer IIS, Department IDS // Created : 13.Oct.2025, 11:00:00 by Fuad Mammadzada (fuad.mammadzada@fau.de) // ----- // HISTORY : Date By Comments // ----------- --------- ------------------------------------------------- // ********************************************************************************************* asm(".global _start, halt; _start: lui sp 2; addi sp sp -4; jal x0 main"); int main() { int n = 10; // count of Fibonacci numbers to be evaluated int fib_number[20]; fib_number[0] = 0; fib_number[1] = 1; for (int i = 2; i < n; i++) { fib_number[i] = fib_number[i-1] + fib_number[i-2]; } asm("j halt"); }