很简单,VHDL里面有一个二进制转十进制函数CONV_IETEGER(),在UNSIGNED这个程序包里,打开它用就是了,程序如下,,,
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY TURN2_10 IS
PORT(A:IN STD_LOGIC_VECTOR(4 DOWNTO 0);
B:OUT INTEGER RANGE 0 TO 32);
END;
ARCHITECTURE ART OF TURN2_10 IS
BEGIN
B<=CONV_INTEGER(A);
END;