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

Reply

VHDL - Comparison of Bit Vectors in a Conditional Signal Assignment Statement

 
Thread Tools Search this Thread
Old 08-04-2003, 02:26 PM   #1
Default Comparison of Bit Vectors in a Conditional Signal Assignment Statement


Hi,

I am trying to compare two bit vectors formed by aggregating/concatenating
individual bits of a vector in a "Conditional Signal Assignment Statement"
as follows:

err <= '1' when ( (int_h_data(19), int_h_data(1, int_h_data(16),
int_h_data(12), int_h_data(4)) /=

(h_data(19), h_data(1, h_data(16), h_data(12),
h_data(4)) ) else

'0' when ( (int_h_data(19), int_h_data(1, int_h_data(16),
int_h_data(12), int_h_data(4)) =

(h_data(19), h_data(1, h_data(16), h_data(12),
h_data(4)) );

The err flag should be set to '1' when the two concatenations are not
equal and should be reset to '0' when the two concatenations are equal.

On compiling the code above, the compiler returns error messages:

int_h_data(12), int_h_data(4)) /=
|
expression is ambiguous

int_h_data(12), int_h_data(4)) =
|
expression is ambiguous

Could you please explain why?

Thanks,
Anand



Anand P Paralkar
  Reply With Quote
Old 08-04-2003, 05:27 PM   #2
Egbert Molenkamp
 
Posts: n/a
Default Re: Comparison of Bit Vectors in a Conditional Signal Assignment Statement
Anand,

I think you have to compare the concated vectors, so something like:
err <= '1' when ( i(19) & i(1 & i(16)) / = ( d(19) & d(1 & d(16))

HOWEVER .. I assume i(19) is a std_logic (std_ulogic) and if you are
using also numeric_std/std_logic_arith then there are multiple functions
"/="
possible (i.e. the ( i(19) & i(1 & i(16)) could be a std_logic_vector,
signed, unsigned).
Therefore qualification can be used:
err <= '1' when std_logic_vector'( i(19) & i(1 & i(16)) / = ( d(19) &
d(1 & d(16))

Or in this specifc case were i(19) and the next index i(1 is used you
could write;
err <= '1' when ( i(19 DOWNTO 1 & i(16)) / = ( d(19 DOWNTO 1 & d(16))
(in this case the type of the vector is still known)

Egbert Molenkamp


"Anand P Paralkar" <> schreef in bericht
newsine.LNX.4.33.0308041845520.23950-...
> Hi,
>
> I am trying to compare two bit vectors formed by aggregating/concatenating
> individual bits of a vector in a "Conditional Signal Assignment Statement"
> as follows:
>
> err <= '1' when ( (int_h_data(19), int_h_data(1, int_h_data(16),
> int_h_data(12), int_h_data(4)) /=
>
> (h_data(19), h_data(1, h_data(16), h_data(12),
> h_data(4)) ) else
>
> '0' when ( (int_h_data(19), int_h_data(1, int_h_data(16),
> int_h_data(12), int_h_data(4)) =
>
> (h_data(19), h_data(1, h_data(16), h_data(12),
> h_data(4)) );
>
> The err flag should be set to '1' when the two concatenations are not
> equal and should be reset to '0' when the two concatenations are equal.
>
> On compiling the code above, the compiler returns error messages:
>
> int_h_data(12), int_h_data(4)) /=
> |
> expression is ambiguous
>
> int_h_data(12), int_h_data(4)) =
> |
> expression is ambiguous
>
> Could you please explain why?
>
> Thanks,
> Anand
>





Egbert Molenkamp
  Reply With Quote
Old 08-04-2003, 09:40 PM   #3
Srinivasan Venkataramanan
 
Posts: n/a
Default Re: Comparison of Bit Vectors in a Conditional Signal Assignment Statement
Hi Anand,
You will need to "qualify" the result of
aggregation/concatenation within your CSA.

err <= '1' when ( bit_vector'(int_h_data(19), int_h_data(1,
int_h_data(16),
int_h_data(12), int_h_data(4)) /=

bit_vector'(h_data(19), h_data(1, h_data(16),
h_data(12),
h_data(4)) ) else

'0' when ( bit_vector'(int_h_data(19), int_h_data(1,
int_h_data(16),
int_h_data(12), int_h_data(4)) =

bit_vector'(h_data(19), h_data(1, h_data(16),
h_data(12),
h_data(4)) );

I don't quite remember why (haven't been using VHDL for quite some
time), but it has to do with the fact that the result of
aggregation/concatenation is ambiguous, I hope some one else will
explain why.

Regards,
Srinivasan
http://www.noveldv.com

Anand P Paralkar <> wrote in message news:<Pine.LNX.4.33.0308041845520.23950->...
> Hi,
>
> I am trying to compare two bit vectors formed by aggregating/concatenating
> individual bits of a vector in a "Conditional Signal Assignment Statement"
> as follows:
>
> err <= '1' when ( (int_h_data(19), int_h_data(1, int_h_data(16),
> int_h_data(12), int_h_data(4)) /=
>
> (h_data(19), h_data(1, h_data(16), h_data(12),
> h_data(4)) ) else
>
> '0' when ( (int_h_data(19), int_h_data(1, int_h_data(16),
> int_h_data(12), int_h_data(4)) =
>
> (h_data(19), h_data(1, h_data(16), h_data(12),
> h_data(4)) );
>
> The err flag should be set to '1' when the two concatenations are not
> equal and should be reset to '0' when the two concatenations are equal.
>
> On compiling the code above, the compiler returns error messages:
>
> int_h_data(12), int_h_data(4)) /=
> |
> expression is ambiguous
>
> int_h_data(12), int_h_data(4)) =
> |
> expression is ambiguous
>
> Could you please explain why?
>
> Thanks,
> Anand



Srinivasan Venkataramanan
  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




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