Line 1... |
Line 1... |
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
--
|
--
|
-- Copyright (C) 2012
|
-- Copyright (C) 2019
|
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
|
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
|
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
|
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
|
--
|
--
|
-- This program is free software: you can redistribute it and/or modify
|
-- This program is free software: you can redistribute it and/or modify
|
-- it under the terms of the GNU General Public License as published by
|
-- it under the terms of the GNU General Public License as published by
|
Line 17... |
Line 17... |
-- You should have received a copy of the GNU General Public License
|
-- You should have received a copy of the GNU General Public License
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
--
|
--
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
|
|
|
-- Author:
|
|
-- . Daniel van der Schuur
|
|
-- Purpose:
|
|
-- . Collection of commonly used string funtions
|
|
-- Interface:
|
|
-- . [n/a]
|
|
-- Description:
|
|
-- . None
|
|
|
LIBRARY IEEE;
|
LIBRARY IEEE;
|
USE IEEE.STD_LOGIC_1164.ALL;
|
USE IEEE.STD_LOGIC_1164.ALL;
|
USE IEEE.NUMERIC_STD.ALL;
|
USE IEEE.NUMERIC_STD.ALL;
|
USE STD.TEXTIO.ALL;
|
USE STD.TEXTIO.ALL;
|
USE IEEE.STD_LOGIC_TEXTIO.ALL;
|
USE IEEE.STD_LOGIC_TEXTIO.ALL;
|
USE work.common_pkg.ALL;
|
USE common_pkg_lib.common_pkg.ALL;
|
|
|
PACKAGE common_str_pkg IS
|
PACKAGE common_str_pkg IS
|
|
|
TYPE t_str_4_arr IS ARRAY (INTEGER RANGE <>) OF STRING(1 TO 4);
|
TYPE t_str_4_arr IS ARRAY (INTEGER RANGE <>) OF STRING(1 TO 4);
|
|
|
Line 201... |
Line 210... |
END CASE;
|
END CASE;
|
RETURN v_result;
|
RETURN v_result;
|
END hex_nibble_to_slv;
|
END hex_nibble_to_slv;
|
|
|
FUNCTION int_to_str(int: INTEGER) RETURN STRING IS
|
FUNCTION int_to_str(int: INTEGER) RETURN STRING IS
|
-- CONSTANT c_max_len_int : NATURAL := 20;
|
|
VARIABLE v_line: LINE;
|
VARIABLE v_line: LINE;
|
VARIABLE v_str: STRING(1 TO nof_digits_int(int)):= (OTHERS => ' ');
|
VARIABLE v_str: STRING(1 TO nof_digits_int(int)):= (OTHERS => ' ');
|
BEGIN
|
BEGIN
|
STD.TEXTIO.WRITE(v_line, int);
|
STD.TEXTIO.WRITE(v_line, int);
|
v_str(v_line.ALL'RANGE) := v_line.ALL;
|
v_str(v_line.ALL'RANGE) := v_line.ALL;
|