Skip to content

Commit 64c8587

Browse files
committed
Testbench fix to workaround GHDL bug.
1 parent e079f77 commit 64c8587

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

vunit/vhdl/com/test/tb_com_codec.vhd

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ begin
7777

7878
variable msg, msg2 : msg_t;
7979

80+
-- GHDL fails on "Test that custom record type can be encoded and decoded"
81+
-- unless we define the lp character position as a constant rather than using
82+
-- the expression inline.
83+
constant lp_pos : natural := character'pos(lp);
84+
8085
begin
8186
test_runner_setup(runner, runner_cfg);
8287

@@ -93,8 +98,8 @@ begin
9398
push_enum1_t(msg, red);
9499
check_relation(pop_enum1_t(msg) = red, result("for pop_enum1"));
95100
elsif run("Test that custom record type can be encoded and decoded") then
96-
rec1 := decode(encode_record1_t((character'pos(lp), -1, -2, -3)));
97-
check_relation(rec1 = (character'pos(lp), -1, -2, -3));
101+
rec1 := decode(encode_record1_t((lp_pos, -1, -2, -3)));
102+
check_relation(rec1 = (lp_pos, -1, -2, -3));
98103

99104
rec2 := decode(encode_record2_t((command, 1, -1, -2, -3, '1')));
100105
check_relation(rec2 = (command, 1, -1, -2, -3, '1'));

0 commit comments

Comments
 (0)