Deepansh Agrawal
Newbie level 2
- Joined
- Sep 9, 2013
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Location
- India
- Activity points
- 20
Hi all, I have been trying to debug the code for almost a week, and I have got nothing, please help me............
THE ERROR IS IN THE ASSERT PART THE ERROR IS AS SHOWN "Prefix of attribute 'left must be an array object." PLEASE HELP ME OUT ...
THE CODE IS SHOWN BELOW, THIS CODE IS FROM PEDRONI FROM CHAPTER FUNCTION AND PROCEDURES....
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.std_logic_unsigned.all;
use IEEE.NUMERIC_STD.ALL;
entity comparator is
port (a,b,c: in integer range 0 to 255;
y: out integer range 0 to 255);
end comparator;
architecture comparator of comparator is
function max (in1,in2,in3: integer) return integer is
begin
----check in-out signals-----------------------------
assert(y'left=a'left and y'left=b'left and y'left=c'left and
y'right=a'right and y'right=b'right and y'right=c'right)
report "signal sizes are not all equal!"
severity error;
----find maximum--------------------------------------
if (in1>=in2 and in1>=in3) then
return in1;
elsif (in2>=in3 and in2>=in1) then
return in2;
else
return in3;
end if;
end function;
begin
y<= max(a,b,c);--positinal mapping
end Behavioral;
THE ERROR IS IN THE ASSERT PART THE ERROR IS AS SHOWN "Prefix of attribute 'left must be an array object." PLEASE HELP ME OUT ...
THE CODE IS SHOWN BELOW, THIS CODE IS FROM PEDRONI FROM CHAPTER FUNCTION AND PROCEDURES....
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.std_logic_unsigned.all;
use IEEE.NUMERIC_STD.ALL;
entity comparator is
port (a,b,c: in integer range 0 to 255;
y: out integer range 0 to 255);
end comparator;
architecture comparator of comparator is
function max (in1,in2,in3: integer) return integer is
begin
----check in-out signals-----------------------------
assert(y'left=a'left and y'left=b'left and y'left=c'left and
y'right=a'right and y'right=b'right and y'right=c'right)
report "signal sizes are not all equal!"
severity error;
----find maximum--------------------------------------
if (in1>=in2 and in1>=in3) then
return in1;
elsif (in2>=in3 and in2>=in1) then
return in2;
else
return in3;
end if;
end function;
begin
y<= max(a,b,c);--positinal mapping
end Behavioral;