参数传递规则问题-类型匹配
一、顶层参数传递给sub_function参数
note: candidate function not viable: no known conversion from 'ap_uint<32> *' to 'ap_uint<16> *' for 4th argument;
void my_top
(
hls::stream<ap_axiu<PIX_W*N_PIX,1,1,1> >& src,
hls::stream<ap_axiu<PIX_W*N_PIX,1,1,1> >& dst,
ap_uint<32> param_mem[1024]
){
#pragma HLS RESOURCE variable=param_mem core=RAM_2P_BRAM//这里指定为双口RAM会出问题
#pragma HLS INTERFACE axis register both port=src
#pragma HLS INTERFACE axis register both port=dst
#pragma HLS INTERFACE s_axilite port=return bundle=CONTROL_BUS
#pragma HLS INTERFACE s_axilite port=param_mem bundle=CONTROL_BUS
static struct cfg_info_s cfg_info;
#pragma HLS RESOURCE variable=cfg_info core=RAM_2P_LUTRAM
ap_uint<32> t1=0;
ap_uint<32> t2=0;
ap_uint<32> t3=0;
//注意param_cfg中接收¶m_mem[0]的数组或者指针,将会自动的被综合综合工具综合为RAM_1P_BRAM,也就是单口RAM
param_cfg(¶m_mem[0],&t1,&t2,&t3,&cfg_info[0]);
}
上述代码会存在问题,数据类型不匹配note: candidate function not viable: no known conversion from 'ap_uint<32> *' to 'ap_uint<16> *' for 4th argument;
需要将数据类型改为一样才可行
二、强制转换
void my_top
(
hls::stream<ap_axiu<PIX_W*N_PIX,1,1,1> >& src,
hls::stream<ap_axiu<PIX_W*N_PIX,1,1,1> >& dst,
ap_uint<32> param_mem[1024]
){
#pragma HLS RESOURCE variable=param_mem core=RAM_2P_BRAM//这里指定为双口RAM会出问题
#pragma HLS INTERFACE axis register both port=src
#pragma HLS INTERFACE axis register both port=dst
#pragma HLS INTERFACE s_axilite port=return bundle=CONTROL_BUS
#pragma HLS INTERFACE s_axilite port=param_mem bundle=CONTROL_BUS
static struct cfg_info_s cfg_info;
#pragma HLS RESOURCE variable=cfg_info core=RAM_2P_LUTRAM
ap_uint<32> t1=0;
ap_uint<32> t2=0;
ap_uint<32> t3=0;
//注意param_cfg中接收¶m_mem[0]的数组或者指针,将会自动的被综合综合工具综合为RAM_1P_BRAM,也就是单口RAM
param_cfg((ap_uint<16>*)¶m_mem[0],&t1,&t2,&t3,&cfg_info[0]);
}
ERROR: [SYNCHK 200-61] XXX:60: unsupported memory access on variable 'param_mem.V' which is (or contains) an array with unknown size at compile time.
ERROR: [SYNCHK 200-41] XXX:101: unsupported pointer reinterpretation from type 'i32*' to type 'i16*' on variable 'op.V'.
上述代码综合也会失败,因为这种强制类型转换会出问题,所以老实的把类型搞对才好。
