2017-11-02 9 views
-1

CPLD(つまりCoolRunner II Pro)を使用してVHDLにシフトレジスタ(値のスクロール表示用)を実装するにはどうすればよいですか?CPLD VHDL周波数メータ

最終製品が100間の周波数を測定することが可能なデジタル周波数計であることを意味する - 100kHzの

+0

あなたの製品開発をしたいのですか? – JHBonarius

+0

私はちょうど完全な説明とオンラインリソースを見つけることはありません – Aadi

+0

あなたの質問は非常に広すぎます。 [これはトピックに関する質問](https://stackoverflow.com/help/on-topic)を参照してください。また、[これは良い質問をする方法について](https://stackoverflow.com/help/how-to-ask)。 – JHBonarius

答えて

-1

私はそれがあなたの入力パルスの持続時間を測定するためにあなたが探しているものを想定しています。

同じことをするfrequency measurement vhdl code here with testbench and explanationがあります。以下のコードを参照してください。詳細については、リンクを参照してください。

library ieee; 
use ieee.std_logic_1164.all; 
use ieee.numeric_std.all; 
entity pulse_counter is 
port ( DAT_O : out unsigned(47 downto 0); 
     ERR_O : out std_logic; --This is '1' if the pulse freq is more than clk freq. 
     Pulse_I : in std_logic; 
     CLK_I : in std_logic 
    ); 
end pulse_counter; 
architecture Behavioral of pulse_counter is 
signal Curr_Count,Prev_Count : unsigned(47 downto 0):=(others => '0'); 

begin 

--Increment Curr_Count every clock cycle.This is the max freq which can be measured by the module. 
process(CLK_I) 
begin 
    if(rising_edge(CLK_I)) then 
     Curr_Count <= Curr_Count + 1; 
    end if; 
end process; 
--Calculate the time period of the pulse input using the current and previous counts. 
process(Pulse_I) 
begin 
    if(rising_edge(Pulse_I)) then 
    --These different conditions eliminate the count overflow problem 
    --which can happen once the module is run for a long time. 
     if(Prev_Count < Curr_Count) then 
      DAT_O <= Curr_Count - Prev_Count; 
      ERR_O <= '0'; 
     elsif(Prev_Count > Curr_Count) then 
     --X"F_F" is same as "1111_1111". 
     --'_' is added for readability. 
      DAT_O <= X"1_0000_0000_0000" - Prev_Count + Curr_Count;  
      ERR_O <= '0'; 
     else 
     DAT_O <= (others => '0'); 
      ERR_O <= '1'; --Error bit is inserted here. 
     end if;  
     Prev_Count <= Curr_Count; --Re-setting the Prev_Count. 
    end if; 
end process; 
end Behavioral;