0

Coming accross declaration of 'class T' error.

I have this code:

#include "systemc.h"

template <class T> class FIFO_READ_HS: public sc_module, public sc_fifo_in_if<T>
{
    public:
        // ports
        sc_in_clk clock;
        sc_in<T> data;
        sc_in<bool> valid;
        sc_out<bool> ready;

        // blocking read
        void read(T& x) 
        {
        // signal that we are ready to consume a token
        ready.write(true);
        
        // wait until we've got valid data
        do
            wait(clock->posedge_event());
        while (valid.read() != true);
        
        // read data
        x = data.read();
        
        // no more consumption for the moment
        ready.write(false);
        
        } // end of void read()

        // constructor
        SC_CTOR(FIFO_READ_HS) 
        {
        ready.initialize(false);
        } // end constructor

        // Here, provide dummy implementations for unneeded sc_fifo_in_if <T> methods
        bool nb_read(T&) 
        { 
            assert(0); 
            return false; 
        }
        
        int num_available() const 
        { 
            assert(0); 
            return 0; 
        }
        
        const sc_event& data_written_event() const
        { 
            static sc_event dummy; 
            assert(0); 
            return dummy; 
        }

        virtual T read() 
        {
        T tmp;
        read(tmp);
        return tmp;
        
        }// end of virtual read

};

And getting this erro: error

songyuanyao
  • 169,198
  • 16
  • 310
  • 405
Crazy Kid
  • 9
  • 1
  • 3
    Welcome to StackOverflow. Please take a [tour] and see [ask]. Specifically you'll need to post a [mre], and post all your error messages (as well as code of course) as text, not images/links. – wohlstad Jul 12 '23 at 08:03
  • One guess is that the real error is at the end of `systemc.h`, and that the error is reported when the compiler can *definitely* tell that this doesn't add up. A missing `;` is not unusual. – BoP Jul 12 '23 at 08:49
  • @BoP thank you, I was able to fix the error I was missing a ')' which was hidden with other brackets. – Crazy Kid Jul 12 '23 at 23:02

0 Answers0