【发布时间】:2014-05-06 21:39:22
【问题描述】:
我已经用 VHDL 语言为分频器编写了这段代码,但我不明白为什么我的频率在模拟时没有被分频。我做错了什么?
library IEEE;
use IEEE.std_logic_unsigned.all;
use IEEE.std_logic_1164.all;
entity div is
port(clk : in std_logic;
clk1, clkafisare, clkorg : out std_logic);
end entity;
architecture fct_div of div is
begin
process(clk)
variable c, e, g : integer := 0;
variable d, f, h : std_logic := '0';
begin
if rising_edge(clk) then
e := e+1; c := c+1; g := g+1;
if g = 12000000 and h = '0' then
h := '1'; g := 0;
elsif g = 12000000 and h = '1' then
h := '0'; g := 0;
end if;
if c = 25000000 and d = '0' then
d := '1'; c := 0;
elsif c = 25000000 and d = '1' then
d := '0'; c := 0;
end if;
if e = 100000 and f = '0' then
f := '1'; e := 0;
elsif e = 100000 and f = '1' then
f := '0'; e := 0;
end if;
end if;
clk1 <= d;
clkafisare <= f;
clkorg <= h;
end process;
end fct_div;
【问题讨论】:
-
你得到了什么,你的预期输出是什么?
标签: vhdl