- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a state machine (VHDL) that should switch on an external input signal. My problem is that the input signal maybe not driven by any device, so it's value is 'Z'. How can I avoid that my state machine switches to an undefined/unintended state? It is possible to check for 'Z' values in a synthesizeable code? In RTL simulation that is not a problem but for gatelevel simulation and in the FPGA this problem could crash my design. Unfortunately, I can not change the circuit board to add a pull-up resistor to the design. Thanks for your help!Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good point.
set your input with weak pullup inside fpga io if availabel- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, I think (in theorie) this should work. Fortunately MAXII CPLDs have internal pullups.
I just tried it with the internal pull-up, but my gatelevel simulation still fails?! It is possible that this weak pull-up is not simulated? In the P&R report quartus tells me that the input pin has a weak pull-up.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not sure about Z simulation issue.
remember Z on your input is not a logic value but a case of high impedance which can go to logic 1 or zero by just touching... if input is not connected (not driven) then you can either think of it as unknown logic or being driven through air (high impedance). In similation: you define your inputs as 1 or 0 but you may try Z vector and see. Note: I have used weak pullup before in similar problem with state machine in Max II and it worked.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> It is possible to check for 'Z' values in a synthesizeable code?
No.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To simulate a weak pull up, you need to provide a 'H' level signal to your pin in the test bench. Then in the simulation, the signal will be 'H' when no other driver is driving the pin, and '0' or '1' when they are.
In your code, each time you read that signal, use the To_X01() function. As an example:my_signal <= To_X01(my_pin);
The function will read the value of the pin, and convert both '1' and 'H' to '1'. Then your code will have the same behaviour in the simulator and on the real chip with the pull-up. You don't need to remove the To_X01 when synthesizing, it will just be replaced by an identity function in the synthesizer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok, thanks! This solutions works :-)

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