source: firmware/FAD/FACT_FAD_lib/hdl/continous_pulser_beha.vhd@ 11757

Last change on this file since 11757 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: 1.5 KB
Line 
1LIBRARY ieee;
2USE ieee.std_logic_1164.all;
3--USE ieee.std_logic_arith.all;
4--use ieee.STD_LOGIC_UNSIGNED.all;
5use ieee.numeric_std.all;
6
7library FACT_FAD_lib;
8use FACT_FAD_lib.fad_definitions.all;
9
10
11ENTITY continous_pulser IS
12
13GENERIC(
14 MINIMAL_TRIGGER_WAIT_TIME : integer := 250000;
15 TRIGGER_WIDTH : integer := 5
16);
17PORT(
18 CLK : IN std_logic; -- 25MHz = 40ns
19 enable : in std_logic;
20 multiplier : IN std_logic_vector (15 downto 0);
21 trigger : out std_logic
22 );
23END ENTITY continous_pulser;
24
25ARCHITECTURE beha OF continous_pulser IS
26
27-- type states is ( INIT, WAITING, CONNECTED);
28-- signal state,next_state : states := INIT;
29
30 -- noninverted logic
31 signal trigger_loc : std_logic := '0';
32 signal mult_int : integer range 0 to 65535 :=0;
33 signal prescaler: integer range 0 to (MINIMAL_TRIGGER_WAIT_TIME);
34 signal scaler: integer range 0 to 256;
35
36BEGIN
37 trigger <= trigger_loc and enable;
38
39counter : process (CLK)
40
41 begin
42 if rising_edge(CLK) then
43 mult_int <= to_integer(unsigned(multiplier));
44
45
46 if (prescaler < MINIMAL_TRIGGER_WAIT_TIME - 1) then
47 prescaler <= prescaler + 1;
48 else
49 prescaler <= 0;
50 if ( scaler < mult_int ) then
51 scaler <= scaler + 1;
52 else
53 scaler <= 0;
54 end if;
55 end if;
56
57 if ( (prescaler = 0)and(scaler = 0) ) then
58 trigger_loc <= '1';
59 end if;
60 if (prescaler = TRIGGER_WIDTH) then
61 trigger_loc <= '0';
62 end if;
63 end if;
64 end process counter;
65
66END ARCHITECTURE beha;
Note: See TracBrowser for help on using the repository browser.