05.07.2013 Views

Xilinx Synthesis Technology User Guide

Xilinx Synthesis Technology User Guide

Xilinx Synthesis Technology User Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

XST <strong>User</strong> <strong>Guide</strong><br />

Packages<br />

XST supports recursive functions as well. Example 6-25 represents n!<br />

function.<br />

Example 6-25 Recursive Function<br />

function my_func( x : integer ) return integer is<br />

begin<br />

if x = 1 then<br />

return x;<br />

else<br />

return (x*my_func(x-1));<br />

end if;<br />

end function my_func;<br />

VHDL models may be defined using packages. Packages contain<br />

type and subtype declarations, constant definitions, function and<br />

procedure definitions, and component declarations.<br />

This mechanism provides the ability to change parameters and<br />

constants of the design (for example, constant values, function<br />

definitions). Packages may contain two declarative parts: package<br />

declaration and body declaration. The body declaration includes the<br />

description of function bodies declared in the package declaration.<br />

XST provides full support for packages. To use a given package, the<br />

following lines must be included at the beginning of the VHDL<br />

design:<br />

library lib_pack;<br />

-- lib_pack is the name of the library specified<br />

-- where the package has been compiled (work by<br />

-- default)<br />

use lib_pack.pack_name.all;<br />

-- pack_name is the name of the defined package.<br />

XST also supports predefined packages; these packages are<br />

pre-compiled and can be included in VHDL designs. These packages<br />

are intended for use during synthesis, but may also used for<br />

simulation.<br />

6-36 <strong>Xilinx</strong> Development System

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!