I want to change binary to decimal so I used to_integer
. I intend that I put X <= 10110101
then M <= 181
and separate integer with hundreds, tens, units and I intend M_100 <= 1
, M_10 <= 8
, M_1 <= 1
I also need to change decimal to binary, I intend temp1 <= 0001
, temp2 <= 1000
, temp3 <= 0001
Please let me know the reason why the code error, shown below the code, occurs.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
entity TEST is
port(X: in std_logic_vector(7 downto 0);
M_100: buffer integer;
M_10: buffer integer;
M_1: buffer integer;
M: buffer integer;
Y: out std_logic_vector(2 downto 0));
end TEST;
architecture EX of TEST is
signal temp1: std_logic;
signal temp2: std_logic;
signal temp3: std_logic;
begin
X <= "00110101";
M <= to_integer(unsigned(X));
M_100 <= M/100;
with M_100 select temp1 <= "0000" when 0,
<= "0001" when 1,
<= "0010" when 2,
<= "0011" when 3,
<= "0100" when 4,
<= "0101" when 5,
<= "0110" when 6,
<= "0111" when 7,
<= "1000" when 8,
<= "1001" when 9;
M_10 <= (M - (M_100*100))/10;
with M_10 select temp2 <= "0000" when 0,
<= "0001" when 1,
<= "0010" when 2,
<= "0011" when 3,
<= "0100" when 4,
<= "0101" when 5,
<= "0110" when 6,
<= "0111" when 7,
<= "1000" when 8,
<= "1001" when 9;
M_1 <= (M - (M_100*100) - (M_10*10));
with M_1 select temp3 <= "0000" when 0,
<= "0001" when 1,
<= "0010" when 2,
<= "0011" when 3,
<= "0100" when 4,
<= "0101" when 5,
<= "0110" when 6,
<= "0111" when 7,
<= "1000" when 8,
<= "1001" when 9;
Y(2) <= temp1, Y(1) <= temp2, Y(0) <= temp3;
end EX;
error code : VHDL syntax error "near text "<="; expecting "(", or an identifier, or unary operator" occur in sentence with ~ select - <= ["0001", ..., "1001"] when [1,2,..., 9]