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?
Port map is the part of the module instantiation where you declare which local signals the module's inputs and outputs shall be connected to. In previous tutorials in this series we have been writing all our code in the main VHDL file, but normally we wouldn't do that.
A port map is typically used to define the interconnection between instances in a structural description (or netlist). A port map maps signals in an architecture to ports on an instance within that architecture. Port maps can also appear in a configuration or a block.
There is a reserved keyword in VHDL, open which can be used in place of a signal name when you do the port mapping.
In a VHDL Output File (. vho), a port name in the Entity Declaration represents an input or output of the current file. When an instance of a primitive or lower-level design file is implemented with a Component Instantiation, its ports are connected to signals with Port Map Aspects.
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
);
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With