fix failed indirection of unassigned function results

This commit is contained in:
Zachary Snow 2022-01-23 22:40:43 -07:00
parent 4c3dcf5219
commit 2e43dfeeaa
3 changed files with 17 additions and 1 deletions

View File

@ -520,7 +520,11 @@ scopeModuleItem declMapperRaw moduleItemMapper genItemMapper stmtMapperRaw =
redirectTFDecl :: Type -> Identifier -> ScoperT a m (Type, Identifier)
redirectTFDecl typ ident = do
res <- declMapper $ Variable Local typ ident [] Nil
let Variable Local newType newName newRanges Nil = res
(newType, newName, newRanges) <-
return $ case res of
Variable Local t x r Nil -> (t, x, r)
Net Local TWire DefaultStrength t x r Nil -> (t, x, r)
_ -> error "redirectTFDecl invariant violated"
return $ if null newRanges
then (newType, newName)
else

View File

@ -0,0 +1,8 @@
module top;
function automatic bit foo;
input integer x;
// no return
endfunction
bit x;
assign x = foo(0);
endmodule

4
test/core/func_no_asgn.v Normal file
View File

@ -0,0 +1,4 @@
module top;
wire x;
assign x = 1'bx;
endmodule