Hi,

I usually try to avoid creating libraries because of the additional

handling involved, but once in a while libraries are forced by re-used code.

> How can I create a library out of a design to be re-used by other
> designs ?

For my part, I keep sources and objects for a library together in a
directory. Here's an example on how I set up the LPM library:

$ cd /some/where/libs/lpm
$ find .
./src/220pack.vhd
./src/220model.vhd

Compile the source into library lpm. This is achieved by setting work to
the library name in the analyze step (--work=lpm). Without --work=lpm,
the code is analyzed for library work and not library lpm.

$ mkdir lpm220_v93
$ ghdl -a --work=lpm --workdir=lpm220_v93 --std=93 src/220pack.vhd
$ ghdl -a --work=lpm --workdir=lpm220_v93 --std=93 src/220model.vhd

Now "library lpm" can be used in VHDL files with approriate options for
analyze and elaborate steps:

$ ghdl -a --std=93 -P/some/where/libs/lpm/lpm220_v93 <file.vhd>
$ ghdl -e --std=93 -P/some/where/libs/lpm/lpm220_v93 <design unit>

Library and "work" must match the same VHDL standard. This is why I tend
to set the VHDL standard explicitly in paths and options.

> Is it so that I just have to analyze the design and put
> it under /usr/lib/gcc/i686-pc-linux-gnu/4.3.4/vhdl/lib/<LIBRARY NAME>/ ??

I'd not recommend to place user-generated libraries in the installation
directory. They're not part of the installation and will be very likely
obsoleted by a new GHDL version anyway.

>From what I remember, the VHDL standard can be quite strict about the
storage location of library objects. Compiling a library in
/some/where/libs/lpm/lpm220_v93 and copying the objects to
/another/place/lpm220 might invalidate them. Don't know how GHDL handles
this, but I've seen other simulators that are quite picky in this
respect.

Hope this helps
Arnim

_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to