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.

Max & min of input signal

Status
Not open for further replies.

shhrikant1

Member level 2
Joined
Apr 21, 2010
Messages
47
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Edison NJ
Activity points
1,572
Hello All,

I am trying to find the maximum & minimum value of an input signal (periodic) in VHDL.

I am little confused while trying to get the max & min when signed numbers are involved.

Can any one help?
 

what are you confused about? are you using the numeric_std library, that has the signed/unsigned types in it?

Code:
if input < min then
  min <= input;
end if;

if input > max then
  max <= input;
end if;
 

HI,
Thanks for your reply, I dont know the minimum & value which the input signal could attain.
for eg. ecg signal , I need to find the maximum peak of the signal & minimum it attain , as per the person's heartbeat, where I can not guess the maximum & minimum value of the signal, specially with signed input the logic fails coz more the negetive number(magnitude ) smaller it is.
 

I still dont understand your problem. Im guessing you are trying to do some normalisation? You cannot do that with current data, you have to use historic data, and then clip anything that over or underflows, unless you have some kind of large buffer to store the data before normalisation?

If you used the signed/unsigned types in the numeric std library, then the function:

if input < min then

will work with negative numbers.
 

shhrikant,
this is the same as the C program. you can initialize the value for "max" to the most negative value. eg, x8000 for a 16b value. "min" is initialized to the most positive number. eg. x7FFF for 16b.

the first sample will naturally be less than or equal to the min, updating it. it will also be greater than or equal to the max, updating it.

these give the statistical min/max.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top