Jump to content

Recommended Posts

Posted

Hi.

I am tring to execute a example from a book,but am getting error of this kind :

In file included from testbench.cpp:6:0:
head1.h: In member function 'void www::woperation()':
head1.h:16:9: error: 'class sc_core::sc_port<sc_core::sc_fifo_out_if<int> >' has no member named 'write'
In file included from testbench.cpp:7:0:
head2.h: In member function 'void rrr::roperation()':
head2.h:17:9: error: 'class sc_core::sc_port<sc_core::sc_fifo_in_if<int> >' has no member named 'read'

 

below is the code:

 

#include<systemc.h>
#include"Head1.h"
#include"Head2.h"

int sc_main(int argc, char* argv[])
{

    sc_fifo<int> fifo(10);

    writer w("writer");
    reader r("reader");
    w.out(fifo);
    r.in(fifo);

    sc_start(-1);

    return 0;

}

//header1
#include<systemc.h>
SC_MODULE(reader) {

    sc_port<sc_fifo_in_if<int> > in;

    void roperation()
    {

        int val;

        while (true)
        {
            wait(10, SC_NS)
                for (int i = 0; i <= 15; i++)
                {

                    in.read(val);

                    cout << val << endl;

                }
        }

        cout << "Availaible : " << in.num availaible() << endl;

    }

   SC_CTOR(writer)
    {
        SC_THREAD(woperation);

    }

};

 


//header2
#include<systemc.h>

SC_MODULE(writer)
{
    sc_port<sc_fifo_out_if<int> > out;

    void woperation()
    {

        int val = 0;
        while (true)
        {
            wait(10, SC_NS);
            for (int i = 0; i <= 20; i++)
            {
                out.write(val++);

            }
        }

    }

    SC_CTOR(writer)
    {
        SC_THREAD(woperation);

    }
};

 

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