Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

generic priority encoder

Status
Not open for further replies.

srimatresri

Junior Member level 2
Joined
Mar 19, 2009
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,424
i have a generic input signal say a(generic-1 down to 0). and i have generic input values, say i(generic-1 down to 0).
what i need is
output = a(0) and i(0)+ not a(0) and a(1) and i(1)+ not a(0) and not a(1) and a(2) and i(2) + and so on up to generic-1.
 

there are two methods:
1.) use a process with a for loop. modern synthesis tools will pick this up as a priority encoder with the last matching condition being the chosen condition. this is typically the most readable and the better option. recall that multiple assignments (blocking or non-blocking) will favor the last assignment. The for loop can easily be set to iterate in the same direction or opposite direction as the vector.
2.) use an arithmetic operation with logic like -x and x. (you may need to bit-reverse the vector based on which direction you want the inductive property to work). This method is not as readable, but infers an adder. This makes the operation itself very fast, but also makes the implementation very localized. When the conditions themselves come from other logic, this will result in a placement bottleneck and a potentially slower design due to the hidden and hard to control routing cost.

for #2:
if x = 0010100
-x = 1101100
-x and x = 0000100
the priority is given to the rightmost bit.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top