Closed eyck closed 4 months ago
You're right, that should work. The storage class is probably set incorrectly. I'll take a closer look.
Looking at this again, I think I misunderstood your comment. I thought you were talking about function parameters, but re-reading it appears you actually want to declare an ISA parameter as an array.
That is not supported and not planned to be supported either. ISA parameters can only ever have integer types. https://github.com/Minres/CoreDSL/wiki/Structure-and-concepts#implementation-parameters-and-constants
The restrictions for parameters is clear. But how can I declare an array of constants? It seems we miss an array initialization syntax, something like const unsigned int a[] = {1,2,3,4}
. The only alternative currently is to declare the array in the instruction definition which is not very convenient...
Array initializers are indeed a feature that was planned, but not prioritized. To my knowledge constant arrays are not planned however, so any arrays need to be declared as registers.
Which doesn't make sense if I need to declare constants for CRC polynoms or cryptographic instructions. So we need to change the plan here.
Yeah, I can see the utility of constant arrays. My main concern would be retrofitting arrays into the existing elaborator, since that is designed to only handle integers. Should be possible, but might require some architecture changes.
See #114
When declaring a parameter as array the validator flags it as 'An ISA parameter may not be declared as an array'. This is not intended and not prohibited by the language reference manual