Home    Bloggers    Messages    Webinars    Resources   
Tw  |  Fb  |  In  |  Rss
Adam Taylor

Ask Adam VHDL: Libraries

Adam Taylor
<<   <   Page 2 / 5   >   >>
devel@latke.net
devel@latke.net
1/28/2013 3:25:32 PM
User Rank
Guru
Re: Timely
Let's keep this in perspective.

For the vast majority of designs, VHDL's libraries feature isn't necessary for anything other than using the standard libraries (std_logic_1164, numeric_std).

Any organization that practices code reuse will find it easier to keep the code modules in a source-code-control system and pull in the source for each module as needed. There's no real point to compiling the source down to a netlist and sharing only the netlist. You don't save any time (synthesis is generally not a time sink) and now you have to deal with keeping track of binaries and you still have to maintain the library interface. That's too much work for basically no benefit.

So, basically, yeah, VHDL libraries exist. Don't bother with them.

 

50%
50%
devel@latke.net
devel@latke.net
1/28/2013 3:20:37 PM
User Rank
Guru
Re: Timely
duane:


First, I've read that libraries can be used in both Verilog and VHDL. The Verilog that I've gotten to so far doesn't need any libraries and has everything I've needed built into the language. The clock buffer that I've instantiated seems like it would be pulled from a library, but nothing is needed along the lines of a library declaration or include. Does Verilog just search and find the libraries as long as they are in a search path?


 

I think it's worth emphasizing that a VHDL library is a specific feature of the language. That is the point I was trying to make in my first post in this thread. Again, the concept of a VHDL library is exactly the same as it is for a C program which links to some precompiled library.  In VHDL you "use" a library and package and include the library in the project in a tool-specific manner (makefile, whatever). In C, you #include a header and link in a library in a tool-specific manner (makefile, whatever). As part of all of this, the analyzer (compiler) can check to see if the component instantiation matches the component definition.

Verilog doesn't have any concept of a library as such. You don't "include" anything. You basically instantiate a lower-level entity. Then in a tool-specific manner, the back end "linker" is told about precompiled modules which include the stuff you want. But there is no checking at compile time whether the module instantiation matches anything that exists (this is the point of the component declaration in the package).

So in Verilog your clock buffer gets instantiated but there's nothing to tell the compiler that the instantiation is correct. You find out when the design is fleshed out by the linker.


The other question I have relates to using the libraries. In Verilog, if I write HDL for circuitry that doesn't do anything, Verilog ignores it and doesn't configure that part of the HDL code. Does VHDL do the same thing, or does it configure every function that is in the package being used?


 

When you use a library/package in VHDL, you're telling the analyzer: "here are some definitions." Obviously you don't use everything in, say, the numeric_std library with each design, so the tools do what you expect: anything that's not used in the design doesn't exist.

Now let's be clear: if you say "write HDL for circuitry that doesn't do anything," that's a separate issue from libraries. It's common to have an entity which has some output ports you don't use (FIFO flags, for example). When you instantiate the FIFO, regardless of whether it's in a library or not, if you don't use the almost-empty flag, then it will be optimized away along with all of the logic which drives it. This happens in VHDL and in Verilog.

50%
50%
Garcia-Lasheras
Garcia-Lasheras
1/28/2013 2:18:15 PM
User Rank
Blogger
Re: Re-focus: hard placed libraries
SOLVED: I have just found the VHDL code snipet I needed for Xilinx devices.

@devel, @william, @tobias: thank you very much for your design tips. Your comments has been quite useful!!

*** Extracted from Xilinx Constraints Guide (UG625) ***

The following code sample shows how to use Relative Location constraints with a
VHDL generate statement. The code is a simple example showing how to auto-generate
the Relative Location constraints for several instantiated FDE components. This
methodology can be used with virtually any primitive.
Note The user must create the itoa function.

****************************************************************


LEN:for i in 0 to bits-1 generate
    constant row :natural:=((width-1)/2)-(i/2);
    constant column:natural:=0;
    constant slice:natural:=0;
    constant rloc_str : string := "R" & itoa(row) & "C" & itoa(column) & ".S" & itoa(slice);
    attribute RLOC of U1: label is rloc_str;
begin
    U1: FDE port map (
        Q=> dd(j),
        D=> ff_d,
        C=> clk,
        CE =>lcl_en(en_idx));
end generate LEN;



 

50%
50%
Duane Benson
Duane Benson
1/28/2013 12:41:04 PM
User Rank
Blogger
Timely
Adam - This blog is very timely as I'm stepping back and looking at VHDL now. I've got a couple of questions that perhaps you (or anyone else here) could clarify for me.

