I am stuck in converting my 4 bit std vector to 5 bit. I am supposed to do logic operations and arithmetic operations with 4 bit inputs. (4 bit ALU) However, for arithmetic operations, I might have a carry out bit and I don't know how to keep it. Here is my code, I tried to define a temp 5-bit vector and make temp(4) to carry out.
architecture Behavioral of alusmall is
signal temp: std_logic_vector (4 downto 0);
begin
--.--Here we write which operations are launched according to M and S signals:
temp <= (A and B) when (M='0' and S="00") else
(A or B) when (M='0' and S="01") else
(A xor B) when (M='0' and S="10") else
(A xnor B) when (M='0' and S="11") else
std_logic_vector(unsigned(A) + unsigned(C1)) when (M='1' and S="00") else --.--now, the arithmetic part starts (M is one).
std_logic_vector(unsigned(A) + unsigned(B) + unsigned(C1)) when (M='1' and S="01") else
std_logic_vector(unsigned(A) + unsigned(not B) + unsigned(C1)) when (M='1' and S="10") else
std_logic_vector(unsigned(not A) + unsigned(B) + unsigned(C1));
How can I seperate temp(4) and temp(3 downto 0) in 4-to-1 multiplexer?