Altera_Forum
Honored Contributor
15 years agoneed help to design calculator function (addition and multiplication)
i need to design calculator that performs operations of addition and multiplication of 2 input (5-bit binary) that representing signed decimal numbers (range, -16 to + 15). I've already done the coding but now i'm stuck in BCD and seven segment coding..can anybody help me :cry:
module calculator (a,b,outadd,outmul, add,mul,clk);
input signed [4:0] a ;
input signed [4:0] b;
input add , mul;
input clk;
output reg [5:0] outadd;
output reg [9:0] outmul;
always @ (posedge clk)
begin
if (add)
outadd <= a + b;
begin
if (mul)
outmul <= a * b;
end
end
endmodule