Forum Discussion
Altera_Forum
Honored Contributor
15 years ago'Weak law' doesn't mean a different voltage level, but is used in simulation to represent an undrived pin with a low pull-up.
If you have multiple drivers on a pin, and one of them drives it to the 'L' state, the actual state of the pin:Driver 1|Driver 2|Pin value
L | U | U
L | X | X
L | 0 | 0
L | 1 | 1
L | Z | L
L | W | W
L | L | L
L | H | W
In the case of the code sample that you shown, the synthesized output will be always '1'. On the synthesized target, input will always be '0' or '1', so the condition (input = 'L') will always be false. 'L' and 'H' are used in test benches to simulate external pull-ups/pull-downs, but should never end up in synthesized code. If you want something that works both in a simulation with a weak pull-up and in synthesized code, you should replace those lines with: if To_X01(input) = '0' then
output <= '0';
else
output <= '1';
end if;The To_X01() function remaps the weak values to actual 0 and 1's, and both the simulator and synthesizer are happy.