The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Apr 19th, 2024, 7:09pm
Pages: 1
Send Topic Print
Interpolation Computing Code.What's wrong in it? (Read 4174 times)
cyjim
New Member
*
Offline



Posts: 3

Interpolation Computing Code.What's wrong in it?
Jun 03rd, 2004, 11:14pm
 
I wrote the code below,but I can't compile it successfully.Can you help me,what's wrong in it?
Thanks a lot!

cyjim

--------------------------------------------------------------------------------
-----

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity lineinter is
port(reset:in std_logic;
clk:in std_logic;
xe,ye:in signed(15 downto 0);
cpx1,cpx2,cpy1,cpy2:0ut std_logic);
end entity lineinter;

architecture lineinter_arch of lineinter is
begin
process(clk,reset,xe,ye)
variable c,d,e,f:std_logic;
variable q:signed(31 downto 0);
variable r,s:signed(15 downto 0);
begin
if reset='0' then q:=(others=>'0');r:=(others=>'0');s:=(others=>'0');
elsif clk'event and clk='1' then
a:loop
q:=xe*s-r*ye;
if (xe(15)='0') and (ye(15)='0') then
if q(31)='0' then c:='1';q:=q-ye;r:=r+1;
else e:='1';q:=q+xe;s:=s+1;
end if;
end if;
if (xe(15)='1') and (ye(15)='0') then
if q(31)='0' then e:='1';q:=q+xe;s:=s+1;
else d:='1';q:=q+ye;r:=r-1;
end if;
end if;
if (xe(15)='1') and (ye(15)='1') then
if q(31)='0' then d:='1';q:=q+ye;r:=r-1;
else f:='1';q:=q-xe;s:=s-1;
end if;
end if;
if (xe(15)='0') and (ye(15)='1') then
if q(31)='0' then f:='1';q:=q-xe;s:=s-1;
else c:='1';q:=q-ye;r:=r+1;
end if;
end if;
cpx1<=c;cpx2<=d;cpy1<=e;cpy2<=f;
exit a when r=xe and s=ye;
end loop a;
end if;
end process;
end architecture lineinter_arch;
Back to top
 
 
View Profile   IP Logged
Andrew Beckett
Senior Fellow
******
Offline

Life, don't talk to
me about Life...

Posts: 1742
Bracknell, UK
Re: Interpolation Computing Code.What's wrong in i
Reply #1 - Jun 4th, 2004, 1:02am
 
I tried compiling this with:

Code:
ncvhdl -ams code.vhd 



and it gave some fairly clear errors:

Code:
ncvhdl -ams code.vhd
ncvhdl: 05.10-s012: (c) Copyright 1995-2004 Cadence Design Systems, Inc.
cpx1,cpx2,cpy1,cpy2:0ut std_logic);
			   |
ncvhdl_p: *W,REQSEX (code.vhd,9|21): no separator between number and identifier [13.2].
cpx1,cpx2,cpy1,cpy2:0ut std_logic);
			  |
ncvhdl_p: *E,EXPUSN (code.vhd,9|20): expecting an expanded name [6.3].
 



If you look at the line in your code it is complaining about:
Code:
 cpx1,cpx2,cpy1,cpy2:0ut std_logic);   


you'll see you've written 0ut instead of out. If I fix that, it compiles OK.

You didn't say which tool you were using here, but the lesson is probably to pay attention to the error messages!

Regards,

Andrew.
Back to top
 
 
View Profile WWW   IP Logged
cyjim
New Member
*
Offline



Posts: 3

Re: Interpolation Computing Code.What's wrong in i
Reply #2 - Aug 22nd, 2004, 5:40pm
 
Hi,Andrew!
Thanks a lot for your reply to my topic. I have put the problems straight.


best regards,
cyjim
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.