Hallo,
ich bin blutiger Anfänger was VHDL und FPGA angeht. Nachdem ich jetzt
den Code für ein einfaches Lauflicht habe, würde ich gerne die
Geschwindigkeit beeinflussen. Ich hab jedoch keine Ahnung, wie ich das
anstellen soll.
Hab schon irgendwas mit Binärzähler gelesen. Nur keine Ahnung, wie ich
das in den Code implementieren soll. Kann mir jemand helfen?
Das normale Lauflicht hab ich mit untenstehenden Code realisiert.
Schon mal Danke.
1 | library IEEE;
|
2 | use IEEE.STD_LOGIC_1164.ALL;
|
3 | use IEEE.STD_LOGIC_ARITH.ALL;
|
4 | use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
5 |
|
6 | -- Uncomment the following lines to use the declarations that are
|
7 | -- provided for instantiating Xilinx primitive components.
|
8 | --library UNISIM;
|
9 | --use UNISIM.VComponents.all;
|
10 |
|
11 | entity lauflicht is
|
12 | Port ( clk50 : in std_logic;
|
13 | reset : in std_logic;
|
14 | led_out : out std_logic_vector(7 downto 0));
|
15 | end lauflicht;
|
16 |
|
17 | architecture Behavioral of lauflicht is
|
18 |
|
19 | signal cnt: std_logic_vector(24 downto 0);
|
20 | signal shift_enable:std_logic;
|
21 | signal led: std_logic_vector(7 downto 0);
|
22 |
|
23 |
|
24 | begin
|
25 |
|
26 | counter: process(reset,clk50)
|
27 | begin
|
28 | if reset='1' then
|
29 | shift_enable<='0';
|
30 | cnt<=(others=>'1');
|
31 | elsif rising_edge(clk50) then
|
32 | if cnt=0 then
|
33 | cnt<=(others=>'1');
|
34 | shift_enable<='1';
|
35 | else
|
36 | cnt<=cnt-1;
|
37 | shift_enable<='0';
|
38 | end if;
|
39 | end if;
|
40 | end process;
|
41 |
|
42 | shift: process(clk50,reset)
|
43 | begin
|
44 | if reset='1' then
|
45 | led<="00000001";
|
46 | elsif rising_edge(clk50) then
|
47 | if shift_enable='1' then
|
48 | led<=led(6 downto 0) & led(7);
|
49 | -- if led(7)='1' then
|
50 | -- led<="00000001";
|
51 | -- end if;
|
52 | end if;
|
53 | end if;
|
54 | end process;
|
55 |
|
56 | led_out<=led;
|
57 |
|
58 |
|
59 | end Behavioral;
|