Z
Zhi
Guest
error:" HexImage can not have such operands in this context.
IN mode Formal VALUE of write with no default value must be
associated with an actual value.
DecImage can not have such operands in this context.
IN mode Formal VALUE of write with no default value must be
associated with an actual value."
<HexImage> and <DecImage> are defined in the package "Image_Pkg." ,
can transfer 'signed' to 'string'.
--===========================================
function HexImage(In_Image : Signed) return String is
begin
return HexImage(Image(In_Image));
end HexImage;
--
function Image(In_Image : Signed) return String is
begin
return Image(Std_Logic_Vector(In_Image));
end Image;
--
function Image(In_Image : Std_Logic_Vector) return String is
variable L : Line; -- access type
variable W : String(1 to In_Image'length) := (others => ' ');
begin
IEEE.Std_Logic_TextIO.WRITE(L, In_Image);
W(L.all'range) := L.all;
Deallocate(L);
return W;
end Image;
--============================================
main program
--==================================
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_textio.all;
use IEEE.Numeric_Std.all;
use std.textio.all;
library unisim;
use unisim.vcomponents.all;
--=======================================
library work;
use work.complex_pkg.all;
use work.Image_Pkg.all;
--=======================================
entity Complex is
end Complex;
--=======================================
architecture Complex_a of Complex is
signal A_s : A2x2C32_Typ;
signal B_s : A2x2C32_Typ;
begin -- Complex_a
Complex_Lbl : process
variable A : A2x2C32_Typ :=
( 1 => ( R => conv_signed(1,32),
I => conv_signed(2,32)),
2 => ( R => conv_signed(3,32),
I => conv_signed(4,32)),
3 => ( R => conv_signed(5,32),
I => conv_signed(6,32)),
4 => ( R => conv_signed(7,32),
I => conv_signed(8,32)));
variable B : A2x2C32_Typ :=
( 1 => ( R => conv_signed(10,32),
I => conv_signed(11,32)),
2 => ( R => conv_signed(12,32),
I => conv_signed(13,32)),
3 => ( R => conv_signed(14,32),
I => conv_signed(15,32)),
4 => ( R => conv_signed(16,32),
I => conv_signed(17,32)));
variable L:line;
file Result_f :text open write_mode is "result.txt";
--============================================
begin
write(L, string'("Multiplication"));
Writeline(Result_f, L);
write(L, "A.r=" & HexImage(A(1).R) & "A.I=" & HexImage(A(1).I));
writeline(Result_f,L);
write(L, "A.r ="& DecImage(A(1).R) & "A.I=" & DecImage(A(1).I));
writeline(Result_f,L);
write(L, "B.r=" & HexImage(B(1).R) & "B.I=" & HexImage(B(1).I));
writeline(Result_f,L);
write(L, "B.r=" & DecImage(B(1).R) & "B.I ="& DecImage(B(1).I));
writeline(Result_f,L);
wait;
end process;
end Complex_a ;
A(1).R/I actually is 'signed', why here has such an error information?
pleas help.
IN mode Formal VALUE of write with no default value must be
associated with an actual value.
DecImage can not have such operands in this context.
IN mode Formal VALUE of write with no default value must be
associated with an actual value."
<HexImage> and <DecImage> are defined in the package "Image_Pkg." ,
can transfer 'signed' to 'string'.
--===========================================
function HexImage(In_Image : Signed) return String is
begin
return HexImage(Image(In_Image));
end HexImage;
--
function Image(In_Image : Signed) return String is
begin
return Image(Std_Logic_Vector(In_Image));
end Image;
--
function Image(In_Image : Std_Logic_Vector) return String is
variable L : Line; -- access type
variable W : String(1 to In_Image'length) := (others => ' ');
begin
IEEE.Std_Logic_TextIO.WRITE(L, In_Image);
W(L.all'range) := L.all;
Deallocate(L);
return W;
end Image;
--============================================
main program
--==================================
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_textio.all;
use IEEE.Numeric_Std.all;
use std.textio.all;
library unisim;
use unisim.vcomponents.all;
--=======================================
library work;
use work.complex_pkg.all;
use work.Image_Pkg.all;
--=======================================
entity Complex is
end Complex;
--=======================================
architecture Complex_a of Complex is
signal A_s : A2x2C32_Typ;
signal B_s : A2x2C32_Typ;
begin -- Complex_a
Complex_Lbl : process
variable A : A2x2C32_Typ :=
( 1 => ( R => conv_signed(1,32),
I => conv_signed(2,32)),
2 => ( R => conv_signed(3,32),
I => conv_signed(4,32)),
3 => ( R => conv_signed(5,32),
I => conv_signed(6,32)),
4 => ( R => conv_signed(7,32),
I => conv_signed(8,32)));
variable B : A2x2C32_Typ :=
( 1 => ( R => conv_signed(10,32),
I => conv_signed(11,32)),
2 => ( R => conv_signed(12,32),
I => conv_signed(13,32)),
3 => ( R => conv_signed(14,32),
I => conv_signed(15,32)),
4 => ( R => conv_signed(16,32),
I => conv_signed(17,32)));
variable L:line;
file Result_f :text open write_mode is "result.txt";
--============================================
begin
write(L, string'("Multiplication"));
Writeline(Result_f, L);
write(L, "A.r=" & HexImage(A(1).R) & "A.I=" & HexImage(A(1).I));
writeline(Result_f,L);
write(L, "A.r ="& DecImage(A(1).R) & "A.I=" & DecImage(A(1).I));
writeline(Result_f,L);
write(L, "B.r=" & HexImage(B(1).R) & "B.I=" & HexImage(B(1).I));
writeline(Result_f,L);
write(L, "B.r=" & DecImage(B(1).R) & "B.I ="& DecImage(B(1).I));
writeline(Result_f,L);
wait;
end process;
end Complex_a ;
A(1).R/I actually is 'signed', why here has such an error information?
pleas help.