Minres / CoreDSL

Xtext project to parse CoreDSL files
Apache License 2.0
14 stars 2 forks source link

Cannot declare parameters as arrays #113

Closed eyck closed 4 months ago

eyck commented 4 months ago

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

AtomCrafty commented 4 months ago

You're right, that should work. The storage class is probably set incorrectly. I'll take a closer look.

AtomCrafty commented 4 months ago

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

eyck commented 4 months ago

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...

AtomCrafty commented 4 months ago

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.

eyck commented 4 months ago

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.

AtomCrafty commented 4 months ago

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.

eyck commented 4 months ago

See #114