First, I've read that libraries can be used in both Verilog and VHDL. The Verilog that I've gotten to so far doesn't need any libraries and has everything I've needed built into the language. The clock buffer that I've instantiated seems like it would be pulled from a library, but nothing is needed along the lines of a library declaration or include. Does Verilog just search and find the libraries as long as they are in a search path?

The other question I have relates to using the libraries. In Verilog, if I write HDL for circuitry that doesn't do anything, Verilog ignores it and doesn't configure that part of the HDL code. Does VHDL do the same thing, or does it configure every function that is in the package being used?

50%
50%
Max Maxfield
Max Maxfield
1/28/2013 12:14:00 PM
User Rank
Blogger
Re: About VHDL libraries
@Brian: I wonder if he has a matching cape.

If not, I can loan him one of my old ones :-)

50%
50%
Brian
Brian
1/28/2013 12:12:11 PM
User Rank
Guru
Re: About VHDL libraries
 

@Max: let's just hope Super-Jez doesn't post photos or videos!  (I wonder if he has a matching cape... :-)

 

50%
50%
devel@latke.net
devel@latke.net
1/28/2013 11:40:31 AM
User Rank
Guru
Re: Re-focus: hard placed libraries
I'm looking for advice in creating hard-placed libraries in Xilinx devices. I mean, how would you implement in VHDL a library of blocks in which at least mapping is totally controlled?.

VHDL is the logic description, and has nothing to do with how the back-end place and route tools do their jobs. This is no different from schematic entry.

Having said that, certainly the VHDL can include pragmas and attributes which the synthesis tool can pass on to the back-end stuff.

Go back and read what I wrote in the first comment on Adam's post. A VHDL library is a convenience that allows you to not provide VHDL sources (for hard-core black boxes, for IP whose source you don't want to release, etc) to the analyzer and elaborator at build time.

What you probably want to do is to use the synthesis tool to create netlists (NGC) which include placement constraints. Your source HDL will probably have a lot of instantiated primitives which makes setting placement constraints easier at the cost of making the code unreadable. Then you need a wrapper for your black box which is a component instantiated in your code. How to do this? I have no idea. I've never needed to create a black box.

And don't forget that mapping is specific to one device (family and package), so going from, say, Spartan 3AN 200 to 700 might break your placement constraints.

(I'll avoid saying that async design in FPGAs is a fool's errand. Ooops.)

50%
50%
William Murray
William Murray
1/28/2013 11:20:49 AM
User Rank
Blogger
Re: Re-focus: hard placed libraries
@Garcia -- with the right timing constraints and if-def statments and a C preprocessor program(GNU or similar) one could have vendor call outs for each vendor one wanted to use based on a #define statement.  This would allow the library to run on both brand A and brand X as well as possibly others - If you can get it to work with timing constraints, it might open up some new speed/price points for FPGA's that are presently unmet by the more expensive Achronix parts by using conventional FPGA's for greater speed. 

50%
50%
Max Maxfield
Max Maxfield
1/28/2013 10:28:58 AM
User Rank
Blogger
Re: About VHDL libraries
@Jezmo: I dont wear the skin tight lycra for nothing you know


It's the wearing of your undergarments outside your trousers that's the most worrying:-)

50%
50%
Garcia-Lasheras
Garcia-Lasheras
1/28/2013 9:32:48 AM
User Rank
Blogger
Re: Re-focus: hard placed libraries
@William: Thank you very much for the info, I'm going to take a deeper look to the user guide. Time constraining may suppose a workaround to the task I'm performing.

Previously, in order to describe the hardware mapping and relative P&R of the library, I used RLOC constraints & RPMs... but when migrating the code, I noticed that these have become unsupported!!

Does somebody knows if RLOC directives & RPMs are still available in ISE14 (or Vivado)??

If so... where can I get more detailed information?

 

50%
50%
<<   <   Page 2 / 5   >   >>
More Blogs from Adam Taylor
Here we discover how to use the XADC (Xilinx Analog-to-Digital Convertor) in the Zynq All Programmable SoC to read the chip's internal temperature and voltage parameters and output them over an RS-232 link.
Now it's time to consider how we can implement and use the Xilinx Analog to Digital Convertor (XADC) within a Zynq All Programmable SoC-based system.
The Zynq All Programmable SoC comes equipped with programmable analog capabilities that can be used in a wide variety of applications, including defense, industrial, and automotive systems.
This is the blog we've all been waiting for – the point where we finally create our very first, standalone, "bare metal" Zynq application!
In the case of a real-world use model, we want to store our software program and configuration bitstream in nonvolatile memory and configure the device after the power comes on.
flash poll
follow us on twitter
follow Xilinx on twitter
like us on facebook
like Xilinx on facebook
All Programmable Planet     About Us     Contact Us     Help     Register     Twitter     Facebook     RSS