拉低一个引脚输出同时设置为Z态VHDL
Pull down a pin output at the same time set as Z state VHDL
当我将引脚设置为 'Z' 状态时,它会保持之前的状态。
例如:
if rising_edge(Clock) then
counter <= counter + 1;
case counter is
when 0 =>
PIN <= '0';
when 1 =>
PIN <= 'Z';
others =>
end case;
end process;
如果我执行此代码,我将在 'Z' 状态下将 PIN 设置为“0”。
if rising_edge(Clock) then
counter <= counter + 1;
case counter is
when 0 =>
PIN <= '1';
when 1 =>
PIN <= 'Z';
others =>
end case;
end process;
如果我执行此代码,我将在 Z 状态下将 PIN 设置为“1”。
我需要的是在 Z 状态下将 PIN 设置为“0”,而不管之前的状态如何。但我需要在不使用额外的时钟周期将 PIN 从“1”设置为“0”然后设置为 'Z' 的情况下完成此操作。这可能吗?
如果您需要将 FPGA 引脚设置为三态,但也需要下拉,则必须在工具链的引脚配置工具中设置下拉。我不知道有任何 FPGA 工具链会从分配推断下拉到 'L'
,这似乎是你想要的(带下拉的三态似乎等同于 'weak low')。如果你只是运行模拟,试试设置PIN <= 'L'
.
当我将引脚设置为 'Z' 状态时,它会保持之前的状态。
例如:
if rising_edge(Clock) then
counter <= counter + 1;
case counter is
when 0 =>
PIN <= '0';
when 1 =>
PIN <= 'Z';
others =>
end case;
end process;
如果我执行此代码,我将在 'Z' 状态下将 PIN 设置为“0”。
if rising_edge(Clock) then
counter <= counter + 1;
case counter is
when 0 =>
PIN <= '1';
when 1 =>
PIN <= 'Z';
others =>
end case;
end process;
如果我执行此代码,我将在 Z 状态下将 PIN 设置为“1”。
我需要的是在 Z 状态下将 PIN 设置为“0”,而不管之前的状态如何。但我需要在不使用额外的时钟周期将 PIN 从“1”设置为“0”然后设置为 'Z' 的情况下完成此操作。这可能吗?
如果您需要将 FPGA 引脚设置为三态,但也需要下拉,则必须在工具链的引脚配置工具中设置下拉。我不知道有任何 FPGA 工具链会从分配推断下拉到 'L'
,这似乎是你想要的(带下拉的三态似乎等同于 'weak low')。如果你只是运行模拟,试试设置PIN <= 'L'
.