Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to declare C arbitrary-precision types in HLS_For 30 Factorial

Status
Not open for further replies.

Saras015

Banned
Joined
Apr 5, 2017
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
0
A factorial(30) will require at least a 108-bit output. Since C has no native types this large, i have to use the HLS arbitrary-precision types.

So, i started using that data type in my code. But it showing Type "uint64" can not resolved. Please suggest me why this error. How i need to declare in the HLS CODE

Source Code in HLS



Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>
#define NUM 10
int Factorial(int a[NUM])
{
#pragma HLS INTERFACE s_axilite port=a bundle=a
#pragma HLS INTERFACE s_axilite port=return bundle=a
int i;
long long int fact=1;
for (i=1; i<=NUM; i++)
{
#pragma HLS PIPELINE
fact = fact*i;
}
return fact;
}

 
Last edited by a moderator:

So, i started using that data type in my code. But it showing Type "uint64" can not resolved.
Why don't you show the code using arbitrary precisions integer? It's expected to include ap_cint.h
 

Why don't you show the code using arbitrary precisions integer? It's expected to include ap_cint.h

Thanks for your reply. Sorry, the following codes only i have executed in HLS. Please find the screen shot.

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <stdint.h>
#include "ap_cint.h"
 
#define NUM 30
int Factorial(int a[NUM])
{
int i;
uint64 fact=1;////
Fact_data(a[NUM]);
#pragma HLS INTERFACE s_axilite port=a bundle=a
#pragma HLS INTERFACE s_axilite port=return bundle=a
for (i=1; i<=NUM; i++)
{
#pragma HLS PIPELINE
fact = fact*i;
}
 
return 0;
}



ERROR DURING SIMULATIOM
Code:
Compiling(apcc) ../../../../fact_test.c in debug mode
@I [HLS-10] Running 'c:/Xilinx_2015_4/Vivado_HLS/2015.4/bin/unwrapped/win64.o/apcc.exe'
            for user 'Optics2015A' on host 'optics2015a-pc' (Windows NT_amd64 version 6.1) on Thu Apr 06 12:02:40 +0530 2017
            in directory 'E:/Saraswathy/Factorial_Task/Factorialprj/solution1/csim/build'
../../../../fact_test.c:19:19: warning: data argument not used by format string [-Wformat-extra-args]
 printf("\nllu\n",fact);
        ~~~~~~~~~ ^
1 warning generated.
../../../../fact_test.c:19:19: warning: data argument not used by format string [-Wformat-extra-args]
 printf("\nllu\n",fact);
        ~~~~~~~~~ ^
1 warning generated.
@I [APCC-3] Tmp directory is apcc_db
@I [APCC-1] APCC is done.
   Compiling(apcc) ../../../../fact.c in debug mode
@I [HLS-10] Running 'c:/Xilinx_2015_4/Vivado_HLS/2015.4/bin/unwrapped/win64.o/apcc.exe'
            for user 'Optics2015A' on host 'optics2015a-pc' (Windows NT_amd64 version 6.1) on Thu Apr 06 12:03:24 +0530 2017
            in directory 'E:/Saraswathy/Factorial_Task/Factorialprj/solution1/csim/build'
@I [APCC-3] Tmp directory is apcc_db
@I [APCC-1] APCC is done.
   Generating csim.exe
obj/fact_test.o: In function `main':
E:\Saraswathy\Factorial_Task\Factorialprj\solution1\csim\build/apcc_db/fact_test.c:177: undefined reference to `Fact_data'
obj/fact.o: In function `Factorial':
E:\Saraswathy\Factorial_Task\Factorialprj\solution1\csim\build/apcc_db/fact.c:183: undefined reference to `Fact_data'
collect2: ld returned 1 exit status
make: *** [csim.exe] Error 1
@E [SIM-1] 'csim_design' failed: compilation error(s).
 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top