Closed leonschoorl closed 1 year ago
It seems clash is smart enough to handle the reverse:
topEntity :: Bool -> Bool
topEntity result = result
{-# ANN topEntity
((defSyn "topEntity") { t_inputs = [PortName "result"] }
) #-}
entity topEntity is
port(result : in boolean;
result_0 : out boolean);
end;
Instead of trying to be smart about this, maybe we should simple check port names for uniqueness and report an error when they're not unique.
That'll also help users who accidentally use the same port name multiple times. Because right now clash happily accept:
topEntity :: Bool -> Bool
topEntity x = x
{-# ANN topEntity
((defSyn "topEntity") { t_inputs = [PortName "foo"], t_output = PortName "foo" }
) #-}
and generate invalid HDL
entity topEntity is
port(foo : in boolean;
foo : out boolean);
end;
Duplicate of https://github.com/clash-lang/clash-compiler/issues/2246 ?
Basically yes, with the addition of https://github.com/clash-lang/clash-compiler/issues/2528#issuecomment-1618561609
generates
This is a bit of a weird corner case, as far as I can tell you can only create it by partially specifying port names.