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

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > FPGA

FPGA comp.arch.fpga newsgroup (usenet)

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-25-2003, 03:15 PM
Newhand
Guest
 
Posts: n/a
Default How to get first bit '0' position in certain register?

Dear all,

For certain register, say stream = 16'b1111010011111111;
the position of first bit '0' is: 8 (from LSB);
if stream = 16'b1111000100010011, then the position is 2;

what I need is to get the position.

Since it should be done in one clock cycle, combination logic in
Verilog might be a better choice.

Could anybody give me some pieces of suggestion? Thanks in advance.

Newhand
Reply With Quote
  #2 (permalink)  
Old 12-25-2003, 03:58 PM
Robert Sefton
Guest
 
Posts: n/a
Default Re: How to get first bit '0' position in certain register?

This function is called "find first one" and is fairly common. You could
use a for loop or if-else construct in Verilog. Try Googling on "find
first one" - you may find something you can use.

Robert

"Newhand" <[email protected]> wrote in message
news:[email protected] om...
> Dear all,
>
> For certain register, say stream = 16'b1111010011111111;
> the position of first bit '0' is: 8 (from LSB);
> if stream = 16'b1111000100010011, then the position is 2;
>
> what I need is to get the position.
>
> Since it should be done in one clock cycle, combination logic in
> Verilog might be a better choice.
>
> Could anybody give me some pieces of suggestion? Thanks in advance.
>
> Newhand



Reply With Quote
  #3 (permalink)  
Old 12-25-2003, 06:59 PM
Hal Murray
Guest
 
Posts: n/a
Default Re: How to get first bit '0' position in certain register?

>This function is called "find first one" and is fairly common. You could
>use a for loop or if-else construct in Verilog. Try Googling on "find
>first one" - you may find something you can use.


Another term to search on is priority encoder.

--
The suespammers.org mail server is located in California. So are all my
other mailboxes. Please do not send unsolicited bulk e-mail or unsolicited
commercial e-mail to my suespammers.org address or any of my other addresses.
These are my opinions, not necessarily my employer's. I hate spam.

Reply With Quote
  #4 (permalink)  
Old 12-26-2003, 05:48 AM
Peter Alfke
Guest
 
Posts: n/a
Default Re: How to get first bit '0' position in certain register?

[email protected] (Hal Murray) wrote in message news:<[email protected]>...
> >This function is called "find first one" and is fairly common. You could
> >use a for loop or if-else construct in Verilog. Try Googling on "find
> >first one" - you may find something you can use.

>
> Another term to search on is priority encoder.

If you can restrict your search to the first 24 bits, and if you have
a Virtex-II BlockRAM available, you can feed the upper 12 bits as
address to one port, and the lower 12 bits as address to the other
port, and make the BlockRAM give you the 4-bit position information
within the 12 address bits. You then have to combine the two port
outputs. You can get the answer in one clock cycle (faster than all
the suggested software solutions) at well over 100 MHz,
ocnservatively.

Peter Alfke, Xilinx Applications (answering from home)
Merry Christmas to everybody on this newsgroup, and an interesting and
interactive 2004!
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
Trying to monitor output of a register instantiates another register seanadams Verilog 1 02-11-2004 06:13 PM
How to get first bit '0' position in certain register? Newhand FPGA 1 12-25-2003 11:45 PM


All times are GMT +1. The time now is 09:32 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