Skip to content
Snippets Groups Projects
Commit dc9ca678 authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Add to_sl(), to_int(), c_tree_delay_len.

parent bdcc3563
No related branches found
No related tags found
1 merge request!415Resolve L2SDP-1005
...@@ -86,6 +86,7 @@ package common_pkg is ...@@ -86,6 +86,7 @@ package common_pkg is
constant c_eps : real := 1.0e-20; -- add small epsilon value to avoid 1/0 and log(0), 1e-20 < 1/2**64 constant c_eps : real := 1.0e-20; -- add small epsilon value to avoid 1/0 and log(0), 1e-20 < 1/2**64
-- FF, block RAM, FIFO -- FF, block RAM, FIFO
constant c_tree_delay_len : natural := 10; -- reset clock tree pipelining to facilitate FF duplication by synthesis tool
constant c_meta_delay_len : natural := 3; -- default nof flipflops (FF) in meta stability recovery delay line (e.g. for clock domain crossing) constant c_meta_delay_len : natural := 3; -- default nof flipflops (FF) in meta stability recovery delay line (e.g. for clock domain crossing)
constant c_meta_fifo_depth : natural := 16; -- default use 16 word deep FIFO to cross clock domain, typically > 2*c_meta_delay_len or >~ 8 is enough constant c_meta_fifo_depth : natural := 16; -- default use 16 word deep FIFO to cross clock domain, typically > 2*c_meta_delay_len or >~ 8 is enough
...@@ -215,6 +216,8 @@ package common_pkg is ...@@ -215,6 +216,8 @@ package common_pkg is
function sl( n: in std_logic_vector) return std_logic; -- 1 element standard logic vector to standard logic function sl( n: in std_logic_vector) return std_logic; -- 1 element standard logic vector to standard logic
function to_sl( n: in boolean) return std_logic; -- if TRUE then return '1' else '0' function to_sl( n: in boolean) return std_logic; -- if TRUE then return '1' else '0'
function to_sl( n: in integer) return std_logic; -- if 0 then return '0' else '1'
function to_int( n: in std_logic) return integer; -- if '1' or 'H' then return '1' else '0'
function to_bool(n: in std_logic) return boolean; -- if '1' or 'H' then return TRUE else FALSE function to_bool(n: in std_logic) return boolean; -- if '1' or 'H' then return TRUE else FALSE
function to_bool(n: in integer) return boolean; -- if 0 then return FALSE else TRUE function to_bool(n: in integer) return boolean; -- if 0 then return FALSE else TRUE
...@@ -777,6 +780,24 @@ package body common_pkg is ...@@ -777,6 +780,24 @@ package body common_pkg is
end if; end if;
end; end;
function to_sl(n: in integer) return std_logic is
begin
if n = 0 then
return '0';
else
return '1';
end if;
end;
function to_int(n: in std_logic) return integer is
begin
if n = '1' or n = 'H' then
return 1;
else
return 0;
end if;
end;
function to_bool(n: in std_logic) return boolean is function to_bool(n: in std_logic) return boolean is
begin begin
return n = '1' or n = 'H'; return n = '1' or n = 'H';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment