source: firmware/FTU/test_firmware/FTU_test5/FTU_test5_spi_interface.vhd@ 13259

Last change on this file since 13259 was 268, checked in by qweitzel, 14 years ago
FTU_test5 added
File size: 4.5 KB
Line 
1----------------------------------------------------------------------------------
2-- Company: ETH Zurich, Institute for Particle Physics
3-- Engineer: P. Vogler, Q. Weitzel
4--
5-- Create Date: 07/14/2010
6-- Design Name:
7-- Module Name: FTU_test5_spi_interface - Behavioral
8-- Project Name:
9-- Target Devices:
10-- Tool versions:
11-- Description: Based on VHDL Entity FACT_FAD_lib.spi_interface.symbol
12--
13-- Dependencies:
14--
15-- Revision:
16-- Revision 0.01 - File Created
17-- Additional Comments:
18--
19----------------------------------------------------------------------------------
20library IEEE;
21use IEEE.STD_LOGIC_1164.ALL;
22use IEEE.STD_LOGIC_ARITH.ALL;
23use IEEE.STD_LOGIC_UNSIGNED.ALL;
24library ftu_definitions_test5;
25USE ftu_definitions_test5.ftu_array_types.all;
26
27---- Uncomment the following library declaration if instantiating
28---- any Xilinx primitives in this code.
29--library UNISIM;
30--use UNISIM.VComponents.all;
31
32ENTITY FTU_test5_spi_interface IS
33 PORT(
34 clk_50MHz : IN std_logic;
35 config_start : IN std_logic;
36 dac_array : IN dac_array_type;
37 config_ready : OUT std_logic;
38 config_started : OUT std_logic := '0';
39 dac_cs : OUT std_logic;
40 mosi : OUT std_logic := '0';
41 sclk : OUT std_logic;
42 miso : INOUT std_logic
43 );
44END FTU_test5_spi_interface;
45
46ARCHITECTURE struct OF FTU_test5_spi_interface IS
47
48 -- Internal signal declarations
49 SIGNAL dac_config_ready : std_logic;
50 SIGNAL dac_config_start : std_logic;
51 SIGNAL dac_id : std_logic_vector(2 DOWNTO 0);
52 SIGNAL data : std_logic_vector(15 DOWNTO 0);
53
54 -- Implicit buffer signal declarations
55 SIGNAL sclk_internal : std_logic;
56
57
58 -- Component Declarations
59 COMPONENT FTU_test5_spi_clock_generator
60 GENERIC (
61 CLK_DIVIDER : integer := 25 --2 MHz @ 50 MHz
62 );
63 PORT (
64 clk : IN std_logic;
65 sclk : OUT std_logic := '0'
66 );
67 END COMPONENT;
68
69 COMPONENT FTU_test5_spi_controller
70 PORT (
71 clk : IN std_logic;
72 dac_id : IN std_logic_vector (2 DOWNTO 0);
73 dac_start : IN std_logic;
74 dac_cs : OUT std_logic := '1';
75 dac_ready : OUT std_logic := '0';
76 mosi : OUT std_logic := '0';
77 --data : INOUT std_logic_vector (15 DOWNTO 0) := (others => 'Z');
78 data : IN std_logic_vector (15 DOWNTO 0) := (others => '0');
79 miso : INOUT std_logic := 'Z'
80 );
81 END COMPONENT;
82
83 COMPONENT FTU_test5_spi_distributor
84 PORT (
85 clk : IN std_logic;
86 config_start : IN std_logic;
87 dac_array : IN dac_array_type;
88 dac_config_ready : IN std_logic;
89 config_ready : OUT std_logic := '0';
90 config_started : OUT std_logic := '0';
91 dac_config_start : OUT std_logic := '0';
92 dac_id : OUT std_logic_vector (2 DOWNTO 0) := (others => '0');
93 --data : INOUT std_logic_vector (15 DOWNTO 0) := (others => 'Z')
94 data : OUT std_logic_vector (15 DOWNTO 0) := (others => '0')
95 );
96 END COMPONENT;
97
98BEGIN
99
100 -- Instance port mappings.
101 Inst_FTU_test5_spi_clock_generator : FTU_test5_spi_clock_generator
102 GENERIC MAP (
103 CLK_DIVIDER => 25 --2 MHz @ 50 MHz
104 )
105 PORT MAP (
106 clk => clk_50MHz,
107 sclk => sclk_internal
108 );
109
110 Inst_FTU_test5_spi_controller : FTU_test5_spi_controller
111 PORT MAP (
112 clk => sclk_internal,
113 miso => miso,
114 mosi => mosi,
115 dac_id => dac_id,
116 data => data,
117 dac_cs => dac_cs,
118 dac_start => dac_config_start,
119 dac_ready => dac_config_ready
120 );
121
122 Inst_FTU_test5_spi_distributor : FTU_test5_spi_distributor
123 PORT MAP (
124 clk => sclk_internal,
125 config_start => config_start,
126 config_ready => config_ready,
127 config_started => config_started,
128 dac_array => dac_array,
129 dac_config_start => dac_config_start,
130 dac_config_ready => dac_config_ready,
131 dac_id => dac_id,
132 data => data
133 );
134
135 -- Implicit buffered output assignments
136 sclk <= sclk_internal;
137
138END struct;
Note: See TracBrowser for help on using the repository browser.