Jump to content

sc_uint and unsigned int

Recommended Posts

Dear all,

Can you explain the difference between ?

sc_signal<unsigned int > port1;


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

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.

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