Altera_Forum
Honored Contributor
20 years agoProblems with diferents Nios II configurations
I'm doing a simple benchmar that reserve memory for a two matrix and multiply it. Every iteration reserve more memory. But my problem is that in standard nios II configuration it runs perfect, but when I use it in full featured it doesn't run. Can someone explain me why it succes or what I can do for resolve it??
I put the code here: # include <stdlib.h># include <stdio.h># include <time.h> void main(int argc, char *argv[]) { int *a,*b,*c; int i, j, k, x; time_t start_time, end_time; int time_final=0; int crow=0; int ROWS = 2; int ITER = 1000; printf("\nStarting main program.\n\n"); printf("\n\nMultiplying two matrices of size %dX%d %d times.\n\n", ROWS, ROWS, ITER); start_time = time(NULL); for(crow=2;crow<=14;crow++){ ROWS = crow; a = malloc(ROWS*ROWS); b = malloc(ROWS*ROWS); for(x=0; x<ITER; x++) { for(i=0;i<ROWS*ROWS;i++) { a = i+1;b = ROWS*ROWS-i-1; } i=0; for (i=0; i < ROWS; i++) { for (j = 0; j < ROWS; j++) { for (k=0; k < ROWS; k++) a[i+j] += a[i+k]*b[k+j]; b[i+j] += a[i+k]*b[k+j]; } } } end_time = time(NULL); time_final = difftime(end_time,start_time); printf ("\nNumero de Columnes: %d ,Temps: %d\n",ROWS,time_final); free(a); free(http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/cool.gif ; } exit(0); } thanks to all, Guillem