EDA 实验报告山农大电子实验名称时钟分频?实验目的学****数控分频器的设计、分析和测试方法。?实验原理数控分频器的功能就是当在输入端给定不同输入数据时,将对输入的时钟信号有不同的分频比, 数控分频器就是用计数值可并行预置的加法计数器设计完成的,方法是将计数溢出位与预置数加载输入信号相接即可。?实验要求将 clock5 连接至 4096Hz , 编写分频逻辑, 将其分频至 1Hz , 2Hz , 8Hz , 16Hz , 编写四选一 MUX ,可用按键控制选择分频后的某时钟。扩展实验 3 中的计数器, 使其能计数 0-99 , 并编写顶层文件例化分频逻辑、选择器、计数器, 使计数器在不同的频率下计数。?实验步骤【1】分频逻辑: library ieee; use ; use ; entity dvf is port(clk:in std_logic; s: in std_logic_vector(1 downto 0); clkend:out std_logic); end; architecture one ofdvf is signal clk1_tmp:std_logic; signal clk2_tmp:std_logic; signal clk3_tmp:std_logic; signal clk4_tmp:std_logic; t2048:integer range 0 to2048; t1024:integer range 0 to1024; t512:integer range 0 to512; t256:integer range 0 to256; begin fen1: process(clk) begin if clk'event and clk='1' then t2048<2047 t2048<=cnt2048+1; else if en='1'then if cqi1<9 then cqi1<=cqi1+1; else cqi1<=(others=>'0'); if cqi2<9 then cqi2<=cqi2+1; else cqi2<=(others=>'0'); end if; end if; end if; end if; if cqi2=9 then cout<='1'; else cout<='0'; end if; cq1<=cqi1; cq2<=cqi2; end process; end behav; 【 3】顶层例化文件 library ieee; use ; entity t is port(clk:in std_logic; rst,en:in std_logic; s: in std_logic_vector(1 downto 0); cout:out std_logic; cq1:out std_logic_vector(3 downto 0); cq2:out std_logic_vector(3 downto 0)); end entity t; architecture behv of t ponent dvf port(clk:in std_log
时钟分频 来自淘豆网www.taodocs.com转载请标明出处.