Jump to content

Compiling a Simple C code on Mac


Recommended Posts

#include <systemc>

SC_MODULE (counter) {
  sc_in_clk     clock ;      // Clock input of the design
  sc_in<bool>   reset ;      // active high, synchronous Reset input
  sc_in<bool>   enable;      // Active high enable signal for counter
  sc_out<sc_uint<4> > counter_out; // 4 bit vector output of the counter

  //Local Variables
  sc_uint<4>	count;

  // Counter logic
  void incr_count () {
    // At every rising edge of clock we check if reset is active
    // If active, we load the counter output with 4'b0000
    if (reset.read() == 1) {
      count =  0;
      counter_out.write(count);
    // If enable is active, then we increment the counter
    } else if (enable.read() == 1) {
      count = count + 1;
      counter_out.write(count);
      cout<<"@" << sc_time_stamp() <<" :: Incremented Counter "
        <<counter_out.read()<<endl;
    }
  } // End of function incr_count

  // Constructor for the counter
  // Since this counter is a positive edge trigged one,
  // We trigger the below block with respect to positive
  // edge of the clock and also when ever reset changes state
  SC_CTOR(counter) {
    cout<<"Executing new"<<endl;
    SC_METHOD(incr_count);
    sensitive << reset;
    sensitive << clock.pos();
  } // End of Constructor

}; // End of Module counter

Hello,

I am trying to compile this simple code on SystemC 2.3.3 on MacOSX using the g++-8 compiler.

I am receiving the following errors:

Quote

counter.cpp:4:3: error: 'sc_in_clk' does not name a type
   sc_in_clk     clock ;      // Clock input of the design
   ^~~~~~~~~
counter.cpp:5:3: error: 'sc_in' does not name a type; did you mean 'sc_dt'?
   sc_in<bool>   reset ;      // active high, synchronous Reset input
   ^~~~~
   sc_dt
counter.cpp:6:3: error: 'sc_in' does not name a type; did you mean 'sc_dt'?
   sc_in<bool>   enable;      // Active high enable signal for counter
   ^~~~~
   sc_dt
counter.cpp:7:3: error: 'sc_out' does not name a type; did you mean 'sc_dt'?
   sc_out<sc_uint<4> > counter_out; // 4 bit vector output of the counter
   ^~~~~~
   sc_dt
counter.cpp:10:3: error: 'sc_uint' does not name a type; did you mean 'sc_dt'?
   sc_uint<4> count;
   ^~~~~~~
   sc_dt

Are the sc_in and the sc_out types depreciated i the 2.3.3 implementation or is it a compiler specific error?

Edited by Marwan
Ommitted personal information
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...