iCE40 输出不在 PLL 输出和低电平之间切换

问题描述 投票:0回答:0

使用 iCE40UP5K-SG48I (Upduino v3.1) 的内部 PLL 生成 110MHz 时钟,没有问题。

PLL 输出用于计数器,因此两个输出(pllLED 和 nSCN)被设置为 PLL 输出,直到计数器达到 Th1,并在计数器达到 Th2 时变为 LOW。 pllLED 转至 LED 用于计时/视觉目的,并通过示波器测量输出 nSCN。

主要有两个问题:

  1. 对于下面代码中的阈值 Th1 和 Th2,当输出应该是 PLL 的输出时,输出 nSCN 为高电平
  2. 当将阈值 Th1 和 Th2 分别降低到 100 和 200 或更低时(这就是我正在寻找的),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,想知道为什么这不起作用。有更好的方法吗?

vhdl ice40
© www.soinside.com 2019 - 2024. All rights reserved.