Reputation: 9435
Well often in VHDL I notice that a certain component has multiple output ports. Ie in one of our examples we were given the following component:
COMPONENT eight_bitadder
PORT ( a, b: in std_logic_vector(7 downto 0);
f: in std_logic;
C: out std_logic_vector(7 downto 0);
o, z: out std_logic);
END COMPONENT;
Where z determines if the result is 0, and o triggers on overflow.
Now in my case I wish to use this adder, however the actual result is not of importance, rather I only wish to check if the result is "0". I could of course add a dummy signal and store the port to this signal, however that seems needlessly complicated, and might add extra components during synthesis?
Upvotes: 19
Views: 46661
Reputation: 79
You also could choose to not tie an output to anything like so:
EIGHT_BITADDER_INST : eight_bitadder
port map (
a => a,
b => b,
f => f,
o => overflow
);
Notice that I simply did not include outputs c and z in the port map. Some may debate on the clarity of this (since it may not be clear that outputs c and z exists), but it also reduces the code to only what is necessary.
Upvotes: 3
Reputation: 3457
When you instantiate the component you can leave the output ports that you don't care about open. The only signal you care about below is "overflow".
EDIT: Note that the synthesis tools will optimize away any outputs that are not being used.
EIGHT_BITADDER_INST : eight_bitadder
port map (
a => a,
b => b,
f => f,
c => open,
o => overflow,
z => open
);
Upvotes: 25