veryl
veryl copied to clipboard
Type checking analysis pass
Dalance,
I would like to add a type checking pass which has a primary goal of evaluating the size (in bits) and packedness of each datatype.
The way I see this working is that a graph whose nodes are types, and whose edges represent dependencies.
For example,
type k = logic<2>;
struct m {
a: k,
}
Would contain three nodes and two edges: (logic<2>) -> (k) -> (m).
In addition to allowing us to identify the packed size of m
, this also allows us to do dependency analysis. The type-graph should be a DAG. If a cycle exists, we have a problem. However, currently
package p {
struct m {
a: logic,
n: n,
}
struct n {
b: logic,
m: m,
}
}
passes on this mutually recurssive, but not inductive package p
.
Any thoughts on this approach?