Skip to content

Commit

Permalink
replace type byte_vector_ptr_t with natural; add separate array for e…
Browse files Browse the repository at this point in the history
…ptrs
  • Loading branch information
umarcor committed Apr 16, 2019
1 parent 9b78114 commit 3ab1f43
Show file tree
Hide file tree
Showing 7 changed files with 238 additions and 263 deletions.
4 changes: 2 additions & 2 deletions examples/vhdl/external_buffer/src/test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ uint8_t read_byte(uint8_t id, uint32_t i) {

int main(int argc, char **argv) {

const uint32_t length = 5;
const uint32_t length = 3;

D[0] = (uint8_t *) malloc(3*length*sizeof(uint8_t));
if ( D[0] == NULL ) {
Expand All @@ -33,7 +33,7 @@ int main(int argc, char **argv) {

int i;
for(i=0; i<length; i++) {
D[0][i] = (i+1)*11;
D[0][i] = (i+1)*10;
}

for(i=0; i<3*length; i++) {
Expand Down
10 changes: 5 additions & 5 deletions examples/vhdl/external_buffer/src/test/tb_external_buffer.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ end entity;

architecture tb of tb_external_buffer is

constant block_len : natural := 5;
constant block_len : natural := 3;

constant ebuf: byte_vector_ptr_t:= new_byte_vector_ptr( 1024, 0, -1); -- external through VHPIDIRECT functions 'read_byte' and 'write_byte'
constant abuf: byte_vector_ptr_t:= new_byte_vector_ptr( 1024, 0, 1); -- external through access (required VHPIDIRECT function 'get_addr')
constant ebuf: natural := new_byte_vector( 1024, 0, -1); -- external through VHPIDIRECT functions 'read_byte' and 'write_byte'
constant abuf: natural := new_byte_vector( 1024, 0, 1); -- external through access (required VHPIDIRECT function 'get_addr')

begin

Expand All @@ -36,11 +36,11 @@ begin
info("Init test");
for x in 0 to block_len-1 loop
val := get(ebuf, x); --report "E get(" & to_string(x) & "): " & to_string(val) severity note;
set(ebuf, block_len+x, val); --report "E set(" & to_string(5+x) & "): " & to_string(val) severity note;
set(ebuf, block_len+x, val+1); --report "E set(" & to_string(5+x) & "): " & to_string(val) severity note;
end loop;
for x in block_len to 2*block_len-1 loop
val := get(abuf, x); --report "A get(" & to_string(x) & "): " & to_string(val) severity note;
set(abuf, block_len+x, val); --report "A set(" & to_string(5+x) & "): " & to_string(val) severity note;
set(abuf, block_len+x, val+2); --report "A set(" & to_string(5+x) & "): " & to_string(val) severity note;
end loop;
info("End test");
end if;
Expand Down
4 changes: 2 additions & 2 deletions vunit/test/acceptance/test_external_run_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from vunit import ROOT
from vunit.builtins import VHDL_PATH
from vunit.test.common import has_simulator, check_report, simulator_is
from vunit.ghdl_interface import GHDLInterface
from vunit.simulator_interface import SimulatorInterface


def simulator_supports_verilog():
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_vhdl_axi_dma_example_project(self):
self.check(join(ROOT, "examples", "vhdl", "axi_dma", "run.py"))

@unittest.skipIf(
GHDLInterface.supports_vhpi(),
SimulatorInterface.supports_vhpi(),
"This simulator/backend does not support interfacing with external C code"
)
def test_vhdl_external_buffer_project(self):
Expand Down
5 changes: 3 additions & 2 deletions vunit/vhdl/data_types/src/byte_vector_pkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package byte_vector_pkg is
type byte_vector_access_vector_t is array (natural range <>) of byte_vector_access_t;
type byte_vector_access_vector_access_t is access byte_vector_access_vector_t;

type extbuf_t is array(integer range 0 to integer'high) of character;
type extbuf_access_t is access extbuf_t;
type extbuf_access_t is access string(1 to integer'high);
type extbuf_access_vector_t is array (natural range <>) of extbuf_access_t;
type extbuf_access_vector_access_t is access extbuf_access_vector_t;
end package;
Loading

0 comments on commit 3ab1f43

Please sign in to comment.