direct instantiation, libraries

V

valentin tihomirov

Here is synthax:
label : entity lib_name.entity_name(architecture_name) port map (.....);

The problem is to use any different library rather than 'work'. Even
simulator refuses to compile this:

-- declare libs
library IEEE, LibraryA, LibraryB;

use IEEE.STD_LOGIC_1164.ALL;

--interface
entity MULTILIB_DESIGN is
port (
A, B: in std_logic;
O : out std_logic
);
end MULTILIB_DESIGN;

--implementation
architecture RTL of AND2 is
signal AND_O, XOR_O: std_logic;
begin
AND_U: entity libraryA.AND2(RTL) port map (A, B, AND_O); -- Unknown
identifier LibraryA
XOR_U: entity libraryB.XOR2(RTL) port map (A, B, XOR_O);-- Unknown
identifier LibraryB
O <= AND_O or XOR_O;
end RTL;

As far as I can understand, the idea of libraries is to isolate primitives
into namespaces. This is what I want to achieve. The VHDL must be
synthesizable.
 
M

Mike Treseler

valentin said:
The problem is to use any different library rather than 'work'. Even
simulator refuses to compile this:

The mapping from vhdl library identifier to
a physical directory is a tool setting, not part of the language.
The only directory not needing a mapping is ./work

For modelsim, the command is vmap.
Every tool is different.
See:

http://groups.google.com/groups?q=vhdl+vmap+vlib+work

-- Mike Treseler
 
V

valentin tihomirov

Simulator is aware of libraryA and libraryB. I'm asking whether VHDL usage
is correct? I have not met any example using lib_name in the component
instantiation.
 
M

Mike Treseler

valentin said:
Simulator is aware of libraryA and libraryB. I'm asking whether VHDL usage
is correct?

Yes. If the mappings are correct, perhaps the entities were not
compiled into the correct directories.

-- Mike Treseler
 
V

valentin tihomirov

Thanks, I make a conclusion that vendors have poor support of using library
identifier in component instantiation. Entities are precompiled into
separate libraryies and "unknown library" error message is shown.
 
D

David Jones

Thanks, I make a conclusion that vendors have poor support of using library
identifier in component instantiation. Entities are precompiled into
separate libraryies and "unknown library" error message is shown.

The syntax

U1: somelib.acell(rtl) port map(
...
)

is new to VHDL-93. If you are using a tool such as ModelSim that defaults
to VHDL-87, then you will need to supply the correct compiler flag to
get it to accept VHDL-93.
 
V

valentin tihomirov

Yess! I've got to compile it in ActiveHDL and then in Sinplify. The problem
was misleading error message caused by architecture name declatation.
ActiveHDL compiles 93 synthax by default. Furthermore, it allows setting
library for each VHDL file and one-click synthsis. Sinplify compiles without
problems. As usually, I'm getting problems with XST. Webpack environment
assigns VHDL files to correct libraries but I'm getting hierarchy error on
project load. Possibly, this is question to Xilinx support:


-------------------- libraryA----------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity AND2 is
port (
A, B: in std_logic;
O : out std_logic
);
end AND2;
architecture RTL of AND2 is
begin
O <= A and B;
end RTL;


library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity OR2 is
port (
A, B: in std_logic;
O : out std_logic
);
end OR2;
architecture RTL of OR2 is
begin
O <= A or B;
end RTL;
-------------------- end libraryA----------------


-------------------- libraryB----------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity XOR2x is
port (
A, B: in std_logic;
O : out std_logic
);
end XOR2x;

architecture RTL of XOR2x is
begin
O <= A xor B;
end RTL;


library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity OR2 is
port (
A, B: in std_logic;
O : out std_logic
);
end OR2;
architecture RTL of OR2 is
begin
O <= A or B;
end RTL;

-------------------- end libraryB----------------



-------------------- library work----------------
library IEEE, LibraryA, LibraryB;
use IEEE.STD_LOGIC_1164.ALL;

entity MULTILIB_DESIGN is
port (
A, B: in std_logic;
O : out std_logic
);
end MULTILIB_DESIGN;

architecture RTL of MULTILIB_DESIGN is
signal AND_O, XOR_O: std_logic;
begin
AND_U: entity libraryA.AND2 port map (A, B, AND_O);
XOR_U: entity libraryB.XOR2x port map (A, B, XOR_O);
O <= AND_O or XOR_O;
end RTL;
-------------------- end library work----------------
 

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

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top