cucapra / filament

Fearless hardware design

Home Page:http://filamenthdl.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disallow orphan constraints on existential parameters

rachitnigam opened this issue · comments

Existential parameters allow constraints on them using where clauses. However, there are no constraints on how they can be defined:

comp Foo[W]() -> () with {
  exists O where W == 10
} where O > 10 { ... }

The two constraints in this component are bad news:

  1. The constraint on W defined with O acts as an assumption for the calling component which will allow it to do whatever it wants.
  2. The constraint O > 10 cannot be satisfied by the calling component because the parameter is defined by the component.

We should disallow such orphan constraints by enforcing:

  1. Constraints on existential parameters must mention the parameter that they are attached to.
  2. The outer where clause cannot mention existential parameters.