Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21338 Discussions

How is Weak-Low 'L' Synthesized?

Altera_Forum
Honored Contributor II
1,259 Views

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 

 

Thanks
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
552 Views

'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.
0 Kudos
Reply