Skip to content

frontend: Infinite Recursion error where only a finite recursion exists #811

@AndreasKrall

Description

@AndreasKrall

The following example from the tutorial:

enumeration CsrDef : Bits<12> =   // defined control and status register indices
  { ustatus                       //  0 0x000  User mode restricted view of mstatus
  , uie      =   4                //  4 0x004  User mode Interrupt Enable
  , utvec                         //  5 0x005  User mode Trap VECtor base address
  , uscratch =  64                // 64 0x040  User mode SCRATCH
  , uepc                          // 65 0x041  User mode Exception Program Counter
  , ucause   =  CsrDef::uepc + 1  // 66 0x042  User mode exception CAUSE
  , utval                         // 67 0x043  User mode Trap VALue
  }

gives an infinite recursion error:

error: Infinite Recursion
     ╭──[test.vadl:1:1]
     │
   1 │> enumeration CsrDef : Bits<12> =   // defined control and status register indices
   2 │>   { ustatus                       //  0 0x000  User mode restricted view of mstatus
   3 │>   , uie      =   4                //  4 0x004  User mode Interrupt Enable
    ⋮  3 lines omitted here...
   7 │>   , ucause   =  CsrDef::uepc + 1  // 66 0x042  User mode exception CAUSE
   8 │>   , utval                         // 67 0x043  User mode Trap VALue
   9 │>   }
     │    
     │
     Definition `CsrDef` is defined by itself.

This is a finite recursion and it would be nice if that could be handled. Then the example in the tutorial would be correct again. Tests should not only be done with a direct recursion like here, but also with indirect recursions with other enumerations / constants.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestfrontendThis is frontend related

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions