Digit0001
Member level 1
Hi
i am having trouble designing a truth table for the 4-bit ALU. The document details the specifications:View attachment Lab1part3.doc
My problem is how would i combine the arithmetic table with the logic table into one table? The only way i can think of is do it in separate tables
This is what i have in code:
P.S
i am having trouble designing a truth table for the 4-bit ALU. The document details the specifications:View attachment Lab1part3.doc
My problem is how would i combine the arithmetic table with the logic table into one table? The only way i can think of is do it in separate tables
This is what i have in code:
Code:
process(A,B,sel,sCIN,cIN)
begin
case sel is
when "00" => H <= A AND B;
when "01" => H <= A OR B;
when "10" => H <= A XOR B;
when "11" => H <= A XNOR B;
when others => null;
end case;
case sCIN is --sCIN <= sel & cin
when "000" => G <= ('0' & A) + '0';
when "001" => G <= ('0' & A) + '1';
when "010" => G <= ('0' & A) + ('0' & B);
when "011" => G <= ('0' & A) + ('0' & B) + cIN;
when "100" => G <= (('0' & A) + (NOT B));
when "101" => G <= ((NOT ('0' & B)) + ('0' & A) + '1');
when "110" => G <= ((NOT ('0' & A)) + ('0' & B));
when "111" => G <= ((NOT ('0' & A)) + ('0' & B) + '1');
when others => null;
end case;
P.S
Last edited: