Last change
on this file since 13449 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 | |
---|
1 | LIBRARY ieee;
|
---|
2 | USE ieee.std_logic_1164.all;
|
---|
3 | --USE ieee.std_logic_arith.all;
|
---|
4 | --use ieee.STD_LOGIC_UNSIGNED.all;
|
---|
5 | use ieee.numeric_std.all;
|
---|
6 |
|
---|
7 | library FACT_FAD_lib;
|
---|
8 | use FACT_FAD_lib.fad_definitions.all;
|
---|
9 |
|
---|
10 |
|
---|
11 | ENTITY continous_pulser IS
|
---|
12 |
|
---|
13 | GENERIC(
|
---|
14 | MINIMAL_TRIGGER_WAIT_TIME : integer := 250000;
|
---|
15 | TRIGGER_WIDTH : integer := 5
|
---|
16 | );
|
---|
17 | PORT(
|
---|
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 | );
|
---|
23 | END ENTITY continous_pulser;
|
---|
24 |
|
---|
25 | ARCHITECTURE 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 |
|
---|
36 | BEGIN
|
---|
37 | trigger <= trigger_loc and enable;
|
---|
38 |
|
---|
39 | counter : 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 |
|
---|
66 | END ARCHITECTURE beha; |
---|
Note:
See
TracBrowser
for help on using the repository browser.