- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
I have a statement like this: if input = 'L' then output <= '0'; else output <= '1'; end if; How does 'L' synthesize? What voltage level does the device look for and how is this different from '0' ? I'm using a MAXII CPLD ThanksLink Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
'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.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page