NEXYS4 DDR Led Bar

Bu uygulamada 16 adet led ve 2 switch kullanılıp led bar uygulaması yapılmıştır. sw0 sistemi enable etmek için,sw15 ise ledleri sağa doğru shift etmek için kullanılmıstır.

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
 
entity LedBar is
   generic(
      clk_freq  : integer := 100000000; -- 100mhz clock
      bekleme_sn : integer := 1 -- bekleme süresi çarpanı
   );
   port(
      in_clk  : in  std_logic; 
      en_i   : in  std_logic; 
      right_shit  : in  std_logic; 
      LED : out std_logic_vector(15 downto 0)
   );
end LedBar;
 
architecture Behavioral of LedBar is
 
    constant bekleme : integer := (bekleme_sn * clk_freq );
    signal clk_sayac : integer := 0;
    signal clk_div : std_logic;
    signal register_led : std_logic_vector(15 downto 0) := (others => '0');
 
begin
 
   SHFT: process(in_clk)
   begin
      if rising_edge(in_clk) then
         if en_i = '1' then
            if clk_div = '1' then
               if right_shit = '0' then
                  register_led <= register_led(14 downto 0) & '1';
               else 
                  register_led <= '1' & register_led(15 downto 1);
               end if;
            end if;
         else
            register_led <= (others => '0');
         end if;
      end if;
   end process SHFT;
 
   LED <= register_led;
 
   CLK_CNT: process(in_clk)
   begin
      if rising_edge(in_clk) then
         if en_i = '0' or clk_sayac = bekleme then
            clk_sayac <= 0;
            clk_div <= '1';
         else
            clk_sayac <= clk_sayac + 1;
            clk_div <= '0';
         end if;
      end if;
   end process CLK_CNT;
 
end Behavioral;

 

var quads_screen_width = document.body.clientWidth;
if ( quads_screen_width >= 1140 ) {
/* desktop monitors */
document.write('');
(adsbygoogle = window.adsbygoogle || []).push({});
}if ( quads_screen_width >= 1024  && quads_screen_width < 1140 ) {
/* tablet landscape */
document.write('');
(adsbygoogle = window.adsbygoogle || []).push({});
}if ( quads_screen_width >= 768  && quads_screen_width < 1024 ) {
/* tablet portrait */
document.write('');
(adsbygoogle = window.adsbygoogle || []).push({});
}if ( quads_screen_width < 768 ) {
/* phone */
document.write('');
(adsbygoogle = window.adsbygoogle || []).push({});
}
 
 
 
 
 
 
## Clock signal
set_property -dict { PACKAGE_PIN E3    IOSTANDARD LVCMOS33 } [get_ports { in_clk }]; #IO_L12P_T1_MRCC_35 Sch=clk100mhz
create_clock -add -name sys_clk_pin -period 10.00 -waveform {0 5} [get_ports {in_clk}];
 
## LEDs
set_property -dict { PACKAGE_PIN H17   IOSTANDARD LVCMOS33 } [get_ports { LED[0] }]; #IO_L18P_T2_A24_15 Sch=led[0]
set_property -dict { PACKAGE_PIN K15   IOSTANDARD LVCMOS33 } [get_ports { LED[1] }]; #IO_L24P_T3_RS1_15 Sch=led[1]
set_property -dict { PACKAGE_PIN J13   IOSTANDARD LVCMOS33 } [get_ports { LED[2] }]; #IO_L17N_T2_A25_15 Sch=led[2]
set_property -dict { PACKAGE_PIN N14   IOSTANDARD LVCMOS33 } [get_ports { LED[3] }]; #IO_L8P_T1_D11_14 Sch=led[3]
set_property -dict { PACKAGE_PIN R18   IOSTANDARD LVCMOS33 } [get_ports { LED[4] }]; #IO_L7P_T1_D09_14 Sch=led[4]
set_property -dict { PACKAGE_PIN V17   IOSTANDARD LVCMOS33 } [get_ports { LED[5] }]; #IO_L18N_T2_A11_D27_14 Sch=led[5]
set_property -dict { PACKAGE_PIN U17   IOSTANDARD LVCMOS33 } [get_ports { LED[6] }]; #IO_L17P_T2_A14_D30_14 Sch=led[6]
set_property -dict { PACKAGE_PIN U16   IOSTANDARD LVCMOS33 } [get_ports { LED[7] }]; #IO_L18P_T2_A12_D28_14 Sch=led[7]
set_property -dict { PACKAGE_PIN V16   IOSTANDARD LVCMOS33 } [get_ports { LED[8] }]; #IO_L16N_T2_A15_D31_14 Sch=led[8]
set_property -dict { PACKAGE_PIN T15   IOSTANDARD LVCMOS33 } [get_ports { LED[9] }]; #IO_L14N_T2_SRCC_14 Sch=led[9]
set_property -dict { PACKAGE_PIN U14   IOSTANDARD LVCMOS33 } [get_ports { LED[10] }]; #IO_L22P_T3_A05_D21_14 Sch=led[10]
set_property -dict { PACKAGE_PIN T16   IOSTANDARD LVCMOS33 } [get_ports { LED[11] }]; #IO_L15N_T2_DQS_DOUT_CSO_B_14 Sch=led[11]
set_property -dict { PACKAGE_PIN V15   IOSTANDARD LVCMOS33 } [get_ports { LED[12] }]; #IO_L16P_T2_CSI_B_14 Sch=led[12]
set_property -dict { PACKAGE_PIN V14   IOSTANDARD LVCMOS33 } [get_ports { LED[13] }]; #IO_L22N_T3_A04_D20_14 Sch=led[13]
set_property -dict { PACKAGE_PIN V12   IOSTANDARD LVCMOS33 } [get_ports { LED[14] }]; #IO_L20N_T3_A07_D23_14 Sch=led[14]
set_property -dict { PACKAGE_PIN V11   IOSTANDARD LVCMOS33 } [get_ports { LED[15] }]; #IO_L21N_T3_DQS_A06_D22_14 Sch=led[15]
 
##Switches
set_property -dict { PACKAGE_PIN J15   IOSTANDARD LVCMOS33 } [get_ports { en_i }]; #IO_L24N_T3_RS0_15 Sch=sw[0]
set_property -dict { PACKAGE_PIN V10   IOSTANDARD LVCMOS33 } [get_ports { right_shit}]; #IO_L21P_T3_DQS_14 Sch=sw[15]

 

Bir Cevap Yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir