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.

finding the minimum amongst the array

Status
Not open for further replies.

valientpathan

Newbie level 5
Joined
Apr 18, 2010
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
sundsvall
Activity points
1,331
hi..
can any one tell me how can i find the smallest among the following array
[2 3 4 5 1] ?? i am in need if any 1 can help me out :)....!!
 

yeah i know the answer is one but i want code for that...like how can i write in VHDL ??
 

Visually or in some language? Which language?
 

Is array constant or dynamic?
If it's constant - there might be a way to find min at translate time. If not - you've got to use usual way, that is a counter for index and a comparator. And it will be O(N).
 

Are you trying to do a vhdl function. On O(n) recursive algo array_min(array[m..n]) = min(array[m],array_min[m+1,n]) would work as a vhdl function. You could do something similar in RTL if you wanted to shift through an array for N clock cycles and keep the min. Or for a fixed-length array you could call the recursive function and get parallel logic in one clock cycle (though the combinatorial logic chain would get huge fast.)
 
Or for a fixed-length array you could call the recursive function and get parallel logic in one clock cycle
Oh, I didn't think about that, nice idea! Do you mean to use for statement?
 

Depending on your max clock speed, the set you can search will be limited before you get too much logic.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top