diff --git a/Rapport/Fibonnaci/plot.py b/Rapport/Fibonnaci/plot.py new file mode 100644 index 000000000..9f1a93988 --- /dev/null +++ b/Rapport/Fibonnaci/plot.py @@ -0,0 +1,61 @@ +import matplotlib.pyplot as plt +from sklearn.linear_model import LinearRegression +import numpy as np + +Y = [1100, 2150, 3200, 4250, 5300, 6350, 7400, 8450, 9500] +Y2 = [1100, 2150, 3200, 4250, 5300, 6350, 7400, 8450, 9500] +Y_ARM = [912, 1736 , 2560 , 3352, 4216, 5304 , 5840, 6704, 7464] +Y_ARMO3 = [173, 329, 480, 633, 789, 945, 1098, 1308, 1406] +Y_gcc = [2296, 5119, 6715, 9078, 10830, 12541, 15041, 16780, 18883] +Y_O3 = [165, 287, 380, 559, 900, 901, 776, 1122, 1574] + +f_RISCV1 = 50e6 +f_RISCV2 = 100e6 +f_ARM = 800e6 +f_PC = 2400e6 +X = [] + +for i in range(9) : + Y[i] = (Y[i]*1e9)/f_RISCV1 + Y2[i] = (Y2[i]*1e9)/f_RISCV2 + Y_ARM[i] = (Y_ARM[i]*1e9)/f_ARM + Y_ARMO3[i] = (Y_ARMO3[i]*1e9)/f_ARM + Y_gcc[i] = (Y_gcc[i]*1e9)/f_PC + Y_O3[i] = (Y_O3[i]*1e9)/f_PC + X.append(50*(1+i)) + +plt.scatter(X, Y, color="b", marker="x", label="RISCV 50 MHz") +plt.scatter(X, Y2, color="g", marker="x", label="RISCV 100 MHz") +plt.scatter(X, Y_ARM, color="b", label="mesures ARM") +plt.scatter(X, Y_ARMO3, color="g", label="mesures ARM -O3") +plt.scatter(X, Y_gcc, color="b",marker="*", label="desktop -O0 2,4Ghz") +plt.scatter(X, Y_O3, color="g", marker="*",label="desktop -O3 2,4Ghz") + +x = np.array(X).reshape(-1, 1) +y = np.array(Y).reshape(-1, 1) +y2 = np.array(Y2).reshape(-1, 1) +reg = LinearRegression().fit(x, y) +reg2 = LinearRegression().fit(x, y2) +print("score obtenu : " + str(reg.score(x, y))) +print("score obtenu : " + str(reg.score(x, y2))) +print("attente à zéro : {}".format(reg.intercept_)) +print("attente à zéro : {}".format(reg2.intercept_)) + +x_lin = [0, max(X)] +y_lin = [reg.predict(np.array([0]).reshape(-1, 1)), reg.predict(np.array([x_lin[1]]).reshape(-1, 1))] +y_lin2 = [reg2.predict(np.array([0]).reshape(-1, 1)), reg2.predict(np.array([x_lin[1]]).reshape(-1, 1))] +y_lin = [y_lin[0][0][0], y_lin[1][0][0]] +y_lin2 = [y_lin2[0][0][0], y_lin2[1][0][0]] + +# plt.plot(x_lin, y_lin, color = "r", label="RegLin 50 score : {:.4f}".format(reg.score(x, y))) +# plt.plot(x_lin, y_lin2, color = "r") +plt.yscale("log") + +plt.xlim([0, 500]) +plt.ylim([0, 1000000]) +plt.legend() +plt.title("Temps d'exécution en fonction de n_max") +plt.ylabel("T (ns)") +plt.xlabel("N_max") +plt.show() +plt.savefig("M2_SETI/A2/fibonacci/linéaire.png") \ No newline at end of file diff --git a/Rapport/Fibonnaci/time_exec_fibo.png b/Rapport/Fibonnaci/time_exec_fibo.png new file mode 100644 index 000000000..75333189b Binary files /dev/null and b/Rapport/Fibonnaci/time_exec_fibo.png differ diff --git a/fibonacci/main.bin b/fibonacci/main.bin new file mode 100644 index 000000000..ab659cb49 Binary files /dev/null and b/fibonacci/main.bin differ diff --git a/fibonacci/main.c b/fibonacci/main.c new file mode 100644 index 000000000..68558d0cf --- /dev/null +++ b/fibonacci/main.c @@ -0,0 +1,108 @@ +// ################################################################################################# +// # << NEORV32 - "Hello World" Demo Program >> # +// # ********************************************************************************************* # +// # BSD 3-Clause License # +// # # +// # Copyright (c) 2022, Stephan Nolting. All rights reserved. # +// # # +// # Redistribution and use in source and binary forms, with or without modification, are # +// # permitted provided that the following conditions are met: # +// # # +// # 1. Redistributions of source code must retain the above copyright notice, this list of # +// # conditions and the following disclaimer. # +// # # +// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of # +// # conditions and the following disclaimer in the documentation and/or other materials # +// # provided with the distribution. # +// # # +// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to # +// # endorse or promote products derived from this software without specific prior written # +// # permission. # +// # # +// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS # +// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # +// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # +// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # +// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE # +// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED # +// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # +// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED # +// # OF THE POSSIBILITY OF SUCH DAMAGE. # +// # ********************************************************************************************* # +// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting # +// ################################################################################################# + + +/**********************************************************************//** + * @file hello_world/main.c + * @author Stephan Nolting + * @brief Classic 'hello world' demo program. + **************************************************************************/ + +#include + + +/**********************************************************************//** + * @name User configuration + **************************************************************************/ +/**@{*/ +/** UART BAUD rate */ +#define BAUD_RATE 19200 +/**@}*/ + +void fibonnaci(uint32_t *n_max, uint32_t *f_n){ + uint32_t max = *n_max; + uint32_t fn_1 = 0; + uint32_t fn_copy = 1; + uint32_t fn_test = 1; + + for(uint32_t i=0; i show message if isa mismatch + + // say hello + neorv32_uart0_puts("Fibonnacci cycles measure :\n"); + neorv32_uart0_printf("NEORV32: Freq = %u\n",NEORV32_SYSINFO.CLK); + + for(uint8_t i=1; i<10; i++){ + n_max = 50; + Begin_Time = (long)neorv32_mtime_get_time(); + + for(uint32_t j=0; j<2*454546; j++){ + fibonnaci(&n_max, &f); + + } + End_Time = (long)neorv32_mtime_get_time(); + User_Time = End_Time - Begin_Time; + + neorv32_uart0_printf("NEORV32: mean cycles n_max = %u : %u\n",n_max, (uint32_t)User_Time); + } + neorv32_uart0_puts("end:\n"); + return 0; +} diff --git a/fibonacci/main.c.o b/fibonacci/main.c.o new file mode 100644 index 000000000..5ce34da9f Binary files /dev/null and b/fibonacci/main.c.o differ diff --git a/fibonacci/main.elf b/fibonacci/main.elf new file mode 100644 index 000000000..51a032d1b Binary files /dev/null and b/fibonacci/main.elf differ diff --git a/fibonacci/makefile b/fibonacci/makefile new file mode 100644 index 000000000..8f9e2fdc0 --- /dev/null +++ b/fibonacci/makefile @@ -0,0 +1,4 @@ +# Modify this variable to fit your NEORV32 setup (neorv32 home folder) +NEORV32_HOME ?= ../../.. + +include $(NEORV32_HOME)/sw/common/common.mk diff --git a/fibonacci/neorv32_exe.bin b/fibonacci/neorv32_exe.bin new file mode 100644 index 000000000..12378d04f Binary files /dev/null and b/fibonacci/neorv32_exe.bin differ diff --git a/readme.md b/readme.md index 4e1a03338..874e7c461 100644 --- a/readme.md +++ b/readme.md @@ -58,7 +58,22 @@ Ext. bus endianness: little [ ] XIP [ ] ONEWIRE +### Clock +On peut augmenter la fréquence du processeur à l'aide de l'outil PLL Intel FPGA IP que l'on vient monter à 100 MHz. Monter à 200 Mhz indique un timing fail et une Fmax à 130 Mhz. +Il faut ensuite modifier l'input de clock vers le signal de pll. + +``` +library pll; + +pll_100: entity pll.pll(rtl) +port map( + refclk => clk_i, -- refclk.clk + --rst : in std_logic := '0'; -- reset.reset + outclk_0 => clk_100, -- outclk0.clk + locked => open -- locked.export +); +``` ### Software Print sur le série :