Jump to content

request for member ‘write’ in ‘((chol*)this)->chol::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]’


makiso

Recommended Posts

// Below is my chol.h header file

#ifndef CHOL
#define CHOL
#define SC_INCLUDE_FX
//#include "sc_module.h"
#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 );
   //sc_fixed<32,16, SC_TRN, SC_WRAP> cholesky(sc_fixed<32,16, SC_TRN, SC_WRAP> *);
 
 
   // Constructor
 SC_CTOR (chol) {
 
       SC_CTHREAD (chol_main, clk.pos() );
       reset_signal_is(rst, false) ;
       sensitive << clk.pos();
 
   }
 
   // Destructor
   ~chol() {}
 
 
};
 
#endif

 

/// Below is my cholesky.cpp file

#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;
 
// Reset cycle//
        //chol_output.write(0);
        //wait();
 
 
//Main Thread
 
            while (true) {
 
 
                for (int i=0; i<n; i++)
                {
                for(int j=0; j<=i; j++)
                {
                chol_in[j] = chol_in_data[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[k] * chol_output[j][k];
            }
            if (i==j)
            {
                chol_output = sqrt(chol_in - sum) ;
            }
            else
            {
                chol_ouput[j] = 1.0 / chol_ouput[j][j] * (chol_in[j] - sum);
            }
            }
            }
// Cholesky Function
        //chol_output = cholesky (chol_in);
 
        chol_out_data.write(chol_output);
    }

 

 

when i try to compile this file i get the follwoing errors.

 

output:

 

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:46:5: error: ‘chol_ouput’ was not declared in this scope
     chol_ouput[j] = 1.0 / chol_ouput[j][j] * (chol_in[j] - sum);
     ^
cholesky.cpp:53:17: error: request for member ‘write’ in ‘((chol*)this)->chol::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

 

It would be very helpful if someone could resolve this error for me. I tried working on alternatives but I am not able to handle my issue.

 

Thanks in advance.

 

Link to comment
Share on other sites

  • 2 weeks later...

Hello ameya,

Thank you for your response. I have debugged the above error but now i am facing a different problem.

Error: (E109) complete binding failed: port not bound: port 'top.chol.port_16' (sc_out)
In file: ../../../../src/sysc/communication/sc_port.cpp:233

 

Main File

#include "chol.h"
#include "tb_chol.h"
#define SC_INCLUDE_FX
 
SC_MODULE (systemxx) {
 
chol  *chol0;
test_CHOL *test_CHOL0;
 
  sc_in_clk          clk;
  //sc_clock                clk("clk", 25, SC_NS, 0.5, 12.5, SC_NS, true);
  sc_signal<bool>         rst;
 
  sc_signal<sc_fixed<16,10, SC_TRN, SC_WRAP> > chol_in_data[3][3];    
  sc_signal<sc_fixed<16,10, SC_TRN, SC_WRAP> > chol_out_data[3][3];
 
 
SC_CTOR (systemxx) {
 
// Connect to test bench
int n = 3;
 
test_CHOL0 = new test_CHOL("test_CHOL0");
test_CHOL0->clk(clk);
test_CHOL0->rst(rst);
  for(int i=0;i<n;i++)
  {
  for (int j=0;j<=i;j++)
  {
test_CHOL0->chol_in_data[j](chol_in_data[j]);
test_CHOL0->chol_out_data[j](chol_out_data[j]);
 }
 }
 
 
 
// Connect to CHOL
 
chol0 = new chol ("chol");
chol0->clk(clk);
chol0->rst(rst);
 for(int i=0;i<n;i++)
  {
  for (int j=0;j<=i;j++)
  {
chol0->chol_in_data[j](chol_in_data[j]);
chol0->chol_out_data[j](chol_out_data[j]);
 }
 }
 
}
 
~systemxx() {
delete chol0;
delete test_CHOL0;
}
};
 
 
 
systemxx *top = NULL;
 
int sc_main(int argc, char** argv)
{
 
  sc_clock                clk("clk", 25, SC_NS, 0.5, 12.5, SC_NS, true);
  sc_signal<bool>         rst;

   
 top = new systemxx ("top");

   
   
   sc_start( 25, SC_NS );
  rst.write(0);
 
  sc_start( 25, SC_NS );
  rst.write(1);
 
  sc_start();
   
  return 0;
   
 };

 

Could you please help me resolve this error please?

 

Thanks in advance

 

Link to comment
Share on other sites

Hello @makiso,

The error message it-self is providing you hint about the port interface not bound.

From chol.h (checkout the inline comments):

...
SC_MODULE (chol) {


public:

   // Inputs
   sc_in_clk clk; //< This probably is port_0
   sc_in<bool> rst; //<This probably is port_1
   sc_in<sc_fixed<16,10, SC_TRN, SC_WRAP> > chol_in_data[3][3] ; //< port_2 to port_11


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


   /* F */
 void chol_main ( void );
   //sc_fixed<32,16, SC_TRN, SC_WRAP> cholesky(sc_fixed<32,16, SC_TRN, SC_WRAP> *);


   // Constructor
 SC_CTOR (chol):
     // have initializer list here for your interfaces to help you in debugging the code.
     // e.g.: chol_out_data("chol_out_data")
     {

       SC_CTHREAD (chol_main, clk.pos() );
       reset_signal_is(rst, false) ;
       sensitive << clk.pos();

   }

   // Destructor
   ~chol() {}


};
     
...

This following binding operation is incomplete(see commment inline):

8 hours ago, makiso said:

// Connect to CHOL
 
chol0 = new chol ("chol");
chol0->clk(clk);
chol0->rst(rst);
 for(int i=0;i<n;i++)
  {
  for (int j=0;j<=i;j++) //< why the i index is used here what about the i+.... interfaces?
  {
chol0->chol_in_data[j](chol_in_data[j]);
chol0->chol_out_data[j](chol_out_data[j]);
 }
 }

Note: Refer here for initialize list(checkout  the example use-case):

Try out these changes and let us know if it helped you.

Regards,

Ameya Vikram Singh

Link to comment
Share on other sites

sorry ameya, I did go through the link still I am not able figure my error. I have used an equivalent logic though. I also don't understand what do you mean by " why the i index is used here what about the i+.... interfaces? ".

I just don't understand why there is an port error in chol alone. I used the same logic in my testbench  but I didn't get any error over there. Why specifically that port 16 alone was not able to bind when all others can?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...