Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

binary to bcd converter

Status
Not open for further replies.

siowyein

Newbie level 2
Joined
Dec 19, 2007
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,301
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;
--use work.project.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);
variable a: integer :=10;
BEGIN
r:=(others=>'0');
r(4 DOWNTO 0):=D(15 DOWNTO 11);
FOR i IN 0 TO 9 loop
IF D(a)='1' then
r(4+(i+1) DOWNTO 0) := r(4+i DOWNTO 0) & '1';
ELSE
r(4+(i+1) DOWNTO 0) := r(4+i DOWNTO 0) & '0';
END IF;
a:=a-1;
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?
I think the problem is occurred at D(a)='1', but i dont know how to change it
 

binary to bcd in vhdl

dear siowyein...
its very diffficult to understand your code... are you getting your error in simulation or synthesis... what simulator are you using...? i was able to simulate and synthesis your code...

to tell you something your code is very inefficient...you are trying to realise your logic... you didnt realise that your code is gonna result in some digital circuit that is very very complex... so try to first think of the circuit you got to realise and then describe it using vhdl or verilog...
 

binary to bcd-converter

Dear lordsathish
Thanks. I am usingAltera maxplus 2. I cant compile it. Did you really successfully compile the code? Ok. then i try my effort to change it. And also will post it later. Hope you can help me out. THANks....
 

binary bcd converter

Hi!
If conversion time is not critical you can use "counters approach"
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top