otsdaq_prepmodernization  v2_05_02_indev
PsudoCounter.vhd
1 ----------------------------------------------------------------------------------
2 -- Company: Fermi National Accelerator Labratory
3 -- Engineer: Collin Bradford
4 --
5 -- Create Date: 11:52:20 04/07/2017
6 -- Design Name:
7 -- Module Name: PsudoCounter - Behavioral
8 -- Project Name:
9 -- Target Devices:
10 -- Tool versions:
11 -- Description:
12 --
13 -- Dependencies:
14 --
15 -- Revision:
16 -- Revision 0.01 - File Created
17 -- Additional Comments:
18 --
19 ----------------------------------------------------------------------------------
20 library IEEE;
21 use IEEE.STD_LOGIC_1164.ALL;
22 use IEEE.STD_LOGIC_ARITH.ALL;
23 use IEEE.STD_LOGIC_UNSIGNED.ALL;
24 
25 -- Uncomment the following library declaration if using
26 -- arithmetic functions with Signed or Unsigned values
27 --use IEEE.NUMERIC_STD.ALL;
28 
29 -- Uncomment the following library declaration if instantiating
30 -- any Xilinx primitives in this code.
31 --library UNISIM;
32 --use UNISIM.VComponents.all;
33 
34 entity PsudoCounter is
35  Port ( clk : in STD_LOGIC;
36  reset : in STD_LOGIC;
37  SampleOne : out STD_LOGIC_VECTOR (7 downto 0);
38  SampleTwo : out STD_LOGIC_VECTOR (7 downto 0);
39  SampleThree : out std_logic_vector (7 downto 0);
40  SampleFour : out std_logic_vector (7 downto 0);
41  SampleFive : out std_logic_vector (7 downto 0);
42  SampleSix : out std_logic_vector (7 downto 0);
43  SampleSeven : out std_logic_vector (7 downto 0);
44  SampleEight : out std_logic_vector (7 downto 0));
45 end PsudoCounter;
46 
47 architecture Behavioral of PsudoCounter is
48  signal counterOne : std_logic_vector(0 to 7);
49  signal counterTwo : std_logic_vector(0 to 7);
50  signal counterThree : std_logic_vector(0 to 7);
51  signal counterFour : std_logic_vector(0 to 7);
52  signal counterFive : std_logic_vector(0 to 7);
53  signal counterSix : std_logic_vector(0 to 7);
54  signal counterSeven : std_logic_vector(0 to 7);
55  signal counterEight : std_logic_vector(0 to 7);
56 begin
57 
58  process(clk, reset) begin
59 
60  if(reset = '0') then--reset is disabled
61 
62  if(rising_edge(clk)) then
63  counterOne <= counterOne + 8;--increase counter one by one
64  counterTwo <= counterOne + 9;--we want counter two to always be 1 sample ahead of counter 1. Since we are adding onto the old value of counterOne, we add 2.
65  counterThree <= counterOne + 10;
66  counterFour <= counterOne + 11;
67  counterFive <= counterOne + 12;
68  counterSix <= counterOne + 13;
69  counterSeven <= counterOne + 14;
70  counterEight <= counterOne + 15;
71  end if;
72 
73  else--reset is enabled
74  counterOne <= "00000000";
75  counterTwo <= "00000001";
76  counterThree <= "00000010";
77  counterFour <= "00000011";
78  counterFive <= "00000100";
79  counterSix <= "00000101";
80  counterSeven <= "00000110";
81  counterEight <= "00000111";
82  end if;
83 
84  end process;
85 
86  SampleOne <= counterOne;
87  SampleTwo <= counterTwo;
88 
89 end Behavioral;
90