From b063cbba5d32f635e741a87b6afa41377c579318 Mon Sep 17 00:00:00 2001 From: Tobias Weber Date: Thu, 3 Aug 2017 15:15:04 +0200 Subject: [PATCH] Component to convert hit address to physical pixel position. --- mupix/sources/MupixDigiConverter.vhd | 102 +++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 mupix/sources/MupixDigiConverter.vhd diff --git a/mupix/sources/MupixDigiConverter.vhd b/mupix/sources/MupixDigiConverter.vhd new file mode 100644 index 0000000..41016d2 --- /dev/null +++ b/mupix/sources/MupixDigiConverter.vhd @@ -0,0 +1,102 @@ +---------------------------------------------------------------------------------- +-- Company: University Mainz, AG Fritsch +-- Engineer: Tobias Weber +-- +-- Create Date: 20:13:03 07/03/2015 +-- Design Name: +-- Module Name: MupixDigiConverter - Behavioral +-- Project Name: +-- Target Devices: Hades Trigger and Readout Board v3 +-- Tool versions: +-- Description: Module to transform column and row address from +-- chip representation to physical column and row. +-- Dependencies: +-- +-- Revision: +-- Revision 0.01 - File Created +-- Additional Comments: +-- +---------------------------------------------------------------------------------- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; + +-- Uncomment the following library declaration if using +-- arithmetic functions with Signed or Unsigned values +use IEEE.NUMERIC_STD.ALL; + +entity MupixDigiConverter is + generic ( + address_width : integer := 6); + port ( + mupixVersionSel_in : in std_logic; + chipColumn_in : in std_logic_vector(address_width - 1 downto 0); + chipRow_in : in std_logic_vector(address_width - 1 downto 0); + physicalColumn_out : out std_logic_vector(address_width - 1 downto 0); + physicalRow_out : out std_logic_vector(address_width - 1 downto 0)); +end MupixDigiConverter; + +architecture Behavioral of MupixDigiConverter is + +signal column_Mupix4_i : unsigned(address_width - 1 downto 0) := (others => '0'); +signal row_Mupix4_i : unsigned(address_width - 1 downto 0) := ( others => '0'); +signal row_tmp_Mupix4_i : unsigned(address_width - 1 downto 0) := (others => '0'); + +signal column_Mupix6_i : unsigned(address_width - 1 downto 0) := (others => '0'); +signal row_Mupix6_i : unsigned(address_width - 1 downto 0) := ( others => '0'); +signal row_tmp_Mupix6_i : unsigned(address_width - 1 downto 0) := (others => '0'); + + +begin + + -- purpose: conversion of addresses for Mupix 4 digital part + -- type : combinational + -- inputs : chipColumn_in, chipRow_in + Mupix4Convert: process (chipColumn_in, chipRow_in, row_tmp_Mupix4_i) is + begin -- process Mupix4Convert + row_tmp_Mupix4_i <= shift_left(unsigned(chipRow_in),1); + case chipColumn_in(0) is + when '0' => + row_Mupix4_i <= row_tmp_Mupix4_i; + column_Mupix4_i <= shift_right(unsigned(chipColumn_in),1); + when '1' => + row_Mupix4_i <= row_tmp_Mupix4_i + 1; + column_Mupix4_i <= shift_right((unsigned(chipColumn_in) - 1 ),1); + when others => null; + end case; + end process Mupix4Convert; + + -- purpose: conversion of addresses for Mupix 6 digital part + -- type : combinational + -- inputs : chipColumn_in, chipRow_in, row_tmp_mupix6_i + Mupix6Convert: process (chipColumn_in, chipRow_in, row_tmp_mupix6_i) is + begin -- process Mupix6Convert + row_tmp_mupix6_i <= shift_left(unsigned(chipRow_in),1); + case chipColumn_in(0) is + when '0' => + column_Mupix6_i <= shift_right(unsigned(chipColumn_in),1); + if chipRow_in(0) = '1' then + row_Mupix6_i <= row_tmp_Mupix6_i - 2; + else + row_Mupix6_i <= row_tmp_Mupix6_i + 2; + end if; + when '1' => + row_Mupix6_i <= row_tmp_Mupix6_i + 1; + column_Mupix6_i <= shift_right((unsigned(chipColumn_in) - 1 ),1); + when others => null; + end case; + end process Mupix6Convert; + + --Multiplexing of output depending on version + with mupixVersionSel_in select + physicalRow_out <= + std_logic_vector(row_Mupix4_i) when '1', + std_logic_vector(row_Mupix6_i) when '0'; + + with mupixVersionSel_in select + physicalColumn_out <= + std_logic_vector(column_Mupix4_i) when '1', + std_logic_vector(column_Mupix6_i) when '0'; + + +end Behavioral; + -- 2.43.0