Commit 4533e4ff by Zachary Snow

don't inline module-level constants into static prefixes

parent c00f508e
## Unreleased
### Bug Fixes
* Fixed module-level localparams being needlessly inlined when forming longest
static prefixes, which could cause deep recursion and run out of memory on
some designs
## v0.0.10 ## v0.0.10
### Breaking Changes ### Breaking Changes
......
...@@ -130,6 +130,7 @@ asConst scopes expr = ...@@ -130,6 +130,7 @@ asConst scopes expr =
asConstRaw :: Scopes Kind -> Expr -> Writer Any Expr asConstRaw :: Scopes Kind -> Expr -> Writer Any Expr
asConstRaw scopes expr = asConstRaw scopes expr =
case lookupElem scopes expr of case lookupElem scopes expr of
Just (accesses@[_, _], _, Const{}) -> return $ accessesToExpr accesses
Just (_, _, Const Nil) -> recurse Just (_, _, Const Nil) -> recurse
Just (_, _, Const expr') -> asConstRaw scopes expr' Just (_, _, Const expr') -> asConstRaw scopes expr'
Just{} -> tell (Any True) >> return Nil Just{} -> tell (Any True) >> return Nil
......
module top;
`include "always_spin.vh"
logic [Z - 1:0] foo;
logic flag;
logic bar;
always_comb
bar = foo[Z - 1] & flag;
endmodule
module top;
`include "always_spin.vh"
wire [Z - 1:0] foo;
wire flag;
reg bar;
always @*
bar = foo[Z - 1] & flag;
endmodule
parameter A = 1;
localparam B = A + A;
localparam C = B + B;
localparam D = C + C;
localparam E = D + D;
localparam F = E + E;
localparam G = F + F;
localparam H = G + G;
localparam I = H + H;
localparam J = I + I;
localparam K = J + J;
localparam L = K + K;
localparam M = L + L;
localparam N = M + M;
localparam O = N + N;
localparam P = O + O;
localparam Q = P + P;
localparam R = Q + Q;
localparam S = R + R;
localparam T = S + S;
localparam U = T + T;
localparam V = U + U;
localparam W = V + V;
localparam X = W + W;
localparam Y = X + X;
localparam Z = $clog2(Y + Y);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment