Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore output ports with port maps

Tags:

port

vhdl

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?

like image 219
paul23 Avatar asked Oct 16 '13 19:10

paul23


People also ask

What does Port map do in VHDL?

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.

What is a port on a map?

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.

What does open mean in VHDL?

There is a reserved keyword in VHDL, open which can be used in place of a signal name when you do the port mapping.

What are ports in VHDL?

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.


2 Answers

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
    );
like image 141
Russell Avatar answered Oct 16 '22 11:10

Russell


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.

like image 29
codered657 Avatar answered Oct 16 '22 09:10

codered657