------------------------------------------------------------------------------- -- Title : Y Position Projection Unit -- Project : Prototype implementation of the GTU of the Alice TRD Experiment ------------------------------------------------------------------------------- -- File : proj_y.vhd -- Author : Jan de Cuveland -- Company : -- Last update: 2003/06/03 -- Platform : ------------------------------------------------------------------------------- -- This is a prototype implementation of the Global Tracking Unit (GTU) -- of the Alice TRD detector. ------------------------------------------------------------------------------- -- Description: This unit projectes the y coordinate to a common plane ------------------------------------------------------------------------------- -- Revisions : -- Date Version Author Description -- 2003/01/21 1.0 cuveland Created ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use work.gtu_types.all; ------------------------------------------------------------------------------- entity proj_y is generic ( plane : integer); -- 0..5 port ( d : in signed(deflen_width-1 downto 0); -- deflection length y : in signed(ypos_width-1 downto 0); -- y position end_sig : in std_logic; -- end flag y_out : out signed(proj_ypos_width-1 downto 0)); -- projected y position end proj_y; ------------------------------------------------------------------------------- architecture default of proj_y is constant excess_bits : integer := 2; function const ( constant plane : integer) return signed is variable r : real; variable i : integer; begin r := - (radius(plane) + thickness - rmid) * deflen_resolution / (ypos_resolution * thickness); i := integer(r * real(2 ** excess_bits)); return conv_signed(i, ypos_width+excess_bits-deflen_width); end const; -- constant factor constant c : signed(ypos_width+excess_bits-deflen_width-1 downto 0) := const(plane); -- projected deflection length signal p : signed(ypos_width-1+excess_bits downto 0); -- projected deflection length [ypos_resolution] signal dy : signed(ypos_width-1 downto 0); -- projected y position [ypos_resolution] signal s : signed(ypos_width-1 downto 0); -- projected y position [proj_ypos_resolution / 2] signal s_round : signed(proj_ypos_width downto 0); begin -- default p <= d * c; dy <= p(p'high downto excess_bits); -- [ypos_resolution] s <= y + dy; -- [ypos_resolution] s_round <= s(s'high downto proj_ypos_bit_decrease - 1) + 1; -- [proj_ypos_resolution / 2] y_out <= s_round(s_round'high downto 1) -- [proj_ypos_resolution] when end_sig = '0' else proj_ypos_end; end default;