Steward
分享是一種喜悅、更是一種幸福
微處理器 - Lattice LCMXO2-1200HC-4SG32C - VHDL - LED
top.vhd
library ieee;
use ieee.std_logic_1164.all;
entity main is
port(
clk : in std_logic;
led : out std_logic
);
end main;
architecture logic of main is
begin
process(clk) is
variable cnt : integer := 0;
variable val: std_logic;
begin
if (clk'event and clk = '1') then
cnt := cnt + 1;
if (cnt = 1000000) then
cnt := 0;
led <= val;
val := not val;
end if;
end if;
end process;
end logic;
top.lpf
LOCATE COMP "led" SITE "27"; LOCATE COMP "clk" SITE "28";
Makefile
all: yosys -m ghdl -p "ghdl top.vhd -e main; synth_lattice -family xo2 -json top.json" nextpnr-machxo2 --device LCMXO2-1200HC-4SG32C --lpf top.lpf --json top.json --textcfg top.txt ecppack --compress --jed-note "DESIGN NAME: top.ncd" --jed-note "DEVICE NAME: LCMXO2-1200HC-4QFN32" top.txt top.bit --jed top.jed clean: rm -rf top.txt top.bit top.json top.jed
編譯
$ make
插入開發板到PC後,會新增一個隨身碟,只要將top.jed複製到該隨身碟即可完成燒錄
