Skip to content

const parameter can not support sc_biguint #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jinjie320621 opened this issue Sep 30, 2021 · 3 comments
Closed

const parameter can not support sc_biguint #13

jinjie320621 opened this issue Sep 30, 2021 · 3 comments

Comments

@jinjie320621
Copy link

When I use sc_biguint as type of one const member parameter, which data bits more than 64, will cause error.

One example, const sc_biguint<65> data;
error: Unsupported type: 'const sc_dt::sc_biguint<65>'

Is this a limitation of this tool?
Thanks very much.

@mikhailmoiseev
Copy link
Contributor

Yes, it is limitation described at SystemC supported:
45. Constant fields can be initialized in module constructor initialization list and body, they are generated as localparam in SV. Constant of any integral type initialized at elaboration phase should be 64 bit or less (stored in uint64/int64 field). Constant more than 64 bit has unknown value after elaboration, therefore error is reported.

Potentially, it is possible to support >64 constants initialized with concatenation operator:

const sc_uint<64> A = 0x8000000000000000;
const sc_uint<64> B = 0x8000000000000000;
const sc_biguint<128> C = (A, B);  -- error reported now
localparam logic[63:0] A = 64'h8000000000000000;
localparam logic[63:0] B = 64'h8000000000000000;
localparam logic[127:0] C = {A,B};

Will add this to future plans. Is that critical for your designs or it is just checking tool evaluation?

@mikhailmoiseev
Copy link
Contributor

mikhailmoiseev commented Apr 12, 2022

Since current version SC type variable can be initialized with string literal or string variable which support >64 bit values.

const char* cstr = "43";
std::string str;                 // Initialized in constructor or a method call

void someProc() {
    sc_uint<16> ux = "0b110011"; // Initialization with string literal
    ux = "42";                   // String literal assignment    
    ux = cstr;                   // C string assignment
    ux = str.c_str();            // std::string assignment

    sc_biguint<65> bu;  
    bu = "0x1FFFF1111FFFF1111";  // More than 64bit literal
}

@jinjie320621
Copy link
Author

Got it, thanks very much.
I must say sorry for close this issue so later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants