source: firmware/FAD/FACT_FAD_lib/hdl/spi_interface_struct.vhd@ 14342

Last change on this file since 14342 was 11755, checked in by neise, 13 years ago
reinit of this svn repos .... it was all too messy deleted the old folders and restarted with FACT_FAD_lib only. (well and the testbenches)
File size: 7.6 KB
Line 
1-- VHDL Entity FACT_FAD_lib.spi_interface.symbol
2--
3-- Created:
4-- by - daqct3.UNKNOWN (IHP110)
5-- at - 16:56:36 09.06.2011
6--
7-- Generated by Mentor Graphics' HDL Designer(TM) 2009.1 (Build 12)
8--
9LIBRARY ieee;
10USE ieee.std_logic_1164.all;
11USE ieee.std_logic_arith.all;
12LIBRARY FACT_FAD_lib;
13USE FACT_FAD_lib.fad_definitions.all;
14
15ENTITY spi_interface IS
16 PORT(
17 clk_50MHz : IN std_logic;
18 config_start : IN std_logic;
19 dac_array : IN dac_array_type;
20 sclk_enable_i : IN std_logic;
21 config_ready : OUT std_logic;
22 current_dac_array : OUT dac_array_type := ( others => 0);
23 dac_cs : OUT std_logic;
24 mosi : OUT std_logic := '0';
25 sclk : OUT std_logic;
26 sensor_array : OUT sensor_array_type;
27 sensor_cs : OUT std_logic_vector (3 DOWNTO 0);
28 sensor_ready : OUT std_logic;
29 miso : INOUT std_logic
30 );
31
32-- Declarations
33
34END spi_interface ;
35
36--
37-- VHDL Architecture FACT_FAD_lib.spi_interface.struct
38--
39-- Created:
40-- by - daqct3.UNKNOWN (IHP110)
41-- at - 16:56:36 09.06.2011
42--
43-- Generated by Mentor Graphics' HDL Designer(TM) 2009.1 (Build 12)
44--
45LIBRARY ieee;
46USE ieee.std_logic_1164.all;
47USE ieee.std_logic_arith.all;
48USE ieee.std_logic_unsigned.all;
49LIBRARY FACT_FAD_lib;
50USE FACT_FAD_lib.fad_definitions.all;
51USE IEEE.NUMERIC_STD.ALL;
52
53LIBRARY FACT_FAD_lib;
54
55ARCHITECTURE struct OF spi_interface IS
56
57 -- Architecture declarations
58
59 -- Internal signal declarations
60 SIGNAL T_sensor_start : std_logic;
61 SIGNAL clk_2Mhz : std_logic := '0';
62 SIGNAL dac_config_ready : std_logic;
63 SIGNAL dac_config_start : std_logic;
64 SIGNAL dac_id : std_logic_vector(2 DOWNTO 0);
65 SIGNAL data : std_logic_vector(15 DOWNTO 0);
66 SIGNAL measured_temp_data : std_logic_vector(15 DOWNTO 0) := (others => '0');
67 SIGNAL sclk_enable_override : std_logic := '0';
68 SIGNAL sclk_enable_sig : std_logic := '0';
69 SIGNAL sensor_id : std_logic_vector(1 DOWNTO 0);
70 SIGNAL sensor_start : std_logic;
71 SIGNAL sensor_valid : std_logic;
72 SIGNAL spi_channel_ready : std_logic := '1';
73
74 -- Implicit buffer signal declarations
75 SIGNAL sclk_internal : std_logic;
76
77
78 -- Component Declarations
79 COMPONENT clk_divider
80 GENERIC (
81 DIVIDER : integer := 25
82 );
83 PORT (
84 clk : IN std_logic;
85 sclk : OUT std_logic := '0'
86 );
87 END COMPONENT;
88 COMPONENT spi_controller
89 PORT (
90 clk : IN std_logic;
91 dac_id : IN std_logic_vector (2 DOWNTO 0);
92 dac_start : IN std_logic;
93 sensor_id : IN std_logic_vector (1 DOWNTO 0);
94 sensor_start : IN std_logic;
95 dac_cs : OUT std_logic := '1';
96 dac_ready : OUT std_logic := '0';
97 measured_temp_data : OUT std_logic_vector (15 DOWNTO 0) := (others => '0');
98 mosi : OUT std_logic := '0';
99 sensor_cs : OUT std_logic_vector (3 DOWNTO 0) := (others => '1');
100 sensor_valid : OUT std_logic := '0';
101 spi_channel_ready : OUT std_logic := '1';
102 data : INOUT std_logic_vector (15 DOWNTO 0) := (others => 'Z');
103 miso : INOUT std_logic := 'Z'
104 );
105 END COMPONENT;
106 COMPONENT spi_distributor
107 GENERIC (
108 TEMP_MEASUREMENT_BEAT : integer := 5*10**6
109 );
110 PORT (
111 clk : IN std_logic;
112 config_start : IN std_logic;
113 dac_array : IN dac_array_type;
114 dac_config_ready : IN std_logic;
115 measured_temp_data : IN std_logic_vector (15 DOWNTO 0);
116 sensor_read_valid : IN std_logic;
117 spi_channel_ready : IN std_logic;
118 config_ready : OUT std_logic := '1';
119 current_dac_array : OUT dac_array_type := ( others => 0);
120 dac_config_start : OUT std_logic := '0';
121 dac_id : OUT std_logic_vector (2 DOWNTO 0) := (others => '0');
122 sclk_enable_override : OUT std_logic := '0';
123 sensor_array : OUT sensor_array_type;
124 sensor_id : OUT std_logic_vector (1 DOWNTO 0) := (others => '0');
125 sensor_read_start : OUT std_logic := '0';
126 sensor_valid : OUT std_logic := '0';
127 data : INOUT std_logic_vector (15 DOWNTO 0) := (others => 'Z')
128 );
129 END COMPONENT;
130
131 -- Optional embedded configurations
132 -- pragma synthesis_off
133 FOR ALL : clk_divider USE ENTITY FACT_FAD_lib.clk_divider;
134 FOR ALL : spi_controller USE ENTITY FACT_FAD_lib.spi_controller;
135 FOR ALL : spi_distributor USE ENTITY FACT_FAD_lib.spi_distributor;
136 -- pragma synthesis_on
137
138
139BEGIN
140
141 -- ModuleWare code(v1.9) for instance 'I0' of 'and'
142 sclk_internal <= clk_2Mhz AND sclk_enable_sig;
143
144 -- ModuleWare code(v1.9) for instance 'I2' of 'or'
145 sclk_enable_sig <= sclk_enable_i OR sclk_enable_override;
146
147 -- Instance port mappings.
148 I1 : clk_divider
149 GENERIC MAP (
150 DIVIDER => 25
151 )
152 PORT MAP (
153 clk => clk_50MHz,
154 sclk => clk_2Mhz
155 );
156 Measure_Temperature_Timer : clk_divider
157 GENERIC MAP (
158 DIVIDER => 25
159 )
160 PORT MAP (
161 clk => sclk_internal,
162 sclk => T_sensor_start
163 );
164 I_spi_controller : spi_controller
165 PORT MAP (
166 clk => sclk_internal,
167 miso => miso,
168 mosi => mosi,
169 dac_cs => dac_cs,
170 sensor_cs => sensor_cs,
171 dac_id => dac_id,
172 sensor_id => sensor_id,
173 data => data,
174 measured_temp_data => measured_temp_data,
175 dac_start => dac_config_start,
176 dac_ready => dac_config_ready,
177 sensor_start => sensor_start,
178 sensor_valid => sensor_valid,
179 spi_channel_ready => spi_channel_ready
180 );
181 I_spi_distributor : spi_distributor
182 GENERIC MAP (
183 TEMP_MEASUREMENT_BEAT => 5*10**6
184 )
185 PORT MAP (
186 clk => sclk_internal,
187 config_start => config_start,
188 config_ready => config_ready,
189 dac_array => dac_array,
190 current_dac_array => current_dac_array,
191 sensor_array => sensor_array,
192 sensor_valid => sensor_ready,
193 sensor_read_start => sensor_start,
194 sensor_read_valid => sensor_valid,
195 dac_config_start => dac_config_start,
196 dac_config_ready => dac_config_ready,
197 spi_channel_ready => spi_channel_ready,
198 sclk_enable_override => sclk_enable_override,
199 dac_id => dac_id,
200 sensor_id => sensor_id,
201 data => data,
202 measured_temp_data => measured_temp_data
203 );
204
205 -- Implicit buffered output assignments
206 sclk <= sclk_internal;
207
208END struct;
Note: See TracBrowser for help on using the repository browser.