mirror of
https://github.com/supleed2/ELEC50010-IAC-CW.git
synced 2024-12-23 05:45:47 +00:00
Fixed signing error in alu and added excel file
This commit is contained in:
parent
5df8a72ca1
commit
85ba783a69
BIN
Instructions.xlsx
Normal file
BIN
Instructions.xlsx
Normal file
Binary file not shown.
|
@ -5,7 +5,7 @@ module mips_cpu_alu(
|
||||||
input logic [4:0] shamt, //5-bit input used to specify shift amount for shift operations. Taken directly from the R-type instruction (Non-Variable) or from
|
input logic [4:0] shamt, //5-bit input used to specify shift amount for shift operations. Taken directly from the R-type instruction (Non-Variable) or from
|
||||||
|
|
||||||
output logic ALUCond, //If a relevant condition is met, this output goes high(Active High). Note: Relevant as in related to current condition being tested.
|
output logic ALUCond, //If a relevant condition is met, this output goes high(Active High). Note: Relevant as in related to current condition being tested.
|
||||||
output logic signed[31:0] ALURes // The ouput of the ALU
|
output logic[31:0] ALURes // The ouput of the ALU
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -77,19 +77,19 @@ Ops ALUOps; //Note confusing naming to avoid potential duplicate variable naming
|
||||||
assign ALUOps = ALUOp;
|
assign ALUOps = ALUOp;
|
||||||
case(ALUOps)
|
case(ALUOps)
|
||||||
ADD: begin
|
ADD: begin
|
||||||
ALURes = $signed(A) + $signed(B);
|
$signed(ALURes) = $signed(A) + $signed(B);
|
||||||
end
|
end
|
||||||
|
|
||||||
SUB: begin
|
SUB: begin
|
||||||
ALURes = $signed(A) - $signed(B) ;
|
$signed(ALURes) = $signed(A) - $signed(B) ;
|
||||||
end
|
end
|
||||||
|
|
||||||
MUL: begin
|
MUL: begin
|
||||||
ALURes = $signed(A) * $signed(B);
|
$signed(ALURes) = $signed(A) * $signed(B);
|
||||||
end
|
end
|
||||||
|
|
||||||
DIV: begin
|
DIV: begin
|
||||||
ALURes = $signed(A) / $signed(B);
|
$signed(ALURes) = $signed(A) / $signed(B);
|
||||||
end
|
end
|
||||||
|
|
||||||
AND: begin
|
AND: begin
|
||||||
|
@ -121,11 +121,11 @@ Ops ALUOps; //Note confusing naming to avoid potential duplicate variable naming
|
||||||
end
|
end
|
||||||
|
|
||||||
SRA: begin
|
SRA: begin
|
||||||
ALURes = $signed(B) >>> shamt;
|
$signed(ALURes) = $signed(B) >>> shamt;
|
||||||
end
|
end
|
||||||
|
|
||||||
SRAV: begin
|
SRAV: begin
|
||||||
ALURes = $signed(B) >>> A;
|
$signed(ALURes) = $signed(B) >>> A;
|
||||||
end
|
end
|
||||||
|
|
||||||
EQ: begin
|
EQ: begin
|
||||||
|
@ -205,11 +205,11 @@ Ops ALUOps; //Note confusing naming to avoid potential duplicate variable naming
|
||||||
end
|
end
|
||||||
|
|
||||||
MULU: begin
|
MULU: begin
|
||||||
ALURes = A * B;
|
$signed(ALURes) = $signed(A) * $signed(B);
|
||||||
end
|
end
|
||||||
|
|
||||||
DIVU: begin
|
DIVU: begin
|
||||||
ALURes = A / B;
|
$signed(ALURes) = $signed(A) / $signed(B);
|
||||||
end
|
end
|
||||||
|
|
||||||
endcase
|
endcase
|
||||||
|
|
Loading…
Reference in a new issue