使用 iCE40UP5K-SG48I (Upduino v3.1) 的内部 PLL 生成 110MHz 时钟,没有问题。
PLL 输出用于计数器,因此两个输出(pllLED 和 nSCN)被设置为 PLL 输出,直到计数器达到 Th1,并在计数器达到 Th2 时变为 LOW。 pllLED 转至 LED 用于计时/视觉目的,并通过示波器测量输出 nSCN。
主要有两个问题:
这是代码:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity blink is
port ( clk : in std_logic; pllout : inout std_logic; pllLED : inout std_logic; nSCN : inout std_logic );
end blink;
architecture rtl of blink is
signal count : integer range 0 to 2e9 := 0;
signal pll2 : std_logic;
signal fv : std_logic;
signal chng : integer range 0 to 20 := 1;
constant Th1 : integer := 110e3;
constant Th2 : integer := 199e3;
begin
pllX: entity mypll port map( ref_clk_i => clk, rst_n_i => '1', outcore_o => pllout, outglobal_o => open );
pll2 <= pllout;
process(count,pll2)
begin
if rising_edge(pll2) then
if count = Th1 then
chng <= 1;
fv <= pll2;
elsif count = Th2 then
fv <= '1';
count <= 0;
chng <= 1;
end if;
count <= count + 1;
end if;
if chng = 1 then
chng <= 0;
pllLED <= fv;
nSCN <= fv;
end if;
end process;
end architecture;
刚开始学习 VHDL,想知道为什么这不起作用。有更好的方法吗?