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 post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...