Electronic – VHDL: I can port map std_logic_vector to a signed or unsigned port, why

vhdl

VHDL is type-safe, thus how is it that I am able to use a std_logic_vector signal and port map it to a entity port that is of type signed?

Shouldn't it require some sort of "qualification" or "casting"?

Best Answer

You can use a type conversion in an association list e.g. in a port map.

Depending on the (port) direction, you need to specify the conversion either on the formal (output), actual (input) or both sides (inout).

port map (
  myUnsigned                 => unsigned(mySLV1),  -- input
  std_logic_vector(mySigned) => mySLV2             -- output
);