component statements within architecture statements

N

Neil Zanella

Hello,

I would like to ask a question concerning the intended use of component
statements within architecture statements in VHDL. Since when
instantiating different components the component part is optional, why
would anyone want to include it. Even if two entities were defined with an
interface with clashing signal names, the scope of those names would not
interfere when those entities are used for instantiation. So why would
anyone want to use an explicit component statement inside an architecture?

Thanks,

Neil
 
M

Mike Treseler

Neil said:
I would like to ask a question concerning the intended use of component
statements within architecture statements in VHDL. Since when
instantiating different components the component part is optional, why
would anyone want to include it. Even if two entities were defined with an
interface with clashing signal names, the scope of those names would not
interfere when those entities are used for instantiation. So why would
anyone want to use an explicit component statement inside an architecture?

A component is a socket into which you can plug
any entity/architecture that fits using a configuration.

If there will only be one such module to plug in,
as is often the case, then direct instances
without component declarations make sense.

However, if you expect to plug in a different module in
the future, an indirect instance now may simplify
the future change while providing backward compatibility
with the first design.

-- Mike Treseler
 
B

Barry Brown

So what is the correct syntax for instantiating an entity that is not in
your "work" library? I've never been able to figure out direct
instantiation of Xilinx unisim primitives - either ModelSim or Synplify (or
both) choke on everything I've tried. It seems like this should work...

library unisim;
use unisim.vcomponents.all;

....

Mult1 : entity unisim.MULT18X18
port map (P => P2, A => a(k,2), B => w0slv);

Thanks,
Barry Brown
 
D

David R Brooks

I do it like this (example: a simple wrapper for the Xilinx ROC
primitive). XST seems smart enough to secan the named libraries (in
addition to work) to find ROC.

LIBRARY ieee ;
USE ieee.std_logic_1164.all;

ENTITY XROC IS
PORT(
O : OUT std_ulogic
);
END XROC ;

library ieee;
use ieee.std_logic_1164.all;
library unisim;
use unisim.VCOMPONENTS.all; -- Xilinx primitives

architecture xilinx of XROC is

begin
croc : component ROC -- Reset on Configuration
port map (
O => O);

end xilinx;


:So what is the correct syntax for instantiating an entity that is not in
:your "work" library? I've never been able to figure out direct
:instantiation of Xilinx unisim primitives - either ModelSim or Synplify (or
:both) choke on everything I've tried. It seems like this should work...
:
:library unisim;
:use unisim.vcomponents.all;
:
:...
:
: Mult1 : entity unisim.MULT18X18
: port map (P => P2, A => a(k,2), B => w0slv);
:
:Thanks,
:Barry Brown
:
:
::>
:>
:> Neil Zanella wrote:
:>
:> > I would like to ask a question concerning the intended use of component
:> > statements within architecture statements in VHDL. Since when
:> > instantiating different components the component part is optional, why
:> > would anyone want to include it. Even if two entities were defined with
:an
:> > interface with clashing signal names, the scope of those names would not
:> > interfere when those entities are used for instantiation. So why would
:> > anyone want to use an explicit component statement inside an
:architecture?
:>
:> A component is a socket into which you can plug
:> any entity/architecture that fits using a configuration.
:>
:> If there will only be one such module to plug in,
:> as is often the case, then direct instances
:> without component declarations make sense.
:>
:> However, if you expect to plug in a different module in
:> the future, an indirect instance now may simplify
:> the future change while providing backward compatibility
:> with the first design.
:>
:> -- Mike Treseler
:>
:
 
D

Duane Clark

Barry said:
So what is the correct syntax for instantiating an entity that is not in
your "work" library? I've never been able to figure out direct
instantiation of Xilinx unisim primitives - either ModelSim or Synplify (or
both) choke on everything I've tried. It seems like this should work...

I use this, which works in both Synplify and Modelsim:

--synopsys translate_off;
LIBRARY UNISIM;
USE UNISIM.Vcomponents.ALL;
--synopsys translate_on;
library synplify;
use synplify.attributes.all;

ARCHITECTURE synth OF tmux IS
component ROC
port (
O : out std_logic
);
end component;
-- Synplify attributes
attribute syn_black_box of ROC : component is true;
BEGIN
TRST : ROC
port map(O => reset);
 
N

Neil Zanella

Duane Clark said:
ARCHITECTURE synth OF tmux IS
component ROC
port (
O : out std_logic
);

.... so why is it that VHDL requires the port section to be copied from the
entity declaration to the component declaration? Can't VHDL figure the
information out based on component name matching looking for an entity
that has the same name and using the names from the port section
specified therein?

Thanks,

Neil
 
D

Duane Clark

Neil said:
... so why is it that VHDL requires the port section to be copied from the
entity declaration to the component declaration? Can't VHDL figure the
information out based on component name matching looking for an entity
that has the same name and using the names from the port section
specified therein?

I am in the habit of putting explicit component declarations into code
to be synthesized, but not into testbench code. Don't really know how I
got into that habit, and really haven't had a reason to change.
 
M

Mike Treseler

Neil said:
... so why is it that VHDL requires the port section to be copied from the
entity declaration to the component declaration? Can't VHDL figure the
information out based on component name matching looking for an entity
that has the same name and using the names from the port section
specified therein?

A component is an *optional* interface specification
that allows the compiler to complain if a referenced
entity does not match the template. The information
is necessarily redundant, but it is easy work for
many vhdl editors. For emacs menus it's

click, VHDL, PORT, COPY
click, VHDL, PORT, PASTE AS COMP

-- Mike Treseler
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top