Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - function declaration not found

 
Thread Tools Search this Thread
Old 02-24-2008, 05:25 PM   #1
Default function declaration not found


Here is a package below. It cannot even pass the Syntax check. Error:
" In Complex_Pkg. function + declared in the PackageDeclaration not
found.
In Complex_Pkg. function - declared in the PackageDeclaration not
found."
I don't know what is wrong with the function "+/-" declaration.
Please help!


library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;

package Complex_Pkg is
constant length_c: integer :=32;
type Complex32_Typ is record
R : signed(length_c-1 downto 0);
I : signed(length_c-1 downto 0);
end record;

type Complex64_Typ is record
R : signed(2*length_c-1 downto 0);
I : signed(2*length_c-1 downto 0);
end record;

type A2x2C32_Typ is array(1 to 4) of Complex32_Typ;
type A2x2C64_Typ is array(1 to 4) of Complex64_Typ;

function "+" (A : Complex32_Typ;
B : Complex32_Typ) return Complex32_Typ;

function "-" (A : Complex32_Typ;
B : Complex32_Typ) return Complex32_Typ;

function "+" (A : Complex64_Typ;
B : Complex64_Typ) return Complex64_Typ;

function "-" (A : Complex64_Typ;
B : Complex64_Typ) return
Complex64_Typ;

function "*" (A : Complex32_Typ;
B : Complex32_TYp) return Complex64_Typ;

function "*" (A : A2x2C32_Typ;
B : A2x2C32_Typ) return A2x2C64_Typ;

function "+" (A : A2x2C32_Typ;
B : A2x2C32_Typ) return A2x2C32_Typ;

function "-" (A : A2x2C32_Typ;
B : A2x2C32_Typ) return
A2x2C32_Typ;

end Complex_Pkg;
--
================================================== ====================
package body Complex_Pkg is


function "+" (A: Complex32_Typ;
B: Complex32_Typ) return Complex32_Typ is
variable V: Complex32_Typ;
begin
V.R :=A.R + B.R;
V.I :=A.I + B.I;
return V;
end "+";

function "-" (A: Complex32_Typ;
B: Complex32_Typ) return Complex32_Typ is
variable V: Complex32_Typ;
begin
V.R := A.R - B.R;
V.I := A.I - B.I;
return V;
end "-";

function "*" (A: Complex32_Typ;
B: Complex32_Typ) return Complex64_Typ is
variable V: Complex64_Typ;
begin
V.R :=(A.R * B.R) - (A.I * B.I);
V.I :=(A.I * B.R) + (A.R * B.I);
return V;
end "*";

function "*"(A: A2x2C32_Typ;
B: A2x2C32_Typ) return A2x2C64_Typ is
variable V :A2x2C64_Typ;
begin
V(1) :=(A(1) * B(1)) + (A(2) * B(3));
V(2) :=(A(1) * B(2)) + (A(2) * B(4));
V(3) :=(A(3) * B(1)) + (A(4) * B(3));
V(4) :=(A(3) * B(2)) + (A(4) * B(4));
return V;
end "*";

function "+" (A : A2x2C32_Typ;
B : A2x2C32_Typ) return A2x2C32_Typ is
variable V: A2x2C32_Typ;
begin
for I in A'range loop
V(I) :=A(I) + B(I);
end loop;
return V;
end "+";


function "-" (A: A2x2C32_Typ;
B: A2x2C32_Typ) return A2x2C32_Typ is
variable V: A2x2C32_Typ;
begin
for I in A'range loop
V(I) :=A(I) - B(I);
end loop;
return V;
end "-";
end Complex_Pkg;


Zhi
  Reply With Quote
Old 02-24-2008, 06:08 PM   #2
KJ
 
Posts: n/a
Default Re: function declaration not found

"Zhi" <> wrote in message
news:250d541a-46cd-42de-82bf-...
> Here is a package below. It cannot even pass the Syntax check. Error:
> " In Complex_Pkg. function + declared in the PackageDeclaration not
> found.
> In Complex_Pkg. function - declared in the PackageDeclaration not
> found."
> I don't know what is wrong with the function "+/-" declaration.
> Please help!
>

You've declared two "+" functions in your package that work with different
types (that's OK) but in the package body I only see one of those functions
actually defined (the one that works with 'Complex64_Typ' is missing). Make
sure that every function that you declare in the package gets defined in the
package body.

Kevin Jennings




KJ
  Reply With Quote
Old 02-24-2008, 06:12 PM   #3
Mike Treseler
 
Posts: n/a
Default Re: function declaration not found
Zhi wrote:
> Here is a package below. It cannot even pass the Syntax check.


vcom -2002 -quiet -work work complex_pkg.vhd
** Error: complex_pkg.vhd(109):
Subprogram '+' declared at line 27 has no body.
** Error: complex_pkg.vhd(109):
Subprogram '-' declared at line 30 has no body.

The return types in the body don't match those in the package.

-- Mike Treseler



Mike Treseler
  Reply With Quote
Old 02-25-2008, 12:08 AM   #4
gzidude
Junior Member
 
Join Date: Feb 2008
Posts: 20
Default off topic for a minute
Off topic for a minute.

I have never seen the kind of 'dot-notation' used in that code:

Quote:
variable V: Complex64_Typ;

R : signed(length_c-1 downto 0);
I : signed(length_c-1 downto 0);

V.R :=(A.R * B.R) - (A.I * B.I);
V.I :=(A.I * B.R) + (A.R * B.I);

I'm specifically talking about the V.R and V.I. This particular syntax is new to me. I'd like to look it up so I can learn how to use it properly, but don't know what it's called and therefore cannot look it up. Can anyone clue me in?


gzidude
gzidude is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Physical sythesis tool PALAC is not supported by Formal Verification tool Conf bbiandov Software 0 12-22-2008 05:25 AM
Beware of zCodec: it's malware Jeff DVD Video 1 09-05-2006 02:27 AM
DVD Video FixVTS 1.24b Found VCID 2/1 at LBA 142834 (142834 out) Sue Brumba DVD Video 2 03-09-2006 03:53 PM
Re: Osama Bin Ladin Found Hanged Jeff Hansman DVD Video 1 09-08-2004 03:12 PM
"Pirate booty" found on Castle in the Sky R1 DVD Robotech_Master DVD Video 26 01-01-2004 10:41 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46