c - VIVADO HLS 综合错误

标签 c dsl

不,对我来说它不起作用。它在综合过程中显示错误:顶部函数 Adder 没有输出。可能的原因有:

  1. 输出参数按值传递
  2. 从未写入预期输出(参数或全局变量)

头文件

#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"); 
}

最佳答案

您的错误是您正在按值传递加法器函数的输出参数。在 C 中,对此类值的更新仅在函数内部可见,不会传播到调用者。您应该通过指针或引用传递它,或者简单地通过从函数返回一个值,如 @jp-helemons 建议的那样。例如:

void adder(in_t inA, in_t inB, out_t& sumAB);

Here是一篇很好的文章,解释了通过引用传递函数参数。

关于c - VIVADO HLS 综合错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42850519/

相关文章:

configuration - 如何在 Kotlin for TeamCity 中隐藏自定义构建步骤中的参数?

database - 用户为应用程序定义的数据模式

c - 打印用户输入的每个字符,无需 conio.h

java - 从 Java 程序编译 C 代码

c - 如何确定每次读取系统调用要读取的合理字节数?

java - 自定义 Java 查询类 (DSL) : Builder pattern, 静态导入或其他用于复杂查询的东西?

elasticsearch - 如何在DSL查询中对搜索参数应用过滤器

go - 隐藏一个全局函数

c - 我应该处理哪个信号以及如何处理?

c - 从输入文件中提取数据?