Smart questions
Smart people
 Find A ForumFind An Expert
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Remember Me

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

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

Just copy and paste the

#### 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

 Forum Search FAQs Links Jobs Whitepapers MVPs
 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 ISport( D  : in std_logic_vector(15 downto 0);          Q  : out std_logic_vector(15 downto 0)); END projectTest3;ARCHITECTURE behavioral OF projectTest3 ISBegin   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 supportedANYone 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 IFThe 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=840645Or you can search in google with keyword "bcd to binary vhdl".There are many examples or source code for reference. Good luck.

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:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!