-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add external models to string_ptr; add byte_vector* as an alias
- Loading branch information
Showing
12 changed files
with
850 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
vunit/vhdl/data_types/src/external/external_string-body.vhd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
-- 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] | ||
|
||
package body external_string_pkg is | ||
procedure | ||
write_char( | ||
id : integer; | ||
i : integer; | ||
v : character | ||
)is begin | ||
assert false report "VHPI write_char" severity failure; | ||
end; | ||
|
||
impure function | ||
read_char( | ||
id : integer; | ||
i : integer | ||
) return character is begin | ||
assert false report "VHPI read_char" severity failure; | ||
end; | ||
|
||
impure function | ||
get_ptr( | ||
id : integer | ||
) return extstring_access_t is begin | ||
assert false report "VHPI get_string_ptr" severity failure; | ||
end; | ||
end package body; |
27 changes: 27 additions & 0 deletions
27
vunit/vhdl/data_types/src/external/external_string-novhpi.vhd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- 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 external_string_pkg is | ||
procedure | ||
write_char( | ||
id : integer; | ||
i : integer; | ||
v : character | ||
); | ||
|
||
impure function | ||
read_char( | ||
id : integer; | ||
i : integer | ||
) return character; | ||
|
||
impure function | ||
get_ptr( | ||
id : integer | ||
) return extstring_access_t; | ||
end package; |
30 changes: 30 additions & 0 deletions
30
vunit/vhdl/data_types/src/external/external_string-vhpi.vhd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- 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 external_string_pkg is | ||
procedure | ||
write_char( | ||
id : integer; | ||
i : integer; | ||
v : character | ||
); | ||
attribute foreign of write_char : procedure is "VHPIDIRECT write_char"; | ||
|
||
impure function | ||
read_char( | ||
id : integer; | ||
i : integer | ||
) return character; | ||
attribute foreign of read_char : function is "VHPIDIRECT read_char"; | ||
|
||
impure function | ||
get_ptr( | ||
id : integer | ||
) return extstring_access_t; | ||
attribute foreign of get_ptr : function is "VHPIDIRECT get_string_ptr"; | ||
end package; |
Oops, something went wrong.