El ejemplo hace parpadear los LEDs rojo y verde y alternativamente el LED azul
Archivo hello_world.vhdl
Código: Seleccionar todo
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity hello_world is
port (
clk : in std_logic;
led_green : out std_logic;
led_blue : out std_logic;
led_red : out std_logic
);
end hello_world;
architecture rtl of hello_world is
constant CLK_FREQ : integer := 20000000;
constant BLINK_FREQ : integer := 1;
constant CNT_MAX : integer := CLK_FREQ/BLINK_FREQ/2-1;
signal cnt : unsigned(24 downto 0);
signal blink : std_logic;
begin
process(clk)
begin
if rising_edge(clk) then
if cnt=CNT_MAX then
cnt <= (others => '0');
blink <= not blink;
else
cnt <= cnt + 1;
end if;
end if;
end process;
led_red <= NOT blink;
led_green <= NOT blink;
led_blue <= blink;
end rtl;
Código: Seleccionar todo
# 100MHZ Oscillator
#NET "osc_clk" LOC = U10 |IOSTANDARD = LVCMOS33;
#============================================================
# IDT ICS307 Clock Generator
#============================================================
#NET "idt_sclk" LOC = F2 |IOSTANDARD = LVCMOS33;
#NET "idt_strobe" LOC = G5 |IOSTANDARD = LVCMOS33;
#NET "idt_data" LOC = F1 |IOSTANDARD = LVCMOS33;
#NET "idt_iclk" LOC = J2 |IOSTANDARD = LVCMOS33;
NET "clk" LOC = J4 |IOSTANDARD = LVCMOS33;
#============================================================
# Button
#============================================================
#NET "button" LOC = R7 |IOSTANDARD = LVCMOS33;
#============================================================
# LEDs
#============================================================
NET "led_green" LOC = H1 |IOSTANDARD = LVCMOS33;
NET "led_blue" LOC = L1 |IOSTANDARD = LVCMOS33;
NET "led_red" LOC = L3 |IOSTANDARD = LVCMOS33; # Is this an input or an output, coming from the Micrel PHY?
Saludos