Skip to content

Commit

Permalink
add byte_vector_* as an alias of string_*
Browse files Browse the repository at this point in the history
  • Loading branch information
umarcor committed Jun 3, 2019
1 parent 6597acd commit dc44958
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
37 changes: 37 additions & 0 deletions vunit/vhdl/data_types/src/byte_vector_ptr_pkg.vhd
Original file line number Diff line number Diff line change
@@ -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 [email protected]
--
-- 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;
2 changes: 2 additions & 0 deletions vunit/vhdl/data_types/src/data_types_context.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 17 additions & 0 deletions vunit/vhdl/data_types/src/types/byte_vector_pkg.vhd
Original file line number Diff line number Diff line change
@@ -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 [email protected]

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;

0 comments on commit dc44958

Please sign in to comment.