blob: 7eb52f65f86cb449c9d1351675d3c0b42d046f7c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity top is
Port (
hwclk : in STD_LOGIC;
mosi : in STD_LOGIC;
led1 : out STD_LOGIC;
led2 : out STD_LOGIC;
led3 : out STD_LOGIC;
led4 : out STD_LOGIC;
led5 : out STD_LOGIC;
led6 : out STD_LOGIC;
led7 : out STD_LOGIC;
led8 : out STD_LOGIC;
outnext : out STD_LOGIC
);
end top;
architecture Behavioral of top is
signal shift_reg : STD_LOGIC_VECTOR(7 downto 0);
begin
led1 <= shift_reg(0);
led2 <= shift_reg(1);
led3 <= shift_reg(2);
led4 <= shift_reg(3);
led5 <= shift_reg(4);
led6 <= shift_reg(5);
led7 <= shift_reg(6);
led8 <= shift_reg(7);
outclk <= hwclk;
process (hwclk)
begin
if (rising_edge(hwclk)) then
shift_reg(7 downto 0) <= shift_reg(6 downto 0) & mosi;
end if;
end process;
a:process (hwclk)
begin
if (falling_edge(hwclk)) then
outnext <= shift_reg(7);
end if;
end process;
end Behavioral;
|