UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor mgoubert
Visitor
5,808 Views
Registered: ‎11-03-2012

Error: invalid conversion, but same types?

Hi,

 

I don't get why i get this error when compiling my testbench.

 

 

../xtm640/xtm640_test.cpp: In function ‘int main()’:
../xtm640/xtm640_test.cpp:7: error: invalid conversion from ‘ap_ulong’ to ‘ap_uint<8>*’
../xtm640/xtm640_test.cpp:7: error: initializing argument 1 of ‘void xtm640(ap_uint<8>*, ap_uint<8>*)’
../xtm640/xtm640_test.cpp:7: error: invalid conversion from ‘ap_ulong’ to ‘ap_uint<8>*’
../xtm640/xtm640_test.cpp:7: error: initializing argument 2 of ‘void xtm640(ap_uint<8>*, ap_uint<8>*)’

 

 

I only use one type, here is the code:

xtm640.cpp

#include "ap_int.h"


void xtm640(ap_uint<8> * din,ap_uint<8> * dout){
#pragma HLS INTERFACE ap_fifo port=dout
#pragma HLS INTERFACE ap_fifo port=din

	ap_uint<8> temp;

	while(1){
		temp = (*din++);
		(*dout++) = temp;
	}




}

 xtm640_test.cpp

#include "ap_int.h"
#include "xtm640.h"
int main(){

	ap_uint<8> din=20;
	ap_uint<8> dout;
	xtm640(din,dout);
	if(din==dout){
		printf("OK");
	}
	else {
		printf("NOT OK!");
	}

	return 0;

}

 xtm640.h

 

#ifndef XTM640_H
#define XTM640_H
 
void xtm640(ap_uint<8> * din, ap_uint<8> * dout);
 
#endif

 

Its a simple fifo loopback that i am going to place on the fifo from xillybus.

 

Thnx,

Matthias

0 Kudos
1 Reply
Xilinx Employee
Xilinx Employee
5,784 Views
Registered: ‎11-11-2012

Re: Error: invalid conversion, but same types?

You are passing two scalars to a function with pointer parameter.

 

The correct function call should be : xtm640( &din, &dout);

 

BTW, the "while(1)" statement in your design makes the C simulation never end.

 

	xtm640(din,dout);
0 Kudos