blob: 68e88d8a81ddaafee04e83a533bde0077144f022 (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 15:04:05 06/28/2010
-- Design Name:
-- Module Name: sr_cpld - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
entity sr_cpld is
generic (
port_count_in : positive := 8;
port_count_out : positive := 8
);
Port (
sdi : in std_logic;
sdo : out std_logic;
clk : in std_logic;
cs_n : in std_logic; -- edge sensitive chip select
port_in : in std_ulogic_vector( port_count_in -1 downto 0);
port_out : out std_ulogic_vector( port_count_out-1 downto 0)
);
end entity sr_cpld;
architecture rtl of sr_cpld is
constant port_count : positive := port_count_in + port_count_out;
signal sr : std_ulogic_vector(port_count-1 downto 0);
begin
shift_p: process
begin
wait until rising_edge(clk);
sr <= sdi & sr(port_count-1 downto 1);
sdo <= sr(0);
end process;
out_p: process
begin
wait until rising_edge( cs_n);
port_out <= sr(sr'high downto sr'high-port_count_out+1);
end process;
-- in_p: process
-- begin
-- wait until falling_edge( cs_n);
-- sr(port_count_in-1 downto 0) <= port_in;
-- end process;
end architecture rtl;
|