Skip to content

Commit 9970f4b

Browse files
committed
Fixed bug in codec generation causing some alias signatures to include the constraint for an array type parameter.
1 parent 8360eaa commit 9970f4b

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

vhdl/com/test/custom_types.vhd

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,14 @@ package custom_types_pkg is
8282
msg_type : record8_msg_type_t;
8383
addr : natural;
8484
data : natural;
85-
end record record8_t;
85+
end record record8_t; type int_2d_t is array (integer range <>, integer range <>) of integer;
86+
type record9_msg_type_t is (foo, bar);
87+
type record9_t is record
88+
msg_type : record9_msg_type_t;
89+
slv : std_logic_vector(7 downto 0);
90+
str : string(1 to 3);
91+
int_2d : int_2d_t(1 to 2, 4 downto -1);
92+
end record record9_t;
8693

8794
type array1_t is array (-2 to 2) of natural;
8895
type array2_t is array (2 downto -2) of natural;

vhdl/com/test/tb_com_codec.vhd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ begin
152152
variable rec1 : record1_t;
153153
variable rec2 : record2_t;
154154
variable rec3 : record3_t;
155+
variable rec9 : record9_t;
155156
variable p : positive := 1;
156157

157158
begin
@@ -461,6 +462,9 @@ begin
461462
deallocate(e1);
462463
deallocate(e2);
463464
deallocate(e3);
465+
elsif run("Test that records containing arrays can be encoded and decoded") then
466+
rec9 := decode(encode(record9_t'(foo, x"a5", "foo", ((1, 2, 3, 4, 5, 6), (4, 3, 2, 1, 0, -1)))));
467+
check_relation(rec9 = (foo, x"a5", "foo", ((1, 2, 3, 4, 5, 6), (4, 3, 2, 1, 0, -1))));
464468
end if;
465469
end loop;
466470

vunit/com/codec_vhdl_package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def _generate_msg_type_encoders(self): # pylint: disable=too-many-locals
200200
if identifier != 'msg_type':
201201
parameter_list.append(' constant %s : %s' % (identifier,
202202
element.subtype_indication.code))
203-
parameter_type_list.append(element.subtype_indication.code)
203+
parameter_type_list.append(element.subtype_indication.type_mark)
204204
encoding_list.append('encode(%s)' % identifier)
205205
else:
206206
encoding_list.append("encode(%s'(%s))" % (element.subtype_indication.code, value))

0 commit comments

Comments
 (0)