Minres / CoreDSL

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

alias declaration flagged as invalid #79

Closed eyck closed 1 year ago

eyck commented 1 year ago

Having the following architectural state declaration:

    architectural_state {
        unsigned int RFS = 32;
        register unsigned<XLEN> X[RFS];
        unsigned<XLEN>& ZERO = X[0];
    }

the alias declaration is flagged as invalid. This does not happen when using an older commit (b065385)...

AtomCrafty commented 1 year ago

I cannot reproduce this. The following complete code snippet does not result in any errors:

InstructionSet Test {
    architectural_state {
        unsigned int XLEN = 32;
        unsigned int RFS = 32;
        register unsigned<XLEN> X[RFS];
        unsigned<XLEN>& ZERO = X[0];
    }
}

Could you post a minimal example and the error it produces?

AtomCrafty commented 1 year ago

Okay, I see what's going on here. The errors occur if XLEN is declared, but not assigned, because the type of X is now unknown. Fixing this will require a slight rework of how incomplete type information is represented and how the elaborator handles it. It will be included in my next PR.

eyck commented 1 year ago

THX. Actually the snippet is cut from https://github.com/Minres/RISCV_ISA_CoreDSL/blob/master/RISCVBase.core_desc and you are right, XLEN does not have a value at the point of alias declaration