D
David Perry
Guest
I have a simple if statment:
If Ctrl_uf > to_ufixed(0, 15, 0) then
Ctrl_uf is:
Signal Ctrl_uf : ufixed(15 downto 0) := x"8000";
it is never 0 for the purposes of trying to get this to work.
The code after the if statement is never enabled, if I comment out the if/end if then the code gets used.
For completeness here's a bit more code:
if Ctrl_Up = HI then
if Ctrl_uf < to_ufixed(65535, 15, 0) then
CtrlCalc_uf := Ctrl_uf + to_ufixed(1, 15, 0);
Ctrl_uf <= CtrlCalc_uf(15 downto 0);
end if;
else
if Ctrl_Dn = HI then
if Ctrl_uf > to_ufixed(0, 15, 0) then
CtrlCalc_uf := Ctrl_uf - to_ufixed(1, 15, 0);
Ctrl_uf <= CtrlCalc_uf(15 downto 0);
end if;
end if;
end if;
essentially, Ctrl_Up increments the value of Ctrl_uf correctly, but Ctrl_Dn doesn't and the signal is definitely there, if I comment out the problem 'if' statement, it works but without the end-stop protection.
Any ideas?
If Ctrl_uf > to_ufixed(0, 15, 0) then
Ctrl_uf is:
Signal Ctrl_uf : ufixed(15 downto 0) := x"8000";
it is never 0 for the purposes of trying to get this to work.
The code after the if statement is never enabled, if I comment out the if/end if then the code gets used.
For completeness here's a bit more code:
if Ctrl_Up = HI then
if Ctrl_uf < to_ufixed(65535, 15, 0) then
CtrlCalc_uf := Ctrl_uf + to_ufixed(1, 15, 0);
Ctrl_uf <= CtrlCalc_uf(15 downto 0);
end if;
else
if Ctrl_Dn = HI then
if Ctrl_uf > to_ufixed(0, 15, 0) then
CtrlCalc_uf := Ctrl_uf - to_ufixed(1, 15, 0);
Ctrl_uf <= CtrlCalc_uf(15 downto 0);
end if;
end if;
end if;
essentially, Ctrl_Up increments the value of Ctrl_uf correctly, but Ctrl_Dn doesn't and the signal is definitely there, if I comment out the problem 'if' statement, it works but without the end-stop protection.
Any ideas?