- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hello,
I have to divide a clock input signal by 2048. I was wondering which method was the best to implement this divider in a FPGA. I know that we can use either a counter or just some flip-flops along with some logic. Do you know what are the pros and cons of each method? I attached my source code. My design includes 9 flip-flops that produce a signal used to invert my output signal (my output clock). Thank you for your help. Best regards, Damienコピーされたリンク
5 返答(返信)
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
well I certainly wouldnt do it like that.
The best way is to create a clock enable rather than an actual clock (so you clock the slow thing at the system clock rate, and only enable it once every 2048 clocks). Creating clocks from logic can create timing issues.- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
What's the reason of manually synthesizing a counter, like you did? The logic synthesizer is supposed to do that boring job.
In VHDL you can simply increment a 11bit count register and take the MSB. For example:
entity divider is
port (CLKIN : in std_logic;
RESET : in std_logic;
CLKOUT : out std_logic );
end entity divider;
architecture divider_2048 of divider is
signal cnt : unsigned(10 downto 0);
begin
process(RESET, CLK)
begin
if RESET = '1' then
cnt <= (others => '0');
elsif rising_edge(CLK) then
cnt <= cnt + 1;
end if;
end process;
Q <= cnt(10);
end architecture divider_2048;
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
--- Quote Start --- What's the reason of manually synthesizing a counter, like you did? The logic synthesizer is supposed to do that boring job. --- Quote End --- School assignment most likely. :D
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Thank you very much,
Only one small process to do the job, wonderful!- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
There are some errors in that code (inconsistent port names). Here is a corrected version:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.all;
USE IEEE.STD_LOGIC_ARITH.all;
USE IEEE.STD_LOGIC_UNSIGNED.all;
entity divider is
port (CLKIN : in std_logic;
RESET : in std_logic;
CLKOUT : out std_logic );
end entity divider;
architecture divider_2048 of divider is
signal cnt : unsigned(10 downto 0);
begin
process(RESET, CLKIN)
begin
if RESET = '1' then
cnt <= (others => '0');
elsif rising_edge(CLKIN) then
cnt <= cnt + 1;
end if;
end process;
CLKOUT <= cnt(10);
end architecture divider_2048;
