From: Jan Michel Date: Tue, 14 Jul 2015 16:21:25 +0000 (+0200) Subject: some further features and fixes for the pulser X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=0a91b83330bfade669941088c515024eb1cea98a;p=trb3sc.git some further features and fixes for the pulser --- diff --git a/pulser/code/single_channel_pulser.vhd b/pulser/code/single_channel_pulser.vhd index 85f565f..a3ffeee 100644 --- a/pulser/code/single_channel_pulser.vhd +++ b/pulser/code/single_channel_pulser.vhd @@ -59,11 +59,11 @@ end process; end if; end process; - PROC_FREQUENCY : process (CLK) --It eliminates the offset of -2 for the frequency + PROC_FREQUENCY : process (CLK) --It eliminates the offset of -3 for the frequency begin if rising_edge(CLK) then - if frequency_in >= x"000002" then - frequency_i <= frequency_in-2; + if frequency_in >= x"000003" then + frequency_i <= frequency_in-3; end if; reset_delay <= RESET; --I want the timer to start again after the operations with the frequency end if; @@ -84,7 +84,8 @@ end process; last_timer <= timer when rising_edge(CLK); - PROC_PULSE_MANAGER : process(CLK) + PROC_PULSE_MANAGER : process(CLK) + variable p : std_logic_vector(3 downto 0); begin if RESET = '1' then state <= idle; @@ -94,22 +95,22 @@ last_timer <= timer when rising_edge(CLK); case state is when idle => - PULSE <= "0000"; + p := "0000"; pulse_width_i <= pulse_width_in; - if last_timer = x"000000" and ENABLE = '1' then + if last_timer = OFFSET and ENABLE = '1' then state <= generate_pulse; end if; when generate_pulse => if pulse_width_i = x"000002" then - PULSE <= "0011"; + p := "0011"; elsif pulse_width_i = x"000003" then - PULSE <= "0111"; + p := "0111"; elsif pulse_width_i >= x"000004" then - PULSE <= "1111"; + p := "1111"; else - PULSE <= "0001"; + p := "0001"; end if; pulse_width_i <= pulse_width_i-4; @@ -121,10 +122,12 @@ last_timer <= timer when rising_edge(CLK); when finish => state <= idle; - PULSE <= "0000"; + p := "0000"; end case; - + + PULSE <= p xor (INVERT & INVERT & INVERT & INVERT); + end if;