Jump to content
TRANG

sc_uint and unsigned int

Recommended Posts

Dear all,

Can you explain the difference between ?

sc_signal<unsigned int > port1;

and

sc_signal<sc_uint<32> > port2;

When to use port1 and port2?

Share this post


Link to post
Share on other sites

unsigned int has always the length defined by the underlying platform while sc_uint<> lets you specify the exact bit with of the type. In your case case I would use 'unsigned int' as it is faster and has less overhead.

Best regards

Share this post


Link to post
Share on other sites

First, let me say that I would never use sc_signal<unsigned int>. Instead use sc_signal<std::uint32_t> for portability reasons.

There are two considerations:

  1. sc_signal<uint32_t> is likely to be significantly faster than sc_signal<sc_uint<32>>. Especially if using the PoC implementation.
  2. sc_signal<sc_uint<32>> may be required by some synthesis tools if that is something you care about.

If you want to be agnostic to both situations, you could set up a typedef header for your project and use your own names.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×