Lattice Fpga内部时钟

时间:2018-05-19 14:05:38

标签: vhdl fpga lattice

我正在尝试配置晶格MachX03的内部振荡器。我阅读了MachXO3 sysCLOCK PLL设计和使用指南*并尝试使用文档第31页上的vhdl代码,但我在COMPONENT附近遇到此错误(VHDL-1261)语法错误。有人能告诉我如何使用VHDL让时钟工作吗?这是我正在尝试使用的代码:

LIBRARY lattice;

library machXO3;
use machXO3.all;

COMPONENT OSCH
   GENERIC(
         NOM_FREQ: string := "53.20"); --53.20MHz, or can select other supported frequencies
   PORT(
         STDBY    : IN  STD_LOGIC;     --'0' OSC output is active, '1' OSC output off
         OSC      : OUT STD_LOGIC;     --the oscillator output
         SEDSTDBY : OUT STD_LOGIC);    --required only for simulation when using standby
END COMPONENT;


OSCInst0: OSCH
   GENERIC MAP (NOM_FREQ  => "53.20")
   PORT MAP (STDBY => '0', OSC => clk, SEDSTDBY => OPEN);

以下是手册中的代码:

library machXO3;
use machXO3.all;

COMPONENT OSCH
-- synthesis translate_off
  GENERIC (NOM_FREQ: string := "2.56");
-- synthesis translate_on
  PORT (STDBY:INstd_logic;
          OSC:OUTstd_logic;
     SEDSTDBY:OUTstd_logic);
END COMPONENT;

  attribute NOM_FREQ : string;
  attribute NOM_FREQ of OSCinst0 : label is "2.56";

begin
OSCInst0: OSCH
-- synthesis translate_off
  GENERIC MAP( NOM_FREQ => "2.56" )
-- synthesis translate_on
  PORT MAP (STDBY=> stdby,
  OSC => osc_int,
  SEDSTDBY => stdby_sed
);

* http://www.latticesemi.com/view_document?document_id=50124

1 个答案:

答案 0 :(得分:2)

要使用内部Osc,基本上使用上面提到的菜单中的代码。为了获得简单的osc工作,请在vhdl中编写以下内容。该代码设置了2.56 Mhz时钟,这是内部时钟生成的最慢时钟。内部发生器可以输出的最高频率是133 Mhz,请参阅文档http://www.latticesemi.com/view_document?document_id=50124的第30-20页

library  ieee;
use  ieee.std_logic_1164.all;

-- For Main Clock --
library machXO3l;
use machXO3l.all;
--------------------

entity Clock is
     port (stdby : in std_logic;
           osc_int: out std_logic
           );
end Clock;

architecture Clock_behav of Clock is

    COMPONENT OSCH
    -- synthesis translate_off
        GENERIC (NOM_FREQ: string := "2.56");
    -- synthesis translate_on
        PORT (STDBY : IN std_logic;
              OSC : OUT std_logic
                );
    END COMPONENT;
attribute NOM_FREQ : string;
attribute NOM_FREQ of OSCinst0 : label is "2.56";

begin

    Clock: OSCH
    -- synthesis translate_off
    GENERIC MAP( NOM_FREQ => "2.56" )
    -- synthesis translate_on
    PORT MAP (  STDBY => stdby,
                OSC => osc_int
    );

end Clock_behav;