From 53023c205537e8f4da07f01d8ecf0e9edbcb94a6 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 14 Oct 2013 15:05:12 +0100 Subject: fish --- sdram_util.vhd | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 sdram_util.vhd (limited to 'sdram_util.vhd') diff --git a/sdram_util.vhd b/sdram_util.vhd new file mode 100644 index 0000000..23c1d1e --- /dev/null +++ b/sdram_util.vhd @@ -0,0 +1,49 @@ +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.NUMERIC_STD.ALL; + +package sdram_util is + +subtype uint3_t is integer range 0 to 7; +subtype uint4_t is integer range 0 to 15; +subtype uint13_t is integer range 0 to 8191; +subtype cs_n_t is std_logic_vector(0 downto 0); +subtype addr_t is std_logic_vector(23 downto 0); +subtype data_t is std_logic_vector(15 downto 0); +subtype dqm_t is std_logic_vector(1 downto 0); + + + function b2l_ah(constant val : in boolean) return std_logic; + function l2b_ah(constant val : in std_logic) return boolean; + function l2b_al(constant val : in std_logic) return boolean; + +end package; + + +package body sdram_util is + + -- convert boolean to active high logic + function b2l_ah(constant val : in boolean) return std_logic is begin + if val then + return '1'; + else + return '0'; + end if; + end function; + + + -- convert active high logic to boolean value + function l2b_ah(constant val : in std_logic) return boolean is begin + return val='1'; + end function; + + function l2b_al(constant val : in std_logic) return boolean is begin + return val='0'; + end function; + +end package body; + + + + + -- cgit v1.2.3