]> jspc29.x-matter.uni-frankfurt.de Git - trb3.git/commitdiff
delay the hitbus signal for time walk measurement.
authorTobias Weber <webert@kph.uni-mainz.de>
Sat, 21 Mar 2015 14:44:44 +0000 (15:44 +0100)
committerTobias Weber <webert@kph.uni-mainz.de>
Sat, 21 Mar 2015 14:44:44 +0000 (15:44 +0100)
mupix/sources/TimeWalk.vhd
mupix/sources/TimeWalkWithFiFo.vhd
mupix/sources/mupix_components.vhd
mupix/trb3_periph.prj

index a8256cd280e5ab600f02928b654e7cd3a2fd6fc5..750cc49db4fa4989d1fd6dbdf55fd00e5fce4630 100644 (file)
@@ -6,6 +6,7 @@ library IEEE;
 use IEEE.STD_LOGIC_1164.all;
 use IEEE.numeric_std.all;
 
+
 entity TimeWalk is
   port (
     clk                  : in  std_logic;
@@ -22,24 +23,45 @@ architecture TimeWalk_Arch of TimeWalk is
 
   signal latencycounter            : unsigned(15 downto 0)        := (others => '0');
   signal hitbuscounter             : unsigned(15 downto 0)        := (others => '0');
+  signal hitbus_delayed            : std_logic := '0';
   signal hitbus_edge               : std_logic_vector(1 downto 0) := (others => '0');
   signal szintillator_trigger_edge : std_logic_vector(1 downto 0) := (others => '0');
-  signal hitbusBuffer : std_logic := '0';
-  signal szintilatorTriggerBuffer : std_logic := '0';
+  signal szintillator_trigger_buffer : std_logic := '0';
   type TimeWalk_fsm_type is (idle, waitforhitbus, measurehitbus, measurement_done);
   signal timewalk_fsm              : TimeWalk_fsm_type            := idle;
 
+  component SignalDelay is
+    generic (
+      Width : integer range 1 to 32;
+      Delay : integer range 2 to 8);
+    port (
+      clk_in   : in  std_logic;
+      write_en_in : in std_logic;
+      delay_in : in  std_logic_vector(Delay - 1 downto 0);
+      sig_in   : in  std_logic_vector(Width - 1 downto 0);
+      sig_out  : out std_logic_vector(Width - 1 downto 0));
+  end component SignalDelay;
   
 begin  -- architecture TimeWalk_Arch
 
+  SignalDelay_1: entity work.SignalDelay
+    generic map (
+      Width => 1,
+      Delay => 12)
+    port map (
+      clk_in   => clk,
+      write_en_in => '1',
+      delay_in => std_logic_vector(to_unsigned(16,12)),
+      sig_in(0)   => hitbus,
+      sig_out(0)  => hitbus_delayed);
+  
   -- purpose: synchronize signals and edge detection
   signal_synchro: process (clk) is
   begin  -- process clk
     if rising_edge(clk) then
-      hitbusBuffer <= hitbus;
-      szintilatorTriggerBuffer <= szintillator_trigger;
-      hitbus_edge               <= hitbus_edge(0) & hitbusBuffer;
-      szintillator_trigger_edge <= szintillator_trigger_edge(0) & szintilatorTriggerBuffer;  
+      hitbus_edge               <= hitbus_edge(0) & hitbus_delayed;
+      szintillator_trigger_buffer <= szintillator_trigger;
+      szintillator_trigger_edge <= szintillator_trigger_edge(0) & szintillator_trigger_buffer;  
     end if;
   end process signal_synchro;
 
@@ -54,7 +76,7 @@ begin  -- architecture TimeWalk_Arch
         hitbuscounter  <= (others => '0');
         if szintillator_trigger_edge = "01" then
           timewalk_fsm   <= waitforhitbus;
-          latencycounter <= latencycounter + 1;
+          latencycounter <= to_unsigned(1,16);
         end if;
         when waitforhitbus =>
         latencycounter <= latencycounter + 1;
@@ -62,7 +84,7 @@ begin  -- architecture TimeWalk_Arch
           timewalk_fsm <= idle;
         elsif hitbus_edge = "01" then
           timewalk_fsm  <= measurehitbus;
-          hitbuscounter <= hitbuscounter + 1;
+          hitbuscounter <= to_unsigned(1,16);
         else
           timewalk_fsm <= waitforhitbus;
         end if;
index b06bcd977837dc51a4a48cfdf9fd9e2cfedeca90..59bcaac23fd3b31c59576bf3e572000871066f76 100644 (file)
@@ -32,7 +32,7 @@ end entity TimeWalkWithFiFo;
 architecture TimeWalk_arch of TimeWalkWithFiFo is
 
   constant bitsBeforeWriteCounter : integer := 2;
-  signal hitbus_timeout            : std_logic_vector(31 downto 0)        := (others => '0');
+  signal hitbus_timeout            : std_logic_vector(31 downto 0)        := x"00000024";
 
   signal resetcounters : std_logic := '0';
   signal hitbusEdgeCounter : unsigned(31 downto 0) := (others => '0');
index 8a429e0def9599a31004ef2c1500686fe3a02589..7eebcbeae51ab41a61154f7cd58f04eb80f6bb70 100644 (file)
@@ -334,5 +334,6 @@ package mupix_components is
       measurementFinished  : out std_logic;
       measurementData      : out std_logic_vector(31 downto 0));
   end component TimeWalk;
+
   
 end mupix_components;
index 71067e97e0ef8f302dccba8e766df22e3079ebf2..f82fd1518bdbda48f9d3d42b2f44666b3dc84c95 100644 (file)
@@ -159,4 +159,5 @@ add_file -vhdl -lib "work" "cores/fifo_32x2k.vhd"
 add_file -vhdl -lib "work" "sources/ResetHandler.vhd"
 add_file -vhdl -lib "work" "cores/fifo_4k32_async.vhd"
 add_file -vhdl -lib "work" "sources/TimeWalk.vhd"
-add_file -vhdl -lib "work" "sources/TimeWalkWithFiFo.vhd"
\ No newline at end of file
+add_file -vhdl -lib "work" "sources/TimeWalkWithFiFo.vhd"
+add_file -vhdl -lib "work" "sources/SignalDelay.vhd"
\ No newline at end of file