用VHDL实现十六进制转换为10进制

来源:百度知道 编辑:UC知道 时间:2024/05/29 15:18:04
如何用VHDL实现十六进制转换为十进制,是4位十六进制也就是16位二进制转换为十进制,比如1388H=5000,这要如何实现?
你这个就相当于移位了吧,输入不是十进制的,要输入时十六进制,然后输出是十进制的啊

本来不想用时钟的,可是不用编译非常慢,可能太复杂吧,就用了一下,不太会,就将就着用用吧,

library ieee;

use ieee.std_logic_1164.all;

use ieee.std_logic_arith.all;

use ieee.std_logic_unsigned.all;

entity conv is

port(  clk:in std_logic;

       in16:in std_logic_vector(15 downto 0);

      out1,out2,out3,out4:out std_logic_vector(3 downto 0));

end entity conv;

architecture bhv of conv is 

begin

process(clk,in16)

variable tmp,q1,q2,q3:integer;

begin

tmp:=conv_integer(in16);

q1:=tmp/10;

q2:=q1/10;

q3:=q2/10;

if clk'event and clk='1' then

out1<=conv_std_logic_vector(tmp rem 10,4);

out2<=conv_std_logic_vector(q1 rem 10,4);

out3<=conv_std_logic_vector(q2 rem&nb