Commit c538661b authored by Tristan Gingold's avatar Tristan Gingold

vtuCore: move clean_data function, remove unused package.

parent 5cdb9ff5
----------------------------------------------------
--
-- Library Name : CTUasVTU
-- Unit Name : ctu_pckg
-- Unit Type : Package
--
------------------------------------------------------
------------------------------------------
------------------------------------------
-- Date : November 14, 2014
--
-- Author : G. Hagmann
--
-- Company : CERN BE-RF-FB
--
-- Description : CTU package
--
-- Changelog : 20161019 (1.1)
-- Modified the reduced or for proper synthesis
--
-- 20150227 (1.0)
-- Initial revision.
------------------------------------------
------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package ctu_Pckg is
constant C_FirmwareVersionInt : integer := 20170306;
-- Firmware and Memory Map version codes
constant C_FirmwareVersion : Std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(C_FirmwareVersionInt,32));
-- NVMem data size in 16b words
constant c_nvMemCalibDataSize : Std_logic_vector(13 downto 0) := "00"& X"004"; -- 4 words: rfPowerGain, rfPowerOffs, sync1IDelay, driveOutODelay
-- Function or_reduce
function or_reduce( V: std_logic_vector ) return std_logic;
-- Function clean_data
function clean_data( V: std_logic_vector(7 downto 0) ) return std_logic_vector;
end;
package body ctu_pckg is
-- Function or_reduce
function or_reduce( V: std_logic_vector ) return std_logic is
variable result: std_logic;
begin
result := '0';
for i in V'range loop
result := result OR V(i);
end loop;
return result;
end or_reduce;
-- Function clean_data
-- Combinatorial. Search for the first '1' and removes other '1's.
function clean_data( V: std_logic_vector(7 downto 0) ) return std_logic_vector is
begin
if V(7)='1' then
return "10000000";
elsif V(6)='1' then
return "01000000";
elsif V(5)='1' then
return "00100000";
elsif V(4)='1' then
return "00010000";
elsif V(3)='1' then
return "00001000";
elsif V(2)='1' then
return "00000100";
elsif V(1)='1' then
return "00000010";
elsif V(0)='1' then
return "00000001";
else
return "00000000";
end if;
end clean_data;
end;
----------------------------------------------------
--
-- Library Name : CTUasVTU
......@@ -519,7 +432,6 @@ end;
library ieee;
use ieee.STD_LOGIC_1164.all;
use ieee.NUMERIC_STD.all;
use work.ctu_pckg.all;
entity vtuDataShifter is
generic (N : INTEGER := 16;
......@@ -572,6 +484,31 @@ architecture vtuDataShifter of vtuDataShifter is
Q : out std_logic
);
end component;
-- Function clean_data
-- Combinatorial. Search for the first '1' and removes other '1's.
function clean_data( V: std_logic_vector(7 downto 0) ) return std_logic_vector is
begin
if V(7)='1' then
return "10000000";
elsif V(6)='1' then
return "01000000";
elsif V(5)='1' then
return "00100000";
elsif V(4)='1' then
return "00010000";
elsif V(3)='1' then
return "00001000";
elsif V(2)='1' then
return "00000100";
elsif V(1)='1' then
return "00000010";
elsif V(0)='1' then
return "00000001";
else
return "00000000";
end if;
end clean_data;
begin
-- Detect the sync pulse.
b_sync_pulse: block
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment