Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Using Xilinx VHDL code with UNISIM on Altera toolset

Reply
Thread Tools

Using Xilinx VHDL code with UNISIM on Altera toolset

 
 
Nicholas Kinar
Guest
Posts: n/a
 
      12-02-2011
Hello,

I've recently downloaded some VHDL code
(http://www.xess.com/projects/sdramtst-1_6.zip), and I would like to
port this code to run on an Altera FPGA.

However, the VHDL code makes reference to the UNISIM library. I am
wondering if it would be possible to modify this code so that it can run
on an Altera processor. What functionality is offered by the UNISIM
library, and is it possible to replicate this functionality using Xilinx
tools?

Thank you,

Nicholas
 
Reply With Quote
 
 
 
 
backhus
Guest
Posts: n/a
 
      12-02-2011
On 2 Dez., 01:51, Nicholas Kinar <(E-Mail Removed)> wrote:
> Hello,
>
> I've recently downloaded some VHDL code
> (http://www.xess.com/projects/sdramtst-1_6.zip), and I would like to
> port this code to run on an Altera FPGA.
>
> However, the VHDL code makes reference to the UNISIM library. *I am
> wondering if it would be possible to modify this code so that it can run
> on an Altera processor. *What functionality is offered by the UNISIM
> library, and is it possible to replicate this functionality using Xilinx
> tools?
>
> Thank you,
>
> Nicholas


Hi Nicholas,
UNISIM mainly contains primitive elements of the XILINX FPGAs, but
this may also include special I/O elements and even stuff like DCMs
etc.

Browse the code to find what elements from UNISIM are instantiated.
In most cases (like for AND2 etc.) you will find simple replacements
in the Altera libraries.
For other stuff you have to find something that comes close and adapt
the design, since some elements are specific for each vendors FPGA
fabric.

Have a nice synthesis
Eilert
 
Reply With Quote
 
 
 
 
Nicholas Kinar
Guest
Posts: n/a
 
      12-02-2011

> Hi Nicholas,
> UNISIM mainly contains primitive elements of the XILINX FPGAs, but
> this may also include special I/O elements and even stuff like DCMs
> etc.
>
> Browse the code to find what elements from UNISIM are instantiated.
> In most cases (like for AND2 etc.) you will find simple replacements
> in the Altera libraries.
> For other stuff you have to find something that comes close and adapt
> the design, since some elements are specific for each vendors FPGA
> fabric.
>
> Have a nice synthesis
> Eilert



Thanks, Eilert; this is very much appreciated! By removing "UNISIM"
from "library IEEE, UNISIM;" I was able to see errors caused by not
having the UNISIM library available.

Most of these errors seem to be associated with not having the
following functions available:

log2
int_select

as well as the following identifiers:

YES
NO

It appears that log2 is the logarithm to the base 2. Alternately,
int_select appears to be something that selects between integers. YES
and NO might map to boolean values.

Is there any VHDL source or documentation available for log2, the
init_select, and the YES and NO values?

Nicholas







 
Reply With Quote
 
Tricky
Guest
Posts: n/a
 
      12-05-2011
On Dec 2, 2:45*pm, Nicholas Kinar <(E-Mail Removed)> wrote:
> > Hi Nicholas,
> > UNISIM mainly contains primitive elements of the XILINX FPGAs, but
> > this may also include special I/O elements and even stuff like DCMs
> > etc.

>
> > Browse the code to find what elements from UNISIM are instantiated.
> > In most cases (like for AND2 etc.) you will find simple replacements
> > in the Altera libraries.
> > For other stuff you have to find something that comes close and adapt
> > the design, since some elements are specific for each vendors FPGA
> > fabric.

>
> > Have a nice synthesis
> > * *Eilert

>
> Thanks, Eilert; this is very much appreciated! *By removing "UNISIM"
> from "library IEEE, UNISIM;" I was able to see errors caused by not
> having the UNISIM library available.
>
> Most of these errors seem to be associated with not having the
> following functions available:
>
> log2
> int_select
>
> as well as the following identifiers:
>
> YES
> NO
>
> It appears that log2 is the logarithm to the base 2. *Alternately,
> int_select appears to be something that selects between integers. YES
> and NO might map to boolean values.
>
> Is there any VHDL source or documentation available for log2, the
> init_select, and the YES and NO values?
>
> Nicholas


If you have a copy of modelsim with the unisim libraries, see if you
can view the source code here. It is Xilinx Proprietary so you may not
have the source.
As for log2, its a fairly universal function you can write easily with
a for loop:

function log2( i : natural) return integer is
variable temp : integer := i;
variable ret_val : integer := 1; --log2 of 0 should equal 1 because
you still need 1 bit to represent 0
begin
while temp > 1 loop
ret_val := ret_val + 1;
temp := temp / 2;
end loop;

return ret_val;
end function;
 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      12-05-2011
On Dec 1, 6:51*pm, Nicholas Kinar <(E-Mail Removed)> wrote:
> Hello,
>
> I've recently downloaded some VHDL code
> (http://www.xess.com/projects/sdramtst-1_6.zip), and I would like to
> port this code to run on an Altera FPGA.
>
> However, the VHDL code makes reference to the UNISIM library. *I am
> wondering if it would be possible to modify this code so that it can run
> on an Altera processor. *What functionality is offered by the UNISIM
> library, and is it possible to replicate this functionality using Xilinx
> tools?
>
> Thank you,
>
> Nicholas


Check the licensing restrictions on the unisim library and for any
other code from Xilinx. Most I've seen restricts use to Xilinx FPGAs
only.

Andy
 
Reply With Quote
 
Nicholas Kinar
Guest
Posts: n/a
 
      12-08-2011
On 05/12/2011 10:26 AM, Andy wrote:
>
> Check the licensing restrictions on the unisim library and for any
> other code from Xilinx. Most I've seen restricts use to Xilinx FPGAs
> only.
>
> Andy


Thank you; I will check this out.

Nicholas

 
Reply With Quote
 
Nicholas Kinar
Guest
Posts: n/a
 
      12-08-2011

>
> If you have a copy of modelsim with the unisim libraries, see if you
> can view the source code here. It is Xilinx Proprietary so you may not
> have the source.
> As for log2, its a fairly universal function you can write easily with
> a for loop:
>
> function log2( i : natural) return integer is
> variable temp : integer := i;
> variable ret_val : integer := 1; --log2 of 0 should equal 1 because
> you still need 1 bit to represent 0
> begin
> while temp> 1 loop
> ret_val := ret_val + 1;
> temp := temp / 2;
> end loop;
>
> return ret_val;
> end function;


Thank you; this is very useful.

Nicholas

 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      12-09-2011
On Dec 5, 4:28*am, Tricky <(E-Mail Removed)> wrote:
> If you have a copy of modelsim with the unisim libraries, see if you
> can view the source code here. It is Xilinx Proprietary so you may not
> have the source.
> As for log2, its a fairly universal function you can write easily with
> a for loop:
>
> function log2( i : natural) return integer is
> * variable temp * *: integer := i;
> * variable ret_val : integer := 1; --log2 of 0 should equal 1 because
> you still need 1 bit to represent 0
> begin
> * while temp > 1 loop
> * * ret_val := ret_val + 1;
> * * temp * *:= temp / 2;
> * end loop;
>
> * return ret_val;
> end function;- Hide quoted text -
>
> - Show quoted text -


This really should not be called log2() because it does not return the
base 2 logarithm of the argument. It returns log2(i) + 1 instead. For
example, log2(1) = 0, log2(2) = 1 and log2(0) is undefined.

-- this (untested) function returns the base 2 logarithm of nn >= 1)
function log2(n : positive) return natural is
variable temp : positive := n;
variable retval : natural := 0;
begin
while temp > 1 loop
retval := retval + 1;
temp := temp / 2;
end loop;
return retval;
end function log2;

I don't know if Xilinx's unisim log2() is similarly mathematically
flawed, but I wanted to make sure that someone googling for a
mathematical function "vhdl log2()" is not mislead. You can probably
tell from the context of how Xilinx uses it whether or not their's is
mathematically accurate, or just logically convenient.

When calculating the number of bits required to represent the range 0
to n, use log2(n) + 1. However, the upper index of an appropriately
sized unsigned subtype would be log2(n), assuming the lower index is
0.

subtype n_range is natural range 0 to n;
subtype n_unsigned is unsigned(log2(n_range'high) downto 0);

variable x : natural range 0 to 0; -- is a constant

Andy
 
Reply With Quote
 
Nicholas Kinar
Guest
Posts: n/a
 
      12-10-2011

> This really should not be called log2() because it does not return the
> base 2 logarithm of the argument. It returns log2(i) + 1 instead. For
> example, log2(1) = 0, log2(2) = 1 and log2(0) is undefined.
>
> -- this (untested) function returns the base 2 logarithm of nn>= 1)
> function log2(n : positive) return natural is
> variable temp : positive := n;
> variable retval : natural := 0;
> begin
> while temp> 1 loop
> retval := retval + 1;
> temp := temp / 2;
> end loop;
> return retval;
> end function log2;
>
> I don't know if Xilinx's unisim log2() is similarly mathematically
> flawed, but I wanted to make sure that someone googling for a
> mathematical function "vhdl log2()" is not mislead. You can probably
> tell from the context of how Xilinx uses it whether or not their's is
> mathematically accurate, or just logically convenient.
>
> When calculating the number of bits required to represent the range 0
> to n, use log2(n) + 1. However, the upper index of an appropriately
> sized unsigned subtype would be log2(n), assuming the lower index is
> 0.
>
> subtype n_range is natural range 0 to n;
> subtype n_unsigned is unsigned(log2(n_range'high) downto 0);
>
> variable x : natural range 0 to 0; -- is a constant
>
> Andy



Thanks, Andy; this is very helpful. I have now created a VHDL library
with the log2 code.

So this now takes care of the log2 function.

My next step in porting the code is to fix errors related to unknown
identifiers "int_select" as well as "yes" and "no". I am assuming that
these are also defined in the UNISIM library?

Nicholas


 
Reply With Quote
 
Nicholas Kinar
Guest
Posts: n/a
 
      12-11-2011
On 10/12/2011 12:01 PM, Nicholas Kinar wrote:
>
> My next step in porting the code is to fix errors related to unknown
> identifiers "int_select" as well as "yes" and "no". I am assuming that
> these are also defined in the UNISIM library?
>
> Nicholas
>
>


It turns out that "int_select" is a function in the common.vhd file
distributed with the SDRAM controller code. "Yes" and "No" are simply
constants in the common package found within the common.vhd file. This
seems to complete the final piece of the puzzle.

Nicholas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
importing the xilinx unisim files suresh VHDL 5 04-11-2008 02:52 PM
equivalent Xilinx FPGA for Altera Stratix II GX-60 ,Altera StratixII GX-90 chaitu VHDL 1 01-28-2008 12:46 PM
[ANNOUNCE] YARDstick - custom processor development toolset Uncle Noah VHDL 12 09-21-2007 01:26 AM
The corresponding Actel library of the Xilinx UNISIM bs.addr@googlemail.com VHDL 3 06-09-2006 06:47 AM
Altera to Xilinx Ronny Hengst VHDL 1 07-24-2003 05:05 PM



Advertisments