Protected types not quite working
I get warnings about unused variables (on the line variable log:ttest) if I have protected type which is only accessed through it's "methods":
package p_prottest is type ttest is protected procedure init (prefix_in : in string := ""); procedure log(s : in string); end protected ttest; end package p_prottest; use std.textio.all; package body p_prottest is type ttest is protected body type t_stringptr is access string; variable prefix : t_stringptr; procedure init ( prefix_in : in string := "" ) is begin -- procedure init if prefix_in /= "" then prefix := new string(1 to prefix_in'length+1); prefix.all := prefix_in & ":"; else prefix := new string(1 to 1); prefix(1) := NUL; end if; end procedure init; procedure log (s : in string) is variable msg_line : line; begin write(msg_line, time'image(now) & " :", right, 18); write(msg_line, prefix.all & s); writeline(output, msg_line); deallocate(msg_line); end procedure log; end protected body; end package body p_prottest; use work.p_prottest.all; entity tb is end entity tb; architecture test of tb is begin p1: process is variable log : ttest; -- warning flagged here! begin -- process p1 log.init("tb_logger"); log.log("PASS: Should see this "); wait; end process p1; end architecture;
- Forums:
Thanks
Thanks for reporting, Martin. I've logged this as ticket:918 and we'll look in to fixing this.
kind regards
-- Philippe
ticket:918 fixed in October
ticket:918 fixed in October 2010.
Post new comment