0
不,对我来说这是行不通的。它在合成过程中显示错误:顶部功能Adder
没有输出。可能的原因是:VIVADO HLS综合错误
- 输出参数由值
- 旨在输出(参数或全局变量)通过从未写入
头文件
#ifndef ADDERS_H_
#define ADDERS_H_
#include <cmath>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstdlib>
using namespace std;
// Types and top-level function prototype //
int adders(int in1, int in2, int in3);
#include "ap_int.h"
typedef ap_int<8> in1_t;
typedef ap_int<8> in2_t;
typedef ap_int<8> out_t;
void Adder(in1_t inA, in2_t inB, out_t sumAB);
#endif
测试台代码
#include <stdio.h>
#include "ap_int.h"
#include "Adder.h"
int main()
{
in1_t inA;
in2_t inB;
out_t sumAB;
inA = 15;
inB = 15;
sumAB = inA + inB;
Adder(inA, inB, sumAB);
cout << "A = "<< inA;
printf("\n");
cout << "B = " << inB;
printf("\n");
cout << "SUM = "<< sumAB;
printf("\n");
}
在粘贴内容时很难遵循Stackoverflow中的格式。 – Saras
加法器的返回类型为'void'。你只是想把A添加到B? int Adder(int a,int b){return a + b;} –
感谢您的回复。你在哪里指出我的错误。我无法理解。是的,我使用VIVADO HLS 2014 3.1 – Saras