2

I dont have much experience in cpp, let alone systemc.

Why doenst this work?

sc_in<sc_uint<8>> a,b;

adder.cpp:5: error: ‘a’ was not declared in this scope
adder.cpp:5: error: ‘b’ was not declared in this scope
adder.cpp:5: error: wrong number of template arguments (2, should be 1)

This does work:

sc_in<int> a,b;
David
  • 4,744
  • 5
  • 33
  • 64

1 Answers1

8

In C++03, you can't have the two > characters next to each other because the compiler thinks you're trying to perform a right shift.

It then gets really confused, thinking you mean this:

sc_in<sc_uint<(8 >> a), b;
//                  ^ ^ ^
//                  ? | ?   Compiler: "what are `a` and `b`?!"
//                    !     Compiler: "why two arguments?!"

If you had managed to get that far, it would later complain about the two missing > characters before ;, ironically taking you back to where you started.

You have to write sc_in<sc_uint<8> > instead.

That's fixed as of C++11.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055