reactive-systems / syfco

Synthesis Format Conversion Tool
MIT License
23 stars 12 forks source link

Module buses cannot be used in DEFINITIONS (without explicitly passing by argument) #37

Open 5nizza opened 3 years ago

5nizza commented 3 years ago

See the comment https://github.com/reactive-systems/syfco/commit/2b270f478676c7b7883436a7193868a563b875e1#commitcomment-46270780

kleinreact commented 3 years ago

Thanks for the indication. Unfortunately, there is no quick fix to the problem. The tricky part about busses is that they can intertwine the evaluation order, which may cause jumps between definition evaluations and the evaluation of the bus sizes. To give an example, consider:

INFO
{
  TITLE:       ""
  DESCRIPTION: ""
  SEMANTICS:   Mealy
  TARGET:      Mealy
}

GLOBAL
{
  PARAMETERS
  {
    n = 2;
  }

  DEFINITIONS
  {
    last = a[SIZE a - 1];
    m =
      n > 0:     n
      otherwise: 1;
  }
}
MAIN
{
  INPUTS {}
  OUTPUTS { a[m]; }
  GUARANTEES { last }
}

Resolving the possible dependencies therefore needs some more advanced dependency tracking. However, the costs are questionable, since the problem can always be avoided by passing the bus as a function argument instead.