Skip to content

Commit 7a87834

Browse files
committed
replace type byte_vector_ptr_t with natural; add separate array for eptrs
1 parent 9b78114 commit 7a87834

6 files changed

Lines changed: 236 additions & 261 deletions

File tree

examples/vhdl/external_buffer/src/test/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ uint8_t read_byte(uint8_t id, uint32_t i) {
2323

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

26-
const uint32_t length = 5;
26+
const uint32_t length = 3;
2727

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

3434
int i;
3535
for(i=0; i<length; i++) {
36-
D[0][i] = (i+1)*11;
36+
D[0][i] = (i+1)*10;
3737
}
3838

3939
for(i=0; i<3*length; i++) {

examples/vhdl/external_buffer/src/test/tb_external_buffer.vhd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ end entity;
2020

2121
architecture tb of tb_external_buffer is
2222

23-
constant block_len : natural := 5;
23+
constant block_len : natural := 3;
2424

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

2828
begin
2929

@@ -36,11 +36,11 @@ begin
3636
info("Init test");
3737
for x in 0 to block_len-1 loop
3838
val := get(ebuf, x); --report "E get(" & to_string(x) & "): " & to_string(val) severity note;
39-
set(ebuf, block_len+x, val); --report "E set(" & to_string(5+x) & "): " & to_string(val) severity note;
39+
set(ebuf, block_len+x, val+1); --report "E set(" & to_string(5+x) & "): " & to_string(val) severity note;
4040
end loop;
4141
for x in block_len to 2*block_len-1 loop
4242
val := get(abuf, x); --report "A get(" & to_string(x) & "): " & to_string(val) severity note;
43-
set(abuf, block_len+x, val); --report "A set(" & to_string(5+x) & "): " & to_string(val) severity note;
43+
set(abuf, block_len+x, val+2); --report "A set(" & to_string(5+x) & "): " & to_string(val) severity note;
4444
end loop;
4545
info("End test");
4646
end if;

vunit/vhdl/data_types/src/byte_vector_pkg.vhd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package byte_vector_pkg is
99
type byte_vector_access_vector_t is array (natural range <>) of byte_vector_access_t;
1010
type byte_vector_access_vector_access_t is access byte_vector_access_vector_t;
1111

12-
type extbuf_t is array(integer range 0 to integer'high) of character;
13-
type extbuf_access_t is access extbuf_t;
12+
type extbuf_access_t is access string(1 to integer'high);
13+
type extbuf_access_vector_t is array (natural range <>) of extbuf_access_t;
14+
type extbuf_access_vector_access_t is access extbuf_access_vector_t;
1415
end package;

0 commit comments

Comments
 (0)