EcEng
EcEng

Reputation: 23

vhdl checking a range with if statements

I am quiet new to VHDL, so i am having trouble with this issue.

A section of my program is to measure the time it takes for a capacitor to charge, and then see which range the charge time falls under. What i want to see is if count falls under the range H43044 - H 43238 or H8c424 - H8c618

if ((count >= x"43044") and (count <= x"43238"))then
    d3 <= '1'; --enable output
elsif ((count >= x"8c424") and (count <= x"8c618"))  then
    d4 <= '1';
end if;

i made sure the count falls under one of these statement, but i get no output at all. I wonder if this is the right way to approach this problem.

Upvotes: 1

Views: 3939

Answers (1)

EcEng
EcEng

Reputation: 23

Just to close this question, turns out i was using wrong clock in my test bench, i presumed my error was in the way i presented the logic in above segment, because all other code worked just fine. now i know that is the correct method to check range. thanks every one.

Upvotes: 1

Related Questions