Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Complex Bit Index Syntax, does this exist?

Reply
Thread Tools

Complex Bit Index Syntax, does this exist?

 
 
Alex
Guest
Posts: n/a
 
      10-16-2006
I'm trying to find if there's a syntax for this (this doesn't work):

OUTPUT_BIT <= ((value1_4bit & value2_4bit) - value3_8bit) (7);

In summary, .. in a single statement, combining two 4 bit values,
subtracting an 8bit value from them, and getting the most significant
bit of the result. Is there a way to synthesize this outside of a
process statement?

If it matters, i'm using Xilinx ISE 8.2.03i.

Thanks,

Alex McHale

 
Reply With Quote
 
 
 
 
Andy
Guest
Posts: n/a
 
      10-16-2006
Why do you need this in one statement?

It will likely be more self-documenting and easier to maintain if you
can use more than one statement, and put them in a function if
necessary i.e. for an initial value, etc.

Also, are these signed are unsigned quantities? If unsigned, is the
result of the subtraction guaraneed to be non-negative, or do you care?


Knowing that, I could probably come up with a cryptic expression
(almost as cryptic as the one you tried) that would give it to you in
one statement, but then you, and more importantly the next poor sap
that has to maintain your design, would not know what was being done.

Andy


Alex wrote:
> I'm trying to find if there's a syntax for this (this doesn't work):
>
> OUTPUT_BIT <= ((value1_4bit & value2_4bit) - value3_8bit) (7);
>
> In summary, .. in a single statement, combining two 4 bit values,
> subtracting an 8bit value from them, and getting the most significant
> bit of the result. Is there a way to synthesize this outside of a
> process statement?
>
> If it matters, i'm using Xilinx ISE 8.2.03i.
>
> Thanks,
>
> Alex McHale


 
Reply With Quote
 
 
 
 
Jonathan Bromley
Guest
Posts: n/a
 
      10-19-2006
On 16 Oct 2006 12:03:14 -0700, "Alex" <(E-Mail Removed)> wrote:

>I'm trying to find if there's a syntax for this (this doesn't work):
>
> OUTPUT_BIT <= ((value1_4bit & value2_4bit) - value3_8bit) (7);
>
>In summary, .. in a single statement, combining two 4 bit values,
>subtracting an 8bit value from them, and getting the most significant
>bit of the result. Is there a way to synthesize this outside of a
>process statement?


You can't subscript an expression, only an object. Make an
intermediate signal or variable to hold the result, and subscript
that. It'll synthesise just as well, and as Andy said it will be
easier to understand.

Alternatively, if the vectors are all of SIGNED data type, you
could simply test the result's sign:

OUTPUT_BIT <= '1' when
((value1_4bit & value2_4bit) - value3_8bit) < 0
else '0';

and in some situations that might be even clearer.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
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
What is the point of having 16 bit colour if a computer monitor can only display 8 bit colour? How do you edit 16 bit colour when you can only see 8 bit? Scotius Digital Photography 6 07-13-2010 03:33 AM
sorting index-15, index-9, index-110 "the human way"? Tomasz Chmielewski Perl Misc 4 03-04-2008 05:01 PM
64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit, Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new ! vvcd Computer Support 0 09-17-2004 08:15 PM
For expert on complex loops (reposted) - complex looping problem news.amnet.net.au Java 1 04-13-2004 07:10 AM
64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit,Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new! Ionizer Computer Support 1 01-01-2004 07:27 PM



Advertisments