Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Different VHDL-interpretation between Xilinx ISE/ModelSimXE?

 
Thread Tools Search this Thread
Old 03-17-2006, 01:04 PM   #1
Default Different VHDL-interpretation between Xilinx ISE/ModelSimXE?


If have been experimenting with VHDL in ModelSim XE, and made a design (a
DeltaSigma-modulator) that works and simulates properly. I tried putting it
all into Xilinx ISE (the webpack) to synthesise it to get an idea about how
to do it. However, the VHDL that worked in ModelSim does not work unchanged
in Xilinx, and i have no clue why. Any help is appreciated. Here is the line
of code that is causing the problem:

sumx <= std_logic_vector(signed(X1C1) + signed(X2C2) + signed(X3C3));

The three input signals and sumx are of type std_logic_vector. This works
fine in ModelSim but when running "Check Syntax" process in Xilinx, it
complains about the following:

ERROR:HDLParsers:3329 -
"D:/Profil/Skrivebord/Delt/P9/CRFB1/CascadeElement.vhd" Line 80. Expression
in type conversion to std_logic_vector has 2 possible definitions in this
scope, for example, SIGNED and std_logic_vector.

In the top of the file i have these definitions:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

I was told to use numeric_std (no one can provide good arguments), and so i
did. However, in one other entity, which i instantiate in this entity, i
internally use std_logic_arith because the resize-function in numeric_std
doesn't work "correctly" (the conv_signed in std_logic_arith does). All
entity ports are declared as std_logic_vector and signed types are only used
inside entities. I have a suspicion that this is causing the problem - but
why can ModelSim do it ? Is there a way to explicitly tell Xilinx which
conversion/arithmetic functions to use, when it cannot decide by itself? Or
is the root to this problem to be found elsewhere?




Thomas Thorsen
  Reply With Quote
Old 03-17-2006, 05:47 PM   #2
Mike Treseler
 
Posts: n/a
Default Re: Different VHDL-interpretation between Xilinx ISE/ModelSimXE?
Thomas Thorsen wrote:

> ERROR:HDLParsers:3329 -
> "D:/Profil/Skrivebord/Delt/P9/CRFB1/CascadeElement.vhd" Line 80. Expression
> in type conversion to std_logic_vector has 2 possible definitions in this
> scope, for example, SIGNED and std_logic_vector.


I expect that Modelsim has it right, but
errors like the above can result from user
defined vector types or subtypes.
Use only signed, unsigned or std_logic_vector for vectors.

> library ieee;
> use ieee.std_logic_1164.all;
> use ieee.numeric_std.all;


That should be all you need.

> I was told to use numeric_std (no one can provide good arguments),


The best argument is that it is an IEEE standard
while std_logic_arith is not. However both are
widely used and supported.

> However, in one other entity, which i instantiate in this entity, i
> internally use std_logic_arith because the resize-function in numeric_std
> doesn't work "correctly" (the conv_signed in std_logic_arith does).


I disagree that there is any problem.
Here is the discussion. You can decide for yourself:
http://groups.google.com/groups/sear...signed+rushton
In any case, you might try backing out std_logic_arith to
see if it solves your problem.

> Is there a way to explicitly tell Xilinx which
> conversion/arithmetic functions to use, when it cannot decide by itself?


There is no decision to be made.
The library and use clauses make the selection.

> Or is the root to this problem to be found elsewhere?


I would bet on either a code or an ISE problem.
You might get a second opinion from the free quartus download.

And here are some more resize examples.
http://groups.google.com/groups/sear...+resize+signed

Good luck.

-- Mike Treseler


Mike Treseler
  Reply With Quote
Old 03-18-2006, 12:11 PM   #3
Thomas Thorsen
 
Posts: n/a
Default Re: Different VHDL-interpretation between Xilinx ISE/ModelSimXE?

"Mike Treseler" <> skrev i en meddelelse
news:...
> Thomas Thorsen wrote:
>
>> ERROR:HDLParsers:3329 -
>> "D:/Profil/Skrivebord/Delt/P9/CRFB1/CascadeElement.vhd" Line 80.
>> Expression in type conversion to std_logic_vector has 2 possible
>> definitions in this scope, for example, SIGNED and std_logic_vector.

>
> I expect that Modelsim has it right, but
> errors like the above can result from user
> defined vector types or subtypes.
> Use only signed, unsigned or std_logic_vector for vectors.


I solved the problem by using a type qualifier:

sumx <= std_logic_vector(signed'(signed(X1C1) + signed(X2C2) +
signed(X3C3)));

This removes the ambiguity and both Xilinx and ModelSim accepts it. However,
i found out that if i used std_logic_arith instead, i could reduce it all
to:

sumx <= signed(X1C1) + signed(X2C2) + signed(X3C3);

since this package defines so many different add-functions that it can
actually output a std_logic_vector from the second add-operation (while
using a function that returns a signed from the first add).

I like that, but still i'm being told to use numeric_std that doesn't have
this nice abundant supply of different operators.

>> However, in one other entity, which i instantiate in this entity, i
>> internally use std_logic_arith because the resize-function in numeric_std
>> doesn't work "correctly" (the conv_signed in std_logic_arith does).

>
> I disagree that there is any problem.
> Here is the discussion. You can decide for yourself:
> http://groups.google.com/groups/sear...signed+rushton
> In any case, you might try backing out std_logic_arith to
> see if it solves your problem.


Well, i don't think there's a "problem", i just think the way conv_signed
std_logic_arith works is more intuitive than resize in numeric_std. If you
want the sign-preservation-behaviour (and i agree with Andrew Rushton that
it is odd behaviour), you can easily emulate it:

res = X(X'left) & conv_signed(X,res'length-1);

>> Is there a way to explicitly tell Xilinx which conversion/arithmetic
>> functions to use, when it cannot decide by itself?

>
> There is no decision to be made.
> The library and use clauses make the selection.


Well, i found (in Andrew Rushtons excellent book) that using type qualifiers
is a very effective (but not very readable) solution for indirectly
specifying which function to use.

> And here are some more resize examples.
> http://groups.google.com/groups/sear...+resize+signed


The figures in Rushton's book says it all!




Thomas Thorsen
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute an external software from VHDL? And how to interface VHDL with JAVA? becool_nikks Software 0 03-06-2009 07:08 PM
Help on auto conversion from Matlab to vhdl on filter design hardheart Hardware 0 12-07-2007 09:19 AM
VHDL RAM help!:) lastval Hardware 0 11-09-2007 01:40 PM
ARRAY(n DOWNTO 0) OF STD_LOGIC_VECTOR(m DOWNTO 0) - VHDL freitass Hardware 0 11-01-2007 03:44 PM
VHDL (Assigning pins in xilinx) amanpervaiz Hardware 3 12-02-2006 04:37 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46