EDAboard.com | EDAboard.eu | EDAboard.de | EDAboard.co.uk | RTV forum PL | NewsGroups PL

Using Xilinx VHDL code with UNISIM on Altera toolset

Ask a question - edaboard.com

elektroda.net NewsGroups Forum Index - VHDL Language - Using Xilinx VHDL code with UNISIM on Altera toolset

Nicholas Kinar
Guest

Fri Dec 02, 2011 1:51 am   



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

backhus
Guest

Fri Dec 02, 2011 8:49 am   



On 2 Dez., 01:51, Nicholas Kinar <n.ki...@usask.ca> wrote:
Quote:
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

Nicholas Kinar
Guest

Fri Dec 02, 2011 3:45 pm   



Quote:
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

Tricky
Guest

Mon Dec 05, 2011 12:28 pm   



On Dec 2, 2:45 pm, Nicholas Kinar <n.ki...@usask.ca> wrote:
Quote:
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;

Andy
Guest

Mon Dec 05, 2011 6:26 pm   



On Dec 1, 6:51 pm, Nicholas Kinar <n.ki...@usask.ca> wrote:
Quote:
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

Nicholas Kinar
Guest

Thu Dec 08, 2011 4:44 pm   



On 05/12/2011 10:26 AM, Andy wrote:
Quote:

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

Nicholas Kinar
Guest

Thu Dec 08, 2011 6:42 pm   



Quote:

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

Andy
Guest

Fri Dec 09, 2011 5:07 pm   



On Dec 5, 4:28 am, Tricky <trickyh...@gmail.com> wrote:
Quote:
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 nSadn >= 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

Nicholas Kinar
Guest

Sat Dec 10, 2011 7:01 pm   



Quote:
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 nSadn>= 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

Nicholas Kinar
Guest

Sun Dec 11, 2011 2:53 am   



On 10/12/2011 12:01 PM, Nicholas Kinar wrote:
Quote:

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

elektroda.net NewsGroups Forum Index - VHDL Language - Using Xilinx VHDL code with UNISIM on Altera toolset

Ask a question - edaboard.com

Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
RTV map EDAboard.com map News map EDAboard.eu map EDAboard.de map EDAboard.co.uk map Opony