Skip to content
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

Sliced width is ignored during concatenation #12

Open
togulcan opened this issue Mar 24, 2022 · 2 comments
Open

Sliced width is ignored during concatenation #12

togulcan opened this issue Mar 24, 2022 · 2 comments

Comments

@togulcan
Copy link

togulcan commented Mar 24, 2022

Hello,

the following coredsl2 code:

void foo(){
  unsigned<8> a = 3;
  unsigned<8> b = 1;
  unsigned<32> x = 0, y=0;
  unsigned<64> z = x::y[a:b];
}

is producing:

static inline void foo (){
  etiss_uint8 a = 3U;
  etiss_uint8 b = 1U;
  etiss_uint32 x = 0U;
  etiss_uint32 y = 0U;
  etiss_uint64 z = (((x) << 32) | ((((y) >> (b)) & ((1 << ((a) - (b) + 1)) - 1))));
}

where x has been shifted 32 times instead of a - b + 1 times.

However, putting numbers into slices:

void foo(){
  unsigned<32> x = 0, y=0;
  unsigned<64> z = x::y[3:1];
}

works quite well:

static inline void foo (){
  etiss_uint32 x = 0U;
  etiss_uint32 y = 0U;
  etiss_uint64 z = (((x) << 3) | ((((y) >> (1U)) & 7)));
}

any idea about this?

@wysiwyng
Copy link
Collaborator

This would be a bug in M2-ISA-R and is on the roadmap to be supported, but at the time being, slicing is only supported with constants, see here: https://github.com/Minres/CoreDSL/wiki/Expressions#bit-range. I'll leave this open, as theoretically supporting non-constant slices should not be a problem for M2-ISA-R and ETISS.

@PhilippvK
Copy link
Member

@wysiwyng I guess this can be closed?

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

3 participants