c++ - 请求 ‘write’中的成员 ‘chol_out_data’,非类类型

标签 c++ systemc

我的 cholesky.cpp 文件:

#include "chol.h"
#include <math.h>

//Main Thread

void chol::chol_main () {
    // Variable declaration
    sc_fixed<16,10, SC_TRN, SC_WRAP> chol_output[3][3];
    sc_fixed<16,10, SC_TRN, SC_WRAP> chol_in[3][3];
    int n=3;

    //Main Thread
    while (true) {
        for (int i=0; i<n; i++){
            for(int j=0; j<=i; j++){
                chol_in[i][j] = chol_in_data[i][j].read();
            }
        }
    }

    for (int i=0; i<n; i++){
        for (int j=0; j<=i; j++){
            sc_fixed<16,10, SC_TRN, SC_WRAP> sum = 0;
            for (int k=0; k<j; k++){
                sum += chol_output[i][k] * chol_output[j][k];
            }

            if (i==j){
                chol_output[i][i] = sqrt(chol_in[i][i] - sum) ;
            }else{
                chol_ouput[i][j] = 1.0 / chol_ouput[j][j] * (chol_in[i][j] - sum);
            }
        }
    }

    chol_out_data.write(chol_output);   
}

这个chol.h的头文件:

#ifndef CHOL
#define CHOL
#define SC_INCLUDE_FX
#include "define.h"

SC_MODULE (chol) {
public:
   // Inputs
   sc_in_clk clk;
   sc_in <bool> rst;
   sc_in <sc_fixed<16,10, SC_TRN, SC_WRAP> > chol_in_data[3][3] ;

   // Output
   sc_out <sc_fixed<16,10, SC_TRN, SC_WRAP> > chol_out_data[3][3] ;

   /* F */
   void chol_main ( void );

   // Constructor
   SC_CTOR (chol) {
       SC_CTHREAD (chol_main, clk.pos());
       reset_signal_is(rst, false) ;
       sensitive << clk.pos();
   }

   // Destructor
   ~chol() {}
};

#endif

输出:

g++  -O1 -I"/home/mahesh/systemc/systemc-2.3.1a/include" -I"." -c cholesky.cpp -o cholesky.o
    cholesky.cpp: In member function ‘void chol::chol_main()’:
    cholesky.cpp:47:5: error: ‘chol_ouput’ was not declared in this scope
         chol_ouput[i][j] = 1.0 / chol_ouput[j][j] * (chol_in[i][j] - sum);
         ^


    cholesky.cpp:54:17: error: request for member ‘write’ in ‘chol_out_data’, which is of non-class type ‘sc_core::sc_out<sc_dt::sc_fixed<16, 10, (sc_dt::sc_q_mode)5u, (sc_dt::sc_o_mode)3u> > [3][3]’
       chol_out_data.write     (chol_output);                                       
                     ^

    Makefile:90: recipe for target 'cholesky.o' failed
    make: *** [cholesky.o] Error 1

我正在执行矩阵分解,并将 cholesky 模块的二维数组的输出写入连接到 cholesky 测试台模块的信号端口。

我已经在范围内声明了 chol_output 变量;仍然,我得到了同样的错误,它超出了范围。此外,它表示“write”属于非类类型。

有人能帮忙吗?

最佳答案

对于第一个错误,您只是将 chol_output 拼错为 chol_ouput

第二个错误就是它所说的:chol_out_data 不是类对象,因此您不能在其上使用 .。它是类对象数组的数组。

关于c++ - 请求 ‘write’中的成员 ‘chol_out_data’,非类类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43033530/

相关文章:

c++ - 从 int 到 int 的无效转换

c++ - Apache Thrift : When use "optional' before a list, C++ 服务器似乎没有正确返回它

text - 如何删除 SystemC 启动文本

verilog - 将位/逻辑向量的 SystemC 结构安全地转换/转换为单个位/逻辑向量

system-verilog - SystemVerilog fork/join w/ "run()"类型函数和 SystemC

c++ - VSCode 在构建前不显示错误

c++ - 我的函数顶点和边添加是否不会将数据插入STL容器?

c++ - 在 Windows 上以 float 方式额外打印 0

c++ - 连接位 C++