USE IEEE.STD_LOGIC_1164.ALL; ENTITY BIN IS PORT ( BIN_IN:IN STD_LOGIC_VECTOR(3 DOWNTO 0); BCD_OUT: OUT STD_LOGIC_VECTOR(4 DOWNTO 0); ); END BIN2; ARCHITECTURE A OF BIN2 IS BEGIN PROCESS BCD_OUT<="00000" WHEN BIN_IN="0000" ELSE;"00001" WHEN BIN_IN="0001" ELSE; "00010" WHEN BIN_IN="0010" ELSE; "00011" WHEN BIN_IN="0011" ELSE; "00100" WHEN BIN_IN="0100" ELSE; "00101" WHEN BIN_IN="0101" ELSE; "00110" WHEN BIN_IN="0110" ELSE; "00111" WHEN BIN_IN="0111" ELSE; "01000" WHEN BIN_IN="1000" ELSE; "01001" WHEN BIN_IN="1001" ELSE; "10000" WHEN BIN_IN="1010" ELSE; "10001" WHEN BIN_IN="1011" ELSE; "10010" WHEN BIN_IN="1100" ELSE; "10011" WHEN BIN_IN="1101" ELSE; "10100" WHEN BIN_IN="1110" ELSE; "10101" WHEN BIN_IN="1111" ELSE "00000"; END PROCESS; END A;这段代码中有错误,请改正
时间: 2023-07-08 22:52:55 浏览: 161
以太网PHY寄存器分析_.rar_ieee802.3_phy寄存器_以太网 mac_寄存器
5星 · 资源好评率100%
在 PROCESS 的语句中,每个 ELSE 后面都有一个;应该改为冒号“:”。同时,将 “BIN2” 改为 “BIN” 以与 ENTITY 中的一致。修改后的代码如下:
```
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY BIN IS
PORT (
BIN_IN: IN STD_LOGIC_VECTOR(3 DOWNTO 0);
BCD_OUT: OUT STD_LOGIC_VECTOR(4 DOWNTO 0)
);
END BIN;
ARCHITECTURE A OF BIN IS
BEGIN
PROCESS
BEGIN
BCD_OUT <= "00000" WHEN BIN_IN = "0000" ELSE
"00001" WHEN BIN_IN = "0001" ELSE
"00010" WHEN BIN_IN = "0010" ELSE
"00011" WHEN BIN_IN = "0011" ELSE
"00100" WHEN BIN_IN = "0100" ELSE
"00101" WHEN BIN_IN = "0101" ELSE
"00110" WHEN BIN_IN = "0110" ELSE
"00111" WHEN BIN_IN = "0111" ELSE
"01000" WHEN BIN_IN = "1000" ELSE
"01001" WHEN BIN_IN = "1001" ELSE
"10000" WHEN BIN_IN = "1010" ELSE
"10001" WHEN BIN_IN = "1011" ELSE
"10010" WHEN BIN_IN = "1100" ELSE
"10011" WHEN BIN_IN = "1101" ELSE
"10100" WHEN BIN_IN = "1110" ELSE
"10101" WHEN BIN_IN = "1111" ELSE
"00000";
END PROCESS;
END A;
```
阅读全文