Jump to content

In constructor ‘tb::tb(sc_core::sc_module_name)’: ./tb.h:18:41: error: no match for call to ‘(sc_core::sc_fifo_in<myStruct_t>) (myStruct_t&)’


HTP

Recommended Posts

Hello,

I am getting the error in the title when trying to connect two of my modules in my tb. related SystemC code is as below. 

#ifndef TB_H
#define TB_H

#include "systemc.h"
#include <tx.h>
#include <selector.h>

SC_MODULE (tb) {

    tx                  mytx;
    selector            myselector;
    myStruct_t          ctrl_frame;
    
    sc_lv<6>            temp_sig;
    
    SC_CTOR(tb) : mytx("mytx"), myselector("myselector") {
        
        mytx.i_ctrl    ( ctrl_frame);
        mytx.o_data    ( temp_sig  );
        myselector.out_fifo (ctrl_frame);
        
        }
    };

#endif

Can you please let me know what is the problem?

 

Thanks,

Hadi 

Link to comment
Share on other sites

In the follwoing linemyselector.out_fifo (ctrl_frame);

 myselector.out_fifo (ctrl_frame);

You are trying to bind ctrl_frame to the sc_fifo_in port. And obviously ctrl_frame is neither a sc_fifo nor implements the sc_fifo_in_if.

Link to comment
Share on other sites

Thanks for your response. 

out_fifo is actually sc_fifo_out as shown below. So cant we pass custom struct to sc_fifo in our out?

Also looks like the issue is not limited to myselector.out_fifo, it is with both ports of mytx as well.

 

#include "systemc.h"

enum mod {BPSK, QPSK, _8PSK, _16QAM, _32QAM, _64QAM} ;

typedef struct {
    
    sc_uint<15>   fl_bit;
    sc_uint<10>   in_byte;
    mod           mod_order;
    
    } myStruct_t;


SC_MODULE (selector) {

    sc_fifo_out <myStruct_t> out_fifo ;
    void random_process();
 
    SC_CTOR(selector) {
        
        SC_METHOD(random_process);
        
        }
    };

Link to comment
Share on other sites

@HTP: Your member variables ctrl_frame and temp_sig are of type myStruct_t and sc_lv<6>, respectively, which only hold data like ordinary variables. You cannot use such variables as a signal/channel. Only the latter can be bound to ports. Your sc_fifo_out<myStruct_t> out_fifo needs to be bound to a member variable of type sc_fifo<myStruct_t>. That type implement the interface used by the sc_fifo_out<myStruct_t> port and acts as a channel implementing the FIFO behaviour.

You still seem to struggle with the basic concepts of SystemC. Therefore, I recommend you to read a good introduction to SystemC, e.g., David Black et a. "SystemC from the Ground Up", 2nd edition, Springer, 2009 or the SystemC tutorial by Doulos.

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...