Forum Discussion
Altera_Forum
Honored Contributor
15 years agoSo I can't upload the actual tdf file but this is what it looks like:
VARIABLE status[4..0] :NODE; --holds output state BEGIN IF en == 1 THEN IF num[] >= 4 THEN IF num[] <= 13 THEN status[] = b"10000"; ELSEIF num[] >= 15 THEN IF num[] <= 20 THEN status[] = b"01000"; ELSEIF num[] >= 18 THEN IF num[] <= 24 THEN status[] = b"00100"; ELSEIF num[] >= 26 THEN IF num[] <= 30 then status[] = b"00010"; ELSE status[] = b"00001"; END IF; ELSE status[] = b"00001"; END IF; ELSE status[] = b"00001"; END IF; (range1, range2, range3, range4, error) = status[]; --update output END; (each "if" statement tab indented from the line above though, didn't copy/paste well). No extra space, etc at the end of the last line, no extra line at the end. Thanks for that suggestion though. I did delete and rewrite the line (as well as the whole thing) because I thought the same maybe. -And no idea if the code above is valid or not - I wrote it 3 different ways (if/then, nested if, and case). And got the same error about the end statement every time, which just makes me more confused.:confused: Code is supposed to be a range detector - detect a range of input when "EN" input is high - ranges given do overlap & have gaps (ie-numbers above are correct). Has to use boolean expressions and >= and <= statements. Thanks again.