How best to implement search function in Verilog? - verilog
This is a discussion on How best to implement search function in Verilog? - verilog ; An irregular array contains a[32] = {0, 3, 10, 17, 33, ..., 1000}, find the
location my data is.
For example, if data is between 0~3, result = 1, between 3~10, result = 2,
etc.
Do I write 64 comparators ...
-
How best to implement search function in Verilog?
An irregular array contains a[32] = {0, 3, 10, 17, 33, ..., 1000}, find the
location my data is.
For example, if data is between 0~3, result = 1, between 3~10, result = 2,
etc.
Do I write 64 comparators to find out the result (assuming single cycle
operation).
Thanks.
-
Re: How best to implement search function in Verilog?
Mr. Ken wrote:
> An irregular array contains a[32] = {0, 3, 10, 17, 33, ..., 1000}, find the
> location my data is.
> For example, if data is between 0~3, result = 1, between 3~10, result = 2,
> etc.
>
> Do I write 64 comparators to find out the result (assuming single cycle
> operation).
>
> Thanks.
Nobody will do your homework, but I will give you a small tip:
Your array has members which are ordered.
Each search iteration can be done in one cycle.
If yes, then you don't need 64 comparators (why 64?).
Instead, you will need just ....
The rest of exercise goes to your assignment.
Have you ever heard "binary search"?
Utku.
-
Re: How best to implement search function in Verilog?
Sorry I haven't read the sentence with "one cycle".
One cycle search is technically an overkill.
You must increase the number of clock cycles to pay less for silicon.
Utku.
utku.ozcan@gmail.com wrote:
> Mr. Ken wrote:
> > An irregular array contains a[32] = {0, 3, 10, 17, 33, ..., 1000}, find the
> > location my data is.
> > For example, if data is between 0~3, result = 1, between 3~10, result = 2,
> > etc.
> >
> > Do I write 64 comparators to find out the result (assuming single cycle
> > operation).
> >
> > Thanks.
>
> Nobody will do your homework, but I will give you a small tip:
>
> Your array has members which are ordered.
> Each search iteration can be done in one cycle.
>
> If yes, then you don't need 64 comparators (why 64?).
> Instead, you will need just ....
> The rest of exercise goes to your assignment.
>
> Have you ever heard "binary search"?
>
> Utku.
-
Re: How best to implement search function in Verilog?
<utku.ozcan@gmail.com> wrote in message
news:1157581402.665566.124910@d34g2000cwd.googlegroups.com...
>
> Sorry I haven't read the sentence with "one cycle".
> One cycle search is technically an overkill.
>
> You must increase the number of clock cycles to pay less for silicon.
>
> Utku.
>
Yeah Utku.
If I am not wrong, binary search takes 5 stages of comparator right? I bet
that could well fit into
one clock cycle since my clock speed is a slow 20MHz, but maybe i will use 5
cycles anyhow.
-
Re: How best to implement search function in Verilog?
> Yeah Utku.
> If I am not wrong, binary search takes 5 stages of comparator right? I bet
> that could well fit into
> one clock cycle since my clock speed is a slow 20MHz, but maybe i will use 5
> cycles anyhow.
To find what you searching in one clock cycle, you have to compare
everything in one clock. That means you must access ALL the address in
the table. This is not a very good design practice I think, even though
you run the thing in 20 MHz.
Utku.
-
Re: How best to implement search function in Verilog?
Massive parallel comparison of data in single cycle is possible through
CAM design.
You could possible look at this option.
--josh
Mr. Ken wrote:
> An irregular array contains a[32] = {0, 3, 10, 17, 33, ..., 1000}, find the
> location my data is.
> For example, if data is between 0~3, result = 1, between 3~10, result = 2,
> etc.
>
> Do I write 64 comparators to find out the result (assuming single cycle
> operation).
>
> Thanks.
Similar Threads
-
By Application Development in forum verilog
Replies: 3
Last Post: 11-01-2007, 05:52 PM
-
By Application Development in forum verilog
Replies: 3
Last Post: 10-24-2007, 04:31 PM
-
By Application Development in forum Python
Replies: 5
Last Post: 10-23-2007, 05:45 AM
-
By Application Development in forum c++
Replies: 4
Last Post: 05-21-2007, 01:04 PM
-
By Application Development in forum PROLOG
Replies: 0
Last Post: 05-17-2005, 05:52 PM