![]() |
|
|
|||||||
![]() |
VHDL - comparing the array in parallel |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
hello
in my design i need a logic to compare the array (suppose width 16 bit and size of 0 to 15) with a vector of 16 bit in parallel and in one clk cycle. and need to generate address of array is matching. thank you bye srinukasam |
|
|
|
|
#2 |
|
Posts: n/a
|
srinukasam wrote:
> in my design i need a logic to compare the array (suppose width 16 bit and > size of 0 to 15) with a vector of 16 bit in parallel and in one clk cycle. Just model 16 comparators - each for one array row. match_0 <= '1' when (my_array(0) = my_vector) else '0'; .... > and need to generate address of array is matching. Does the vector match only one array element or may there be more? process(match_0, macht_1 ....) begin if (match_0 = '1') then address<="0000" elsif (match_1 = '1') then address<="0001" elsif ... end if; end process; Note: You may eliminate the intermediate match_X signals if you combine all statements, but this does not lead to a smaller hardware. Ralf Ralf Hildebrandt |
|
|
|
#3 |
|
Posts: n/a
|
Homework buster.
Give directions not solutions. A. On Tue, 28 Jun 2005 16:28:22 +0200, Ralf Hildebrandt wrote: > srinukasam wrote: > >> in my design i need a logic to compare the array (suppose width 16 bit and >> size of 0 to 15) with a vector of 16 bit in parallel and in one clk cycle. > > Just model 16 comparators - each for one array row. > > match_0 <= '1' when (my_array(0) = my_vector) else '0'; > ... > > >> and need to generate address of array is matching. > > Does the vector match only one array element or may there be more? > > process(match_0, macht_1 ....) > begin > if (match_0 = '1') then > address<="0000" > elsif (match_1 = '1') then > address<="0001" > elsif ... > end if; > end process; > > > Note: You may eliminate the intermediate match_X signals if you combine > all statements, but this does not lead to a smaller hardware. > > Ralf Me |
|
|
|
#4 |
|
Posts: n/a
|
try this but in one clock cycle u r able to compare only one address of
array with the vector; try this codee if rst='1'then addr<=(others=> '0'); elsif rising_edge(clk)then array(addr)<= vector addr<= addr+1; if array(addr)= vector then found <='1'; foundaddr<=addr else found <='0'; foundaddr<="zzzz....z"; end if; viku |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| constants as of array of integers, for loops | octavsly | Hardware | 0 | 04-25-2009 11:53 AM |
| How to retrieve array parameter ( JAVA ) | naruponk | Software | 1 | 04-16-2009 10:20 AM |
| Array Programme | rits | Software | 2 | 03-04-2009 05:18 PM |
| Comparing Data | IcePirate | General Help Related Topics | 0 | 09-05-2008 04:31 PM |
| Altera Soft Core parallel tasking? Possible | bbiandov | Hardware | 0 | 12-02-2006 06:00 AM |