source: firmware/FTM/dna/FTM_dna_gen.vhd@ 18481

Last change on this file since 18481 was 10418, checked in by weitzel, 14 years ago
New FTM firmare: dna, fad_broadcast, FTU error messages, rates readout
File size: 3.2 KB
Line 
1----------------------------------------------------------------------------------
2-- Company: ETH Zurich, Institute for Particle Physics
3-- Engineer: Q. Weitzel
4--
5-- Create Date: 04/15/2010
6-- Design Name:
7-- Module Name: FTM_dna_gen - Behavioral
8-- Project Name:
9-- Target Devices:
10-- Tool versions:
11-- Description: entity to read out the FPGA DNA identifier
12--
13--
14-- Dependencies:
15--
16-- Revision:
17-- Revision 0.01 - File Created
18-- Additional Comments:
19--
20----------------------------------------------------------------------------------
21library IEEE;
22use IEEE.STD_LOGIC_1164.ALL;
23use IEEE.STD_LOGIC_ARITH.ALL;
24use IEEE.STD_LOGIC_UNSIGNED.ALL;
25
26library ftm_definitions;
27USE ftm_definitions.ftm_constants.all;
28
29---- Uncomment the following library declaration if instantiating
30---- any Xilinx primitives in this code.
31library UNISIM;
32use UNISIM.VComponents.all;
33
34entity FTM_dna_gen is
35 Port (
36 clk : IN STD_LOGIC;
37 start : IN STD_LOGIC;
38 dna : OUT STD_LOGIC_VECTOR(63 downto 0) := (others => '0');
39 ready : OUT STD_LOGIC := '0'
40 );
41end FTM_dna_gen;
42
43architecture Behavioral of FTM_dna_gen is
44
45 signal dout_sig : STD_LOGIC := '0';
46 signal read_sig : STD_LOGIC := '0';
47 signal shift_sig : STD_LOGIC := '0';
48 signal dna_sig : STD_LOGIC_VECTOR(63 downto 0) := (others => '0');
49
50 type FTM_dna_gen_StateType is (IDLE, READ_DNA, SHIFT_DNA, DNA_READY);
51 signal FTM_dna_gen_State : FTM_dna_gen_StateType;
52
53 signal shift_cntr : INTEGER range 0 to 64 := 0;
54
55begin
56
57 DNA_PORT_inst : DNA_PORT
58 generic map (
59 SIM_DNA_VALUE => DNA_FOR_SIM) -- Specifies the Pre-programmed factory ID value
60 port map (
61 DOUT => dout_sig, -- 1-bit DNA output data
62 CLK => clk, -- 1-bit clock input
63 DIN => '0', -- 1-bit user data input pin
64 READ => read_sig, -- 1-bit input, active high load DNA, active low read
65 SHIFT => shift_sig -- 1-bit input, active high shift enable
66 );
67
68 FTM_dna_gen_FSM : process(clk)
69 begin
70 if Falling_edge(clk) then
71 case FTM_dna_gen_State is
72 when IDLE =>
73 ready <= '0';
74 read_sig <= '0';
75 shift_sig <= '0';
76 if (start = '1') then
77 FTM_dna_gen_State <= READ_DNA;
78 else
79 FTM_dna_gen_State <= IDLE;
80 end if;
81 when READ_DNA =>
82 ready <= '0';
83 read_sig <= '1';
84 shift_sig <= '0';
85 FTM_dna_gen_State <= SHIFT_DNA;
86 when SHIFT_DNA =>
87 shift_cntr <= shift_cntr + 1;
88 ready <= '0';
89 read_sig <= '0';
90 if (shift_cntr < 57) then
91 dna_sig <= dna_sig(62 downto 0) & dout_sig; -- put in from right
92 shift_sig <= '1';
93 FTM_dna_gen_State <= SHIFT_DNA;
94 --elsif (shift_cntr = 56) then
95 --dna_sig <= dna_sig(62 downto 0) & dout_sig; -- put in from right
96 --shift_sig <= '0';
97 --FTM_dna_gen_State <= SHIFT_DNA;
98 else
99 shift_sig <= '1';
100 FTM_dna_gen_State <= DNA_READY;
101 end if;
102 when DNA_READY =>
103 ready <= '1';
104 read_sig <= '0';
105 shift_sig <= '0';
106 end case;
107 end if;
108 end process FTM_dna_gen_FSM;
109
110 dna <= dna_sig;
111
112end Behavioral;
Note: See TracBrowser for help on using the repository browser.