| 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: FTM_test3_microwire_interface - Behavioral
|
|---|
| 8 | -- (based on FTU_test5_spi_interface - Behavioral)
|
|---|
| 9 | -- Project Name:
|
|---|
| 10 | -- Target Devices:
|
|---|
| 11 | -- Tool versions:
|
|---|
| 12 | -- Description: Based on VHDL Entity FACT_FAD_lib.spi_interface.symbol
|
|---|
| 13 | --
|
|---|
| 14 | -- Dependencies:
|
|---|
| 15 | --
|
|---|
| 16 | -- Revision:
|
|---|
| 17 | -- Revision 0.01 - File Created
|
|---|
| 18 | -- Additional Comments:
|
|---|
| 19 | --
|
|---|
| 20 | --
|
|---|
| 21 | -- modified by Patrick Vogler, September 17 2010
|
|---|
| 22 | -- for use as a microwire interface to the clock conditioner LMK03000
|
|---|
| 23 | -- on the FTM board
|
|---|
| 24 | --
|
|---|
| 25 | -- modified by Patrick Vogler, February 15 2011
|
|---|
| 26 | -- to be used as an FTM firmware clock conditioner interface
|
|---|
| 27 | ----------------------------------------------------------------------------------
|
|---|
| 28 | library IEEE;
|
|---|
| 29 | use IEEE.STD_LOGIC_1164.ALL;
|
|---|
| 30 | use IEEE.STD_LOGIC_ARITH.ALL;
|
|---|
| 31 | use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
|---|
| 32 |
|
|---|
| 33 | library ftm_definitions;
|
|---|
| 34 | USE ftm_definitions.ftm_array_types.all;
|
|---|
| 35 | USE ftm_definitions.ftm_constants.all;
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | -------------------------------------------------------------------------------
|
|---|
| 40 | ---- Uncomment the following library declaration if instantiating
|
|---|
| 41 | ---- any Xilinx primitives in this code.
|
|---|
| 42 | --library UNISIM;
|
|---|
| 43 | --use UNISIM.VComponents.all;
|
|---|
| 44 |
|
|---|
| 45 | ENTITY microwire_interface IS
|
|---|
| 46 | PORT(
|
|---|
| 47 | clk : IN std_logic; -- 50MHz
|
|---|
| 48 | clk_uwire : OUT std_logic; -- sclk
|
|---|
| 49 | data_uwire : OUT std_logic := '0'; -- mosi
|
|---|
| 50 | le_uwire : OUT std_logic := '1'; -- Latch Enable = chip select
|
|---|
| 51 | clk_cond_array : IN clk_cond_array_type; -- data to be loaded
|
|---|
| 52 | -- into the clock conditioner
|
|---|
| 53 | config_start : IN std_logic;
|
|---|
| 54 | config_ready : OUT std_logic := '0';
|
|---|
| 55 | config_started : OUT std_logic := '0'
|
|---|
| 56 | );
|
|---|
| 57 | END microwire_interface;
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 | ARCHITECTURE struct OF microwire_interface IS
|
|---|
| 61 |
|
|---|
| 62 | -- Internal signal declarations
|
|---|
| 63 | SIGNAL clk_uwire_sig : std_logic;
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 | -- Component Declarations
|
|---|
| 67 | COMPONENT microwire_clock_gen
|
|---|
| 68 | GENERIC (
|
|---|
| 69 | CLK_DIVIDER : integer := INT_CLK_FREQUENCY_1 / MICROWIRE_CLK_FREQUENCY --2 MHz @ 50 MHz
|
|---|
| 70 | );
|
|---|
| 71 | PORT (
|
|---|
| 72 | clk : IN std_logic;
|
|---|
| 73 | sclk : OUT std_logic := '0'
|
|---|
| 74 | );
|
|---|
| 75 | END COMPONENT;
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 | COMPONENT microwire_controller
|
|---|
| 79 | PORT (
|
|---|
| 80 | clk_uwire : IN std_logic; -- sclk
|
|---|
| 81 | data_uwire : OUT std_logic := '0'; -- mosi
|
|---|
| 82 | le_uwire : OUT std_logic := '1'; -- Latch Enable = chip select
|
|---|
| 83 | clk_cond_array : IN clk_cond_array_type; -- data to be loaded
|
|---|
| 84 | -- into the clock conditioner
|
|---|
| 85 | config_start : IN std_logic;
|
|---|
| 86 | config_ready : OUT std_logic := '0';
|
|---|
| 87 | config_started : OUT std_logic := '0'
|
|---|
| 88 | );
|
|---|
| 89 | END COMPONENT;
|
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 | BEGIN
|
|---|
| 94 |
|
|---|
| 95 | -- Instance port mappings.
|
|---|
| 96 | Inst_microwire_clock_gen : microwire_clock_gen
|
|---|
| 97 | GENERIC MAP (
|
|---|
| 98 | CLK_DIVIDER => INT_CLK_FREQUENCY_1 / MICROWIRE_CLK_FREQUENCY --2 MHz @ 50 MHz
|
|---|
| 99 | )
|
|---|
| 100 | PORT MAP (
|
|---|
| 101 | clk => clk,
|
|---|
| 102 | sclk => clk_uwire_sig
|
|---|
| 103 | );
|
|---|
| 104 |
|
|---|
| 105 | Inst_microwire_controller : microwire_controller
|
|---|
| 106 | PORT MAP (
|
|---|
| 107 | clk_uwire => clk_uwire_sig,
|
|---|
| 108 | data_uwire => data_uwire,
|
|---|
| 109 | le_uwire => le_uwire,
|
|---|
| 110 | clk_cond_array => clk_cond_array,
|
|---|
| 111 | config_start => config_start,
|
|---|
| 112 | config_ready => config_ready,
|
|---|
| 113 | config_started => config_started
|
|---|
| 114 | );
|
|---|
| 115 |
|
|---|
| 116 | clk_uwire<= clk_uwire_sig;
|
|---|
| 117 |
|
|---|
| 118 | END struct;
|
|---|