From dc44958b8d3643448fdd0043652ff1533842acfd Mon Sep 17 00:00:00 2001 From: umarcor Date: Mon, 3 Jun 2019 21:52:18 +0200 Subject: [PATCH] add byte_vector_* as an alias of string_* --- .../data_types/src/byte_vector_ptr_pkg.vhd | 37 +++++++++++++++++++ .../data_types/src/data_types_context.vhd | 2 + .../data_types/src/types/byte_vector_pkg.vhd | 17 +++++++++ 3 files changed, 56 insertions(+) create mode 100644 vunit/vhdl/data_types/src/byte_vector_ptr_pkg.vhd create mode 100644 vunit/vhdl/data_types/src/types/byte_vector_pkg.vhd diff --git a/vunit/vhdl/data_types/src/byte_vector_ptr_pkg.vhd b/vunit/vhdl/data_types/src/byte_vector_ptr_pkg.vhd new file mode 100644 index 0000000000..c2670d50fb --- /dev/null +++ b/vunit/vhdl/data_types/src/byte_vector_ptr_pkg.vhd @@ -0,0 +1,37 @@ +-- This Source Code Form is subject to the terms of the Mozilla Public +-- License, v. 2.0. If a copy of the MPL was not distributed with this file, +-- You can obtain one at http://mozilla.org/MPL/2.0/. +-- +-- Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com +-- +-- The purpose of this package is to provide a byte vector access type (pointer) +-- that can itself be used in arrays and returned from functions unlike a +-- real access type. This is achieved by letting the actual value be a handle +-- into a singleton datastructure of string access types. +-- + +use work.byte_vector_pkg.all; +use work.string_ptr_pkg.all; + +package byte_vector_ptr_pkg is + + alias byte_vector_ptr_t is string_ptr_t; + alias null_byte_vector_ptr is null_string_ptr; + + alias new_byte_vector_ptr is new_string_ptr[natural, integer, val_t return ptr_t]; + alias new_byte_vector_ptr is new_string_ptr[natural, integer, natural return ptr_t]; + alias new_byte_vector_ptr is new_string_ptr[string, integer return ptr_t]; + + alias is_external is is_external[ptr_t return boolean]; + alias deallocate is deallocate[ptr_t]; + alias length is length[ptr_t return integer]; + alias set is set[ptr_t, natural, natural]; + alias get is get[ptr_t, natural return natural]; + alias reallocate is reallocate[ptr_t, natural, natural]; + alias resize is resize[ptr_t, natural, natural, natural]; + +-- alias write_byte is write_char; +-- alias read_byte is read_char; +-- alias byte_vector_access_t is string_access_t; + +end package; diff --git a/vunit/vhdl/data_types/src/data_types_context.vhd b/vunit/vhdl/data_types/src/data_types_context.vhd index b31fa7602e..dda802938f 100644 --- a/vunit/vhdl/data_types/src/data_types_context.vhd +++ b/vunit/vhdl/data_types/src/data_types_context.vhd @@ -6,6 +6,8 @@ context data_types_context is library vunit_lib; + use vunit_lib.byte_vector_pkg.all; + use vunit_lib.byte_vector_ptr_pkg.all; use vunit_lib.integer_vector_ptr_pkg.all; use vunit_lib.integer_vector_ptr_pool_pkg.all; use vunit_lib.integer_array_pkg.all; diff --git a/vunit/vhdl/data_types/src/types/byte_vector_pkg.vhd b/vunit/vhdl/data_types/src/types/byte_vector_pkg.vhd new file mode 100644 index 0000000000..c2ed095ee5 --- /dev/null +++ b/vunit/vhdl/data_types/src/types/byte_vector_pkg.vhd @@ -0,0 +1,17 @@ +-- This Source Code Form is subject to the terms of the Mozilla Public +-- License, v. 2.0. If a copy of the MPL was not distributed with this file, +-- You can obtain one at http://mozilla.org/MPL/2.0/. +-- +-- Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com + +use work.string_pkg.all; + +package byte_vector_pkg is + alias byte_vector_access_t is string_access_t; + alias byte_vector_access_vector_t is string_access_vector_t; + alias byte_vector_access_vector_access_t is string_access_vector_access_t; + + alias extbytevec_access_t is extstring_access_t; + alias extbytevec_access_vector_t is extstring_access_vector_t; + alias extbytevec_access_vector_access_t is extstring_access_vector_access_t; +end package;