Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...your web site's great! I've been using this system for almost a year now and find it really, really helpful. The people have been helpful in answering just about any question you post in the forums..."

Geography

Where in the world do Tek-Tips members come from?

help urgent!!! binary to bcd converter

yein (TechnicalUser)
20 Dec 07 11:45
I m curently work out this converter but the compilation is not successful. Below is the codes and error message. And I am using shift add3 algorithm for this.

LIBRARY ieee;
USE ieee.STD_LOGIC_1164.all;
USE ieee.STD_LOGIC_ARITH.all;
USE ieee.STD_LOGIC_UNSIGNED.all;

ENTITY projectTest3 IS
port( D  : in std_logic_vector(15 downto 0);       
   Q  : out std_logic_vector(15 downto 0));
END projectTest3;
ARCHITECTURE behavioral OF projectTest3 IS
Begin  
 PROCESS(D)
 variable r: STD_LOGIC_VECTOR (15 DOWNTO 0);
  BEGIN
  r:=(others=>'0');
  r(4 DOWNTO 0):=D(15 DOWNTO 11);
  FOR i IN 0 TO 9 loop
      IF D(10-i)='1' then
   r(5+i DOWNTO 0) := r(4+i DOWNTO 0) & '1';
   ELSE
   r(4+(i+1) DOWNTO 0) := r(4+i DOWNTO 0) & '0';
   END IF;
   
   IF r(3 DOWNTO 0) >= 5 then
    r(3 DOWNTO 0) := r(3 DOWNTO 0) + "0011";
    IF r(7 DOWNTO 4) >= 5 then
     r(7 DOWNTO 4) := r(7 DOWNTO 4) + "0011";
     IF r(11 DOWNTO 8) >= 5 then
      r(11 DOWNTO 8) := r(11 DOWNTO 8) + "0011";
     END IF;
    END IF;
   END IF;
  END LOOP;
  Q(15 downto 0) <= r(15 downto 0);
 END PROCESS;
end behavioral;


Error:  a deferred constant declaration without a full declaration is not supported
ANYone can help?
THANKs in advance
bonami172 (Programmer)
20 Dec 07 13:54
Hi,
I think you have recently used the VHDL. Remember that VHDL is   the language to design the hardware but not the software. Your program seems to be used for C language in computer. I think the trouble is here :
  FOR i IN 0 TO 9 loop
      IF D(10-i)='1' then
          r(5+i DOWNTO 0) := r(4+i DOWNTO 0) & '1';
      ELSE
          r(4+(i+1) DOWNTO 0) := r(4+i DOWNTO 0) & '0';
      END IF

The compiler cannot generate the hardware  to do this. So tell me what your program need to do in detail. I will give you some suggestion.
yein (TechnicalUser)
21 Dec 07 8:56
Yes. I'm new to VHDL. Actually i am designing a calculator tht can perform addition, subtraction and multiplication only. User will key in the maximum 2 BCD numbers (56+72, 56*4,...).For addition and subtraction, i can do it in BCD. But for multiplication, I have to convert bcd into binary code then the binary result has to convert it back into bcd. I have stucked in the binary to bcd conversion. Hope u can help me... Thanks in advance.
bonami172 (Programmer)
21 Dec 07 12:35
Hi,
You can see more informations in this link : http://www.tek-tips.com/viewthread.cfm?qid=840645

Or you can search in google with keyword "bcd to binary vhdl".
There are many examples or source code for reference.
Good luck.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close