-- Bit 30 - 29 : Status
-- Bit 31 : Error flag
-
+--statusbit 23 will be set in case of a data error from MBS
architecture mbs_vulom_recv_arch of mbs_vulom_recv is
signal reg_MBS_IN : std_logic;
signal done : std_logic;
-signal numer_reg : std_logic_vector(23 downto 0);
+signal number_reg : std_logic_vector(23 downto 0);
signal status_reg : std_logic_vector(1 downto 0);
signal error_reg : std_logic;
PROC_REG_INFO : process begin
wait until rising_edge(CLK);
if done = '1' then
- numer_reg <= shift_reg(31 downto 8);
+ number_reg <= shift_reg(31 downto 8);
status_reg <= shift_reg(7 downto 6);
if shift_reg(36 downto 32) = "01010" and shift_reg(4 downto 0) = "10101" and xor_all(31 downto 5) = '0' then
error_reg <= '0';
PROC_RDO : process begin
wait until rising_edge(CLK);
+ WRITE_OUT <= '0';
+ FINISHED_OUT <= '0';
+ STATUSBIT_OUT <= (23 => error_reg, others => '0');
case rdostate is
when RDO_IDLE =>
- when RDO_WRITE =>
+ if TRIGGER_IN = '1' then
+ rdostate <= RDO_FINISH;
+ DATA_OUT <= error_reg & status_reg & "00000" & number_reg;
+ WRITE_OUT <= '1';
+ end if;
when RDO_FINISH =>
+ FINISHED_OUT <= '1';
+ rdostate <= RDO_IDLE;
end case;
end process;
component TDC
generic (
- CHANNEL_NUMBER : integer range 0 to 64;
+ CHANNEL_NUMBER : integer range 2 to 65;
STATUS_REG_NR : integer range 0 to 6;
CONTROL_REG_NR : integer range 0 to 6);
port (
REF_DEBUG_OUT : out std_logic_vector(31 downto 0));
end component;
-component Channel
+component Channel is
+
generic (
- CHANNEL_ID : integer range 1 to 65);
+ CHANNEL_ID : integer range 1 to 64);
port (
- RESET_WR : in std_logic;
- RESET_RD : in std_logic;
- CLK_WR : in std_logic;
- CLK_RD : in std_logic;
+ RESET_200 : in std_logic;
+ RESET_100 : in std_logic;
+ CLK_200 : in std_logic;
+ CLK_100 : in std_logic;
+--
HIT_IN : in std_logic;
READ_EN_IN : in std_logic;
FIFO_DATA_OUT : out std_logic_vector(31 downto 0);
FIFO_FULL_OUT : out std_logic;
FIFO_ALMOST_FULL_OUT : out std_logic;
COARSE_COUNTER_IN : in std_logic_vector(10 downto 0);
+--
LOST_HIT_NUMBER : out std_logic_vector(23 downto 0);
HIT_DETECT_NUMBER : out std_logic_vector(23 downto 0);
ENCODER_START_NUMBER : out std_logic_vector(23 downto 0);
FIFO_WR_NUMBER : out std_logic_vector(23 downto 0);
- Channel_DEBUG_01 : out std_logic_vector(31 downto 0));
+--
+ Channel_DEBUG : out std_logic_vector(31 downto 0)
+ );
+
+end component;
+
+
+component Channel_200 is
+
+ generic (
+ CHANNEL_ID : integer range 0 to 64);
+ port (
+ CLK_200 : in std_logic; -- 200 MHz clk
+ RESET_200 : in std_logic; -- reset sync with 200Mhz clk
+ CLK_100 : in std_logic; -- 100 MHz clk
+ RESET_100 : in std_logic; -- reset sync with 100Mhz clk
+--
+ HIT_IN : in std_logic; -- hit in
+ COARSE_CNTR_IN : in std_logic_vector(10 downto 0); -- coarse counter in
+ READ_EN_IN : in std_logic; -- read en signal
+ FIFO_DATA_OUT : out std_logic_vector(31 downto 0); -- fifo data out
+ FIFO_EMPTY_OUT : out std_logic; -- fifo empty signal
+ FIFO_FULL_OUT : out std_logic; -- fifo full signal
+ FIFO_ALMOST_FULL_OUT : out std_logic; -- fifo almost full signal
+ FIFO_WR_OUT : out std_logic; -- fifo wr en signal
+ ENCODER_START_OUT : out std_logic); -- encoder start signal
+
end component;
component ROM_FIFO