vhdl实现16进制数与bcd的互相转化?

2019-07-16 01:34发布

求助各位大神如何把一个十六进制的数转化成相应的bcd码,又如何从bcd码转化成十六进制 这个用vhdl语言实现?谢谢
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
3条回答
蓝爱青
2019-07-16 04:09
二进制转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;

一周热门 更多>