1 | -- VHDL Entity FACT_FAD_lib.spi_interface.symbol
|
---|
2 | --
|
---|
3 | -- Created:
|
---|
4 | -- by - kai.UNKNOWN (E5PCXX)
|
---|
5 | -- at - 14:16:38 19.05.2010
|
---|
6 | --
|
---|
7 | -- Generated by Mentor Graphics' HDL Designer(TM) 2009.1 (Build 12)
|
---|
8 | --
|
---|
9 | LIBRARY ieee;
|
---|
10 | USE ieee.std_logic_1164.all;
|
---|
11 | USE ieee.std_logic_arith.all;
|
---|
12 | LIBRARY FACT_FAD_lib;
|
---|
13 | USE FACT_FAD_lib.fad_definitions.all;
|
---|
14 |
|
---|
15 | ENTITY 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 | config_ready : OUT std_logic;
|
---|
21 | config_started : OUT std_logic := '0';
|
---|
22 | dac_cs : OUT std_logic;
|
---|
23 | mosi : OUT std_logic := '0';
|
---|
24 | sclk : OUT std_logic;
|
---|
25 | sensor_array : OUT sensor_array_type;
|
---|
26 | sensor_cs : OUT std_logic_vector (3 DOWNTO 0);
|
---|
27 | sensor_ready : OUT std_logic;
|
---|
28 | sio : INOUT std_logic
|
---|
29 | );
|
---|
30 |
|
---|
31 | -- Declarations
|
---|
32 |
|
---|
33 | END spi_interface ;
|
---|
34 |
|
---|
35 | --
|
---|
36 | -- VHDL Architecture FACT_FAD_lib.spi_interface.struct
|
---|
37 | --
|
---|
38 | -- Created:
|
---|
39 | -- by - kai.UNKNOWN (E5PCXX)
|
---|
40 | -- at - 14:16:38 19.05.2010
|
---|
41 | --
|
---|
42 | -- Generated by Mentor Graphics' HDL Designer(TM) 2009.1 (Build 12)
|
---|
43 | --
|
---|
44 | LIBRARY ieee;
|
---|
45 | USE ieee.std_logic_1164.all;
|
---|
46 | USE ieee.std_logic_arith.all;
|
---|
47 | USE ieee.std_logic_unsigned.all;
|
---|
48 | LIBRARY FACT_FAD_lib;
|
---|
49 | USE FACT_FAD_lib.fad_definitions.all;
|
---|
50 |
|
---|
51 | LIBRARY FACT_FAD_lib;
|
---|
52 |
|
---|
53 | ARCHITECTURE struct OF spi_interface IS
|
---|
54 |
|
---|
55 | -- Architecture declarations
|
---|
56 |
|
---|
57 | -- Internal signal declarations
|
---|
58 | SIGNAL dac_config_ready : std_logic;
|
---|
59 | SIGNAL dac_config_start : std_logic;
|
---|
60 | SIGNAL dac_id : std_logic_vector(2 DOWNTO 0);
|
---|
61 | SIGNAL data : std_logic_vector(15 DOWNTO 0);
|
---|
62 | SIGNAL sensor_id : std_logic_vector(1 DOWNTO 0);
|
---|
63 | SIGNAL sensor_start : std_logic;
|
---|
64 | SIGNAL sensor_valid : std_logic;
|
---|
65 |
|
---|
66 | -- Implicit buffer signal declarations
|
---|
67 | SIGNAL sclk_internal : std_logic;
|
---|
68 |
|
---|
69 |
|
---|
70 | -- Component Declarations
|
---|
71 | COMPONENT spi_clock_generator
|
---|
72 | GENERIC (
|
---|
73 | CLK_DIVIDER : integer := 25 --2 MHz @ 50 MHz
|
---|
74 | );
|
---|
75 | PORT (
|
---|
76 | clk : IN std_logic;
|
---|
77 | sclk : OUT std_logic := '0'
|
---|
78 | );
|
---|
79 | END COMPONENT;
|
---|
80 | COMPONENT spi_controller
|
---|
81 | PORT (
|
---|
82 | clk : IN std_logic;
|
---|
83 | dac_id : IN std_logic_vector (2 DOWNTO 0);
|
---|
84 | dac_start : IN std_logic;
|
---|
85 | sensor_id : IN std_logic_vector (1 DOWNTO 0);
|
---|
86 | sensor_start : IN std_logic;
|
---|
87 | dac_cs : OUT std_logic := '1';
|
---|
88 | dac_ready : OUT std_logic := '0';
|
---|
89 | mosi : OUT std_logic := '0';
|
---|
90 | sensor_cs : OUT std_logic_vector (3 DOWNTO 0) := (others => '1');
|
---|
91 | sensor_valid : OUT std_logic := '0';
|
---|
92 | data : INOUT std_logic_vector (15 DOWNTO 0) := (others => 'Z');
|
---|
93 | sio : INOUT std_logic := 'Z'
|
---|
94 | );
|
---|
95 | END COMPONENT;
|
---|
96 | COMPONENT spi_distributor
|
---|
97 | GENERIC (
|
---|
98 | CLK_DIVIDER : integer := 10**6
|
---|
99 | );
|
---|
100 | PORT (
|
---|
101 | clk : IN std_logic;
|
---|
102 | config_start : IN std_logic;
|
---|
103 | dac_array : IN dac_array_type;
|
---|
104 | dac_config_ready : IN std_logic;
|
---|
105 | sensor_read_valid : IN std_logic;
|
---|
106 | config_ready : OUT std_logic := '0';
|
---|
107 | config_started : OUT std_logic := '0';
|
---|
108 | dac_config_start : OUT std_logic := '0';
|
---|
109 | dac_id : OUT std_logic_vector (2 DOWNTO 0) := (others => '0');
|
---|
110 | sensor_array : OUT sensor_array_type;
|
---|
111 | sensor_id : OUT std_logic_vector (1 DOWNTO 0) := (others => '0');
|
---|
112 | sensor_read_start : OUT std_logic := '0';
|
---|
113 | sensor_valid : OUT std_logic := '0';
|
---|
114 | data : INOUT std_logic_vector (15 DOWNTO 0) := (others => 'Z')
|
---|
115 | );
|
---|
116 | END COMPONENT;
|
---|
117 |
|
---|
118 | -- Optional embedded configurations
|
---|
119 | -- pragma synthesis_off
|
---|
120 | FOR ALL : spi_clock_generator USE ENTITY FACT_FAD_lib.spi_clock_generator;
|
---|
121 | FOR ALL : spi_controller USE ENTITY FACT_FAD_lib.spi_controller;
|
---|
122 | FOR ALL : spi_distributor USE ENTITY FACT_FAD_lib.spi_distributor;
|
---|
123 | -- pragma synthesis_on
|
---|
124 |
|
---|
125 |
|
---|
126 | BEGIN
|
---|
127 |
|
---|
128 | -- Instance port mappings.
|
---|
129 | I_spi_clkgen : spi_clock_generator
|
---|
130 | GENERIC MAP (
|
---|
131 | CLK_DIVIDER => 25 --2 MHz @ 50 MHz
|
---|
132 | )
|
---|
133 | PORT MAP (
|
---|
134 | clk => clk_50MHz,
|
---|
135 | sclk => sclk_internal
|
---|
136 | );
|
---|
137 | I_spi_controller : spi_controller
|
---|
138 | PORT MAP (
|
---|
139 | clk => sclk_internal,
|
---|
140 | sio => sio,
|
---|
141 | mosi => mosi,
|
---|
142 | dac_id => dac_id,
|
---|
143 | sensor_id => sensor_id,
|
---|
144 | data => data,
|
---|
145 | dac_cs => dac_cs,
|
---|
146 | sensor_cs => sensor_cs,
|
---|
147 | dac_start => dac_config_start,
|
---|
148 | dac_ready => dac_config_ready,
|
---|
149 | sensor_start => sensor_start,
|
---|
150 | sensor_valid => sensor_valid
|
---|
151 | );
|
---|
152 | I_spi_distributor : spi_distributor
|
---|
153 | GENERIC MAP (
|
---|
154 | CLK_DIVIDER => 4*10**3
|
---|
155 | )
|
---|
156 | PORT MAP (
|
---|
157 | clk => sclk_internal,
|
---|
158 | config_start => config_start,
|
---|
159 | config_ready => config_ready,
|
---|
160 | config_started => config_started,
|
---|
161 | sensor_valid => sensor_ready,
|
---|
162 | dac_array => dac_array,
|
---|
163 | sensor_array => sensor_array,
|
---|
164 | dac_config_start => dac_config_start,
|
---|
165 | dac_config_ready => dac_config_ready,
|
---|
166 | sensor_read_start => sensor_start,
|
---|
167 | sensor_read_valid => sensor_valid,
|
---|
168 | dac_id => dac_id,
|
---|
169 | sensor_id => sensor_id,
|
---|
170 | data => data
|
---|
171 | );
|
---|
172 |
|
---|
173 | -- Implicit buffered output assignments
|
---|
174 | sclk <= sclk_internal;
|
---|
175 |
|
---|
176 | END struct;
|
---|