【发布时间】:2015-06-01 06:01:15
【问题描述】:
所以我有一个从 1->15 的模数计数器,然后在一个单独的实体中不断循环回来。我想在一个取决于某些输出的案例语句中,在时钟的上升沿采样这个值,但只做一次,否则这个值会不断变化。有没有办法做到这一点?分配信号并让它保持静止? 我已经发布了一些代码,希望能更好地展示我想说的内容。
process(all)
begin --sensitivity list?
if(reset) then
playerCards <= "0000000000000000";
dealerCards <= "0000000000000000";
elsif rising_edge(clock) then
case? deal & dealTo & dealToCardSlot is
when "1100" =>
playerCards(3 downto 0) <= singleCard;
playerCards(15 downto 4) <= (others => '0');
when "1101" =>
playerCards(7 downto 4) <= singleCard;
playerCards(15 downto 8) <= (others => '0');
when "1110" =>
playerCards(11 downto 8) <= singleCard;
playerCards(15 downto 12) <= (others => '0');
when "1111" =>
playerCards(15 downto 12) <= singleCard;
when "1000" =>
dealerCards(3 downto 0) <= singleCard; --dcard1
dealerCards( 15 downto 4) <= (others => '0');
when "1001" =>
dealerCards(7 downto 4) <= singleCard; --dcard2
dealerCards( 15 downto 8) <= (others => '0');
when "1010" =>
dealerCards(11 downto 8) <= singleCard; --dcard3
dealerCards( 15 downto 12) <= (others => '0');
when "1011" =>
dealerCards(15 downto 12) <= singleCard; --dcard4
when "0--0" => null; --do nothing when in win/end
when others => --this covers the start case --sets cards to 0
playerCards <= "0000000000000000";
dealerCards <= "0000000000000000";
end case?;
end if;
end process;
在这里,我将 singleCard 链接到我的计数器的输出,它会在每个时钟沿递增。所以基本上我希望我的案例陈述只发生一次更新 playerCards 的值,然后停止。 感谢您的帮助。
【问题讨论】: