Jump to content

Merging sc_int and sc_bigint


Roman Popov

Recommended Posts

It seems like it makes sense to merge sc_*int and sc_big*int types.

 

Wide buses are all around in modern systems. For example 64 bytes is common size of cache line. 

I do not see a good reason to keep two types for representing types with user-defined size.

 

For example in Verilog I have single common type for all cases:

bit [31:0] address;
bit [511:0] data;

But in SystemC I will have to use different types:

sc_uint<32> address;
sc_biguint<512> data;

Specializing sc_uint depending on size will not break compatibility with existing Systemc 2.3 code .

constexpr bool is_biguint(unsigned x) { return x > 64; }

template<int n, bool isbig = is_biguint(n)>
struct sc_uint {};

template<int n>
struct sc_uint <n, true>: public sc_unsigned { };

template<int n>
struct sc_uint <n, false>: public sc_uint_base { };
 
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...