element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
FPGA
  • Technologies
  • More
FPGA
Forum Problems with HLS Vivado Run C simulation
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join FPGA to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 4 replies
  • Subscribers 559 subscribers
  • Views 1646 views
  • Users 0 members are here
Related

Problems with HLS Vivado Run C simulation

bdiouiska
bdiouiska over 5 years ago

I hope this is in the right Topic.

Hello I am an engineer student and currently I am doing my final studies project , but i encounter some problems using vivado HLS , I hope that you can help me and thanks ,

I am going to show you my algorithm by the end of the message,

First my first problem is after i add file in Top Function (my main C file), the next step is Test bench files , I don't know what to put ??? I only have one algorithm, And this makes the Run C simulation not going in fact i got this message "cannot build design unless a test bunch with function main() is defined"

I tried to put my algorithm in both (top function same in test bench files) but i encounter some problems . My final goal is do verification synthesis and finally optimisation . I thank you for your help.

Here my algorithm in C.

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <string.h>



















int main()
{


int n1,n2,n3,i,j,k;
    float nu,a,b;
   
    a=0.25;
    b=0.5;
    nu=0.6; //donnée
       


    scanf("%i",&n1);
        scanf("%i",&n2);


    scanf("%i",&n3);
    
     float X[n1],W[n1][n2],W1[n2][n3],E[n2],Y[n2],E1[n3],Y1[n3],Deltaj[n2],Deltak[n3],Sd[n3],es[n3],Wa[n1][n2],Wa1[n2][n3];
     
    
for (i=0;i<n1;i++){


    scanf("%f",&X[i]);
}


for (i=0;i<n3;i++){


    scanf("%f",&Sd[i]);


}
// ici j'ai pas su comment calculer es[k] qui est egale es[k] = Sd[k]-Sc[k]; Sc[k] commont la calculer ??
for (i=0;i<n3;i++){


    scanf("%f",&es[i]);


}




for (i=0;i<n1;i++){
    for (j=0;j<n2;j++){
            W[i][j]= (rand()) / (RAND_MAX + 1.0);
    }
}


for (i=0;i<n2;i++){
    for (j=0;j<n3;j++){
            W1[i][j]= (rand()) / (RAND_MAX + 1.0);
    }
};








 float Somme1 (int n1,int i,int j,float X[n1],float W[n1][n2])
{
int h;
float Somme=0;
for (h=i;h<n1;h++)
{
Somme += (X[h]*W[h][j]);
}
return (Somme);
};


float Somme2 (int n3,int j , float es[n3] , float W1[n2][n3])
{
int h;
float Somme=0;
for (h=0 ; h<n3;h++)
{
Somme += es[h]*W1[j][h];
}
return(Somme);
};










//Fonction globale(1)
for (j=0;j<n2;j++)
{
for (i=0;i<n1;i++)
{
E[j]=Somme1(n1,i,j,X,W);
Y[j]=b+a*E[j];
Deltaj[j]=Y[j]*(1-Y[j])*Somme2(n3,j,es,W1);
Wa[i][j]=W[i][j]+nu*Deltaj[j]*X[i];
}
}
// Fonction 2
for (k=0;k<n3;k++)
{
for (j=0;j<n2;j++)
{
E1[k]=Somme1(n2,j,k,Y,W1);
Y1[k]=b+a*E1[k];
Deltak[k]=Y1[k]*(1-Y1[k])*(Sd[k]-Y1[k]);
Wa1[j][k]=W1[j][k]+nu*Deltaj[j]*Y1[k];
}
}
return 0;
}

  • Sign in to reply
  • Cancel
Parents
  • bartokon
    bartokon over 5 years ago

    I don't remember but there are like 2 places where you can put files -Test Bench and the other one image

     

    Make those files:

     

    Main_tb.cpp with:

    #include "myFunction.h"

    int main()

    {

    //Call function make some operations and typical dynamic programming

    //compare results with accelerated function

         int a, b, c;

         a = 1;

         b = 2;

         myDoSomethingInHardwareOne(a, b, c);

         if(c)

         {

              myDoSomethingInHardwareTwo(a,  b, c);

         };

     

    };

     

    in the other one (synthesis function location this is one row above TestBench):

    myFunction.h:

    void myDoSomethingInHardwareOne(int a, int b, int c);

    void myDoSomethingInHardwareTwo(int a, int b, int c);

     

    and myFunction.cpp:

    #include "myFunction.h"

    void myDoSomethingInHardwareOne(int a, int b, int c){c = a*b;};

    void myDoSomethingInHardwareTwo(int a, int b, int c){c = a-b;};

     

    If you are making cosim also include myFunction.h and myFunction.cpp to Main_tb.cpp catalog/row because without it cosim wouldn't work for me.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • bdiouiska
    bdiouiska over 5 years ago in reply to bartokon

    Thanks for your answer , though I've got this problem do you have any idea about it ?

     

     

    ../../../../Desktop/PFE/C/Untitled2.c:69:63: error: expected ';' at end of declaration

    float Somme1 (int n1,int i,int j,float X[n1],float W[n1][n2])

                                                                  ^

                                                                  ;

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • bdiouiska
    bdiouiska over 5 years ago in reply to bartokon

    Thanks for your answer , though I've got this problem do you have any idea about it ?

     

     

    ../../../../Desktop/PFE/C/Untitled2.c:69:63: error: expected ';' at end of declaration

    float Somme1 (int n1,int i,int j,float X[n1],float W[n1][n2])

                                                                  ^

                                                                  ;

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • bartokon
    bartokon over 5 years ago in reply to bdiouiska

    You should watch some courses on C/Cpp. I see that you don't understand global functions and their definitions and proper locations....

    Rewrite your code in Python like style because its easier to see where you are missing "};" look how I have written int main() you can see all the nesting functions and those " { };" marks.

     

    Good luck!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • bdiouiska
    bdiouiska over 5 years ago in reply to bartokon

    ok thank you for your answer

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube