-1

Hello I am seeing some errors in my attempts to make a basic SystemC project. It looks like a slight mismatch of types, but I am not familiar enough with the types from the SystemC library to really know what the issue is. I have more or less taken the code directly from this tutorial.

https://www.youtube.com/watch?v=DSg4PMoUCX4

Currently, my Makefile looks like this

CXX=g++
OBJ= main.o fir_filter.o test_bench.o
INC=- -I /home/epi/jfrye_xilinx/SystemC/systemc-2.3.2/include -I /home/epi/jfrye_xilinx/SystemC/lib/fir_filter/src
LFLAGS=-L/home/epi/jfrye_xilinx/SystemC/systemc-2.3.2/lib-linux64
LIBS=-lsystemc
EXEC=test_fir

all: $(OBJ)
    $(CXX) $(OBJS) -o $(EXEC)

main.o: main.cpp
    $(CXX) $(INC) $(LFLAGS) $(LIBS) main.cpp

fir_filter.o: fir_filter.cpp fir_filter.h
    $(CXX) $(INC) $(LFLAGS) $(LIBS) fir_filter.cpp

test_bench.o: test_bench.cpp test_bench.h
    $(CXX) $(INC) $(LFLAGS) $(LIBS) test_bench.cpp

I am seeing these errors when I run make

main.cpp:28:19: error: no match for call to (sc_core::sc_in<sc_dt::sc_uint<16> >) (sc_core::sc_signal<sc_dt::sc_int<16> >&)

fir->inp(inp_sig);

main.cpp:29:21: error: no match for call to (sc_core::sc_out<sc_dt::sc_uint<16> >) (sc_core::sc_signal<sc_dt::sc_int<16> >&)

fir->outp(outp_sig);

Here is main.cpp

#include <systemc.h>
#include "fir_filter.h"
#include "test_bench.h"

SC_MODULE(SYSTEM)
{
    test_bench  *tb;
    fir_filter  *fir;

    sc_signal<bool>     rst_sig;
    sc_signal< sc_int<16> > inp_sig;
    sc_signal< sc_int<16> > outp_sig;

    sc_clock clk_sig;

    SC_CTOR(SYSTEM)
        : clk_sig("clk_sig", 10, SC_NS)
    {
        tb = new test_bench("tb");
        tb->clk(clk_sig);
        tb->rst(rst_sig);
        tb->inp(inp_sig);
        tb->outp(outp_sig);

        fir = new fir_filter("fir");
        fir->clk(clk_sig);
        fir->rst(rst_sig);
        fir->inp(inp_sig);
        fir->outp(outp_sig);
    }

    ~SYSTEM()
    {
        delete tb;
        delete fir;
    }
};

SYSTEM *top = NULL;

int sc_main(int argc, char *argv[])
{
    top = new SYSTEM("top");
    sc_start();

    return 0;
}

And lastly, fir_filter.h

#include <systemc.h>

SC_MODULE( fir_filter )
{
    sc_in<bool>         clk;
    sc_in<bool>         rst;
    sc_in< sc_uint<16> >    inp;
    sc_out< sc_uint<16> >   outp;

    void fir_main();

    SC_CTOR( fir_filter ) 
    {
        SC_CTHREAD( fir_main, clk.pos());
        reset_signal_is( rst, true);
    }
};

Update:

Thanks to the answers provided, I was able to change the two modules to ensure that the types were matching, whether signed or unsigned.

However make is still giving me this error. I did not include it originally because I did not realize it would break compilation.

g++: error: -E or -x required when input is from standard input make: *** [main.o] Error 1

John Frye
  • 255
  • 6
  • 22
  • I'm not sure because it's a long time that a didn't use SystemC, but `inp` in fir_filter is unsigned (`sc_uint<16>`) and `inp_sig` in system are signed (`sc_int<16>`), try with same signedness – Garf365 Dec 12 '17 at 15:44
  • I am a novice. That escaped me. I am not sure how old those tutorials are. Thanks. – John Frye Dec 12 '17 at 15:54

1 Answers1

0

In your SYSTEM module, it shouldn't be :

sc_signal< sc_int<16> > inp_sig;
sc_signal< sc_int<16> > outp_sig;

but instead :

sc_signal< sc_uint<16> > inp_sig;
sc_signal< sc_uint<16> > outp_sig;

as inp in the FIR Filter module is a sc_in< sc_uint<16> >.

Guillaume
  • 1,277
  • 8
  • 11