source: FPGA/FAD/FACT_FAD_test_devices_lib/drs4_pack_pkg.vhd@ 243

Last change on this file since 243 was 215, checked in by dneise, 15 years ago
initial commit (2nd part): only VHDL and UCF files were commited.
  • Property svn:executable set to *
File size: 1.4 KB
Line 
1--
2-- VHDL Package Header FACT_FAD_test_devices_lib.drs4_pack
3--
4-- Created:
5-- by - Benjamin Krumm.UNKNOWN (EEPC8)
6-- at - 10:42:57 20.01.2010
7--
8-- using Mentor Graphics HDL Designer(TM) 2008.1 (Build 17)
9--
10-- Package File Template
11--
12-- Purpose: This package defines supplemental types, subtypes,
13-- constants, and functions
14
15
16library IEEE;
17use IEEE.STD_LOGIC_1164.all;
18--use IEEE.math_real.all;
19
20package drs4_pack is
21
22 type TYPE_analog_data is array (0 to 8) of STD_LOGIC_VECTOR(12 downto 0);
23 type TYPE_analog_addr is array (0 to 8) of STD_LOGIC_VECTOR(9 downto 0);
24 type TYPE_data_ROM is array (0 to 8) of STD_LOGIC_VECTOR(12 downto 0);
25
26 type srout_state is ( SROUT_IDLE, SROUT_BIT9, SROUT_BIT8, SROUT_BIT7,
27 SROUT_BIT6, SROUT_BIT5, SROUT_BIT4, SROUT_BIT3,
28 SROUT_BIT2, SROUT_BIT1, SROUT_BIT0 );
29
30 function ld (m : POSITIVE) return natural;
31 function hexalign (m : POSITIVE) return natural;
32
33end drs4_pack;
34
35package body drs4_pack is
36
37 function ld (m : POSITIVE) return NATURAL is
38 begin
39 for n in 0 to integer'high loop
40 if (2**n >= m) then
41 return n;
42 end if;
43 end loop;
44 end function ld;
45
46 function hexalign (m : POSITIVE) return NATURAL is
47 begin
48 for n in 0 to integer'high loop
49 if (n * 4 > m) then
50 return m + ((n * 4) - m);
51 end if;
52 end loop;
53 end function hexalign;
54
55end package body;
Note: See TracBrowser for help on using the repository browser.