source: FPGA/FTU/test_firmware/FTU_test5/FTU_test5_spi_distributor.vhd@ 8774

Last change on this file since 8774 was 268, checked in by qweitzel, 14 years ago
FTU_test5 added
File size: 2.9 KB
Line 
1--
2-- VHDL Architecture FACT_FAD_lib.spi_distributor.beha
3--
4-- Created:
5-- by - Benjamin Krumm.UNKNOWN (EEPC8)
6-- at - 09:24:21 23.04.2010
7--
8-- using Mentor Graphics HDL Designer(TM) 2009.1 (Build 12)
9--
10-- modified by Q. Weitzel
11--
12LIBRARY ieee;
13USE ieee.std_logic_1164.all;
14USE ieee.std_logic_arith.all;
15USE ieee.std_logic_unsigned.all;
16library ftu_definitions_test5;
17USE ftu_definitions_test5.ftu_array_types.all;
18
19ENTITY FTU_test5_spi_distributor IS
20 PORT(
21 clk : IN std_logic; -- 50MHz
22 config_start : IN std_logic;
23 config_ready : OUT std_logic := '0';
24 config_started : OUT std_logic := '0';
25 dac_array : IN dac_array_type;
26 dac_config_start : OUT std_logic := '0';
27 dac_config_ready : IN std_logic;
28 dac_id : OUT std_logic_vector(2 downto 0) := (others => '0');
29 --data : INOUT std_logic_vector(15 downto 0) := (others => 'Z')
30 data : OUT std_logic_vector(15 downto 0) := (others => '0')
31 );
32END ENTITY FTU_test5_spi_distributor;
33
34ARCHITECTURE beha OF FTU_test5_spi_distributor IS
35
36 type TYPE_SPI_DISTRIBUTION_STATE is (INIT, IDLE, CONFIG_DAC);
37
38 signal spi_distr_state : TYPE_SPI_DISTRIBUTION_STATE := INIT;
39 signal dac_id_cnt : integer range 0 to 7 := 0;
40
41BEGIN
42
43 spi_distribute_proc: process (clk)
44 begin
45
46 if rising_edge(clk) then
47 --data <= (others => 'Z');
48 data <= (others => '0');
49 case spi_distr_state is
50 when INIT =>
51 --data <= (others => 'Z');
52 data <= (others => '0');
53 spi_distr_state <= IDLE;
54 when IDLE =>
55 --data <= (others => 'Z');
56 data <= (others => '0');
57 -- start DAC configuration
58 if (config_start = '1') then
59 config_started <= '1';
60 config_ready <= '0';
61 dac_config_start <= '1';
62 dac_id <= conv_std_logic_vector(dac_id_cnt, dac_id'length);
63 data <= conv_std_logic_vector(dac_array(dac_id_cnt),data'length);
64 spi_distr_state <= CONFIG_DAC;
65 end if;
66
67 -- DAC configuration
68 when CONFIG_DAC =>
69 dac_config_start <= '1';
70 dac_id <= conv_std_logic_vector(dac_id_cnt, dac_id'length);
71 data <= conv_std_logic_vector(dac_array(dac_id_cnt),data'length);
72 if (dac_config_ready = '1') then
73 dac_config_start <= '0';
74 if (dac_id_cnt < 7) then
75 dac_id_cnt <= dac_id_cnt + 1;
76 dac_config_start <= '1';
77 spi_distr_state <= CONFIG_DAC;
78 else
79 dac_id_cnt <= 0;
80 config_started <= '0';
81 config_ready <= '1';
82 spi_distr_state <= IDLE;
83 end if;
84 end if;
85 end case;
86 end if;
87
88 end process spi_distribute_proc;
89
90END ARCHITECTURE beha;
91
Note: See TracBrowser for help on using the repository browser.