FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > VHDL

VHDL comp.lang.vhdl newsgroup / Usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-31-2003, 03:52 PM
Tony Benham
Guest
 
Posts: n/a
Default Compare pairs of bits between two slv's ?

I've been puzzling how I can write concise vhdl that will basically set a
bit if any pair of bits in two slv's are both hi ?
A sort of pseudo code for what I want to do is as follows
mask : std_logic_vector(7 downto 0) ;
trig : std_logic_vector(7 downto 0) ;
set : std_logic;

set <= '0' ;
for i in 0 to 7
If mask(i) AND trig(i) = '1'
set <= '1' ;
end if ;
end for ;

In english, if any pair of bits in the two slv's are both hi, the set will
be set to one, else zero

I thought about using For-Generate, but I'm puzzled how to apply for this
case ?

Regards
Tony


Reply With Quote
  #2 (permalink)  
Old 10-31-2003, 04:09 PM
Valentin Tihomirov
Guest
 
Posts: n/a
Default Re: Compare pairs of bits between two slv's ?

S1 <= '0' when (Mask and Trig) = 0 else '1';


Reply With Quote
  #3 (permalink)  
Old 11-01-2003, 09:02 PM
David Bishop
Guest
 
Posts: n/a
Default Re: Compare pairs of bits between two slv's ?


This is why we are thinking of putting vector reduction into
VHDL.

Try this:

set := or_reduce (mask and trig);

You will find a copy of "or_reduce" at:
http://www.vhdl.org/vhdlsynth/

This is functionality we also plan to add in 1164 as well.

Tony Benham wrote:

> I've been puzzling how I can write concise vhdl that will basically set a
> bit if any pair of bits in two slv's are both hi ?
> A sort of pseudo code for what I want to do is as follows
> mask : std_logic_vector(7 downto 0) ;
> trig : std_logic_vector(7 downto 0) ;
> set : std_logic;
>
> set <= '0' ;
> for i in 0 to 7
> If mask(i) AND trig(i) = '1'
> set <= '1' ;
> end if ;
> end for ;
>
> In english, if any pair of bits in the two slv's are both hi, the set will
> be set to one, else zero
>
> I thought about using For-Generate, but I'm puzzled how to apply for this
> case ?
>
> Regards
> Tony
>
>


--
NAME: David W. Bishop INTERNET: [email protected] ( \ )
US MAIL: Hilton NY A Long time ago, \__\/
PHYSICAL: 43:17:17N 77:47:37W 281' In a Galaxy far, far away... | |
For Supernova info: http://www.RochesterAstronomy.org/snimages/ | |
For VHDL/Synthesis info: http://www.vhdl.org/vhdlsynth _/___\_
All standard disclaimers apply. [_______]

Reply With Quote
  #4 (permalink)  
Old 11-02-2003, 12:29 PM
Valentin Tihomirov
Guest
 
Posts: n/a
Default Re: Compare pairs of bits between two slv's ?

I've just reading an answer to my qustion here
http://www.eda.org/comp.lang.vhdl/FAQ1.html
and encountered Reduction section.

-- this concurrent assignment performs an "or"
-- reduction on "a_vec"
a <= '0' when (a_vec = (a_vec'range => '0')) else '1';

-- while this calculates an "and" reduction
a <= '1' when (a_vec = (a_vec'range => '1')) else '0';

Read there about reducing vectors containing 'X' values.


Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Differential pairs per Bank Thomas Reinemann FPGA 7 02-04-2007 08:08 PM
Differential Pin Pairs in Lattice EC FPGAs [email protected] FPGA 4 12-20-2005 08:35 AM
Altera Stratix 80: How to divide a bits stream to even bits streamand odd bits stream zhao FPGA 1 12-16-2003 05:45 PM


All times are GMT +1. The time now is 06:53 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved