二进制转bcd码很简单,
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity tobcd is
port(d:in std_logic_vector(3 downto 0);
b:out std_logic_vector(4 downto 0));
end tobcd;
architecture one of tobcd is
begin
process(d)
begin
if(d<10) then
b<='0'&d;
else
b<='0'&d+6;
end if;
end process;
end one;
二进制转bcd码很简单,
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity tobcd is
port(d:in std_logic_vector(3 downto 0);
b:out std_logic_vector(4 downto 0));
end tobcd;
architecture one of tobcd is
begin
process(d)
begin
if(d<10) then
b<='0'&d;
else
b<='0'&d+6;
end if;
end process;
end one;
举报