Where is the bug?

V

valentin tihomirov

FUNCTION AN( A : std_logic_vector ) RETURN std_logic_vector IS
ALIAS result : std_logic_vector ( 1 TO A'LENGTH ) IS A;
BEGIN
RETURN result; -- 00000001
END ;
constant A1 : STD_LOGIC_VECTOR (7 downto 0) := "00000001";
constant C1 : STD_LOGIC_VECTOR := AN(A1); -- UWUXUUUU


the weird value UWUXUUUU is assigned to C1 constant instead of the returned
00000001. Where is the bug?
 
J

Jonathan Bromley

FUNCTION AN( A : std_logic_vector ) RETURN std_logic_vector IS
ALIAS result : std_logic_vector ( 1 TO A'LENGTH ) IS A;
BEGIN
RETURN result; -- 00000001
END ;
constant A1 : STD_LOGIC_VECTOR (7 downto 0) := "00000001";
constant C1 : STD_LOGIC_VECTOR := AN(A1); -- UWUXUUUU


the weird value UWUXUUUU is assigned to C1 constant instead of the returned
00000001. Where is the bug?

No bug when I run it here. What's the context, and what tools?
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail:[email protected]
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
V

valentin tihomirov

Here is the full code. Do you feel anything bad what could cause garbage
assignment to r2 while XXX returns a robust vector? I gonna report the tool
vendor.

library ieee;
use ieee.std_logic_1164.all;

entity BUG is
end BUG;

architecture BUG of BUG is
subtype BYTE is std_logic_vector (7 downto 0);
function "and"(constant l, r: in STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR
is
function XXX(constant x: in STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
begin
return x; -- returns 11111
end;

-- UUUXWUUU is assigned
constant r2: STD_LOGIC_VECTOR := XXX("1111111");

begin
assert false
report "bugbug, r2 sucks"
severity note;
return l;
end;
begin

process
variable KEY: BYTE;
begin
key := "11111111" and x"01";
wait;
end process;

end BUG;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,166
Messages
2,570,907
Members
47,448
Latest member
DeanaQ4445

Latest Threads

Top