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 ...

+ Reply to Thread
Results 1 to 6 of 6

How best to implement search function in Verilog?

  1. Default 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.




  2. Default 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.


  3. Default 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.



  4. Default 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.




  5. Default 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.


  6. Default 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.



+ Reply to Thread

Similar Threads

  1. How to implement VHDL 'transaction in verilog HDL?
    By Application Development in forum verilog
    Replies: 3
    Last Post: 11-01-2007, 05:52 PM
  2. Packet header implement in Verilog
    By Application Development in forum verilog
    Replies: 3
    Last Post: 10-24-2007, 04:31 PM
  3. How to implement function like this?
    By Application Development in forum Python
    Replies: 5
    Last Post: 10-23-2007, 05:45 AM
  4. Replies: 4
    Last Post: 05-21-2007, 01:04 PM
  5. Trying to implement MTD(f) search algorithm in Prolog...
    By Application Development in forum PROLOG
    Replies: 0
    Last Post: 05-17-2005, 05:52 PM