module adder(a, b, ci, sum);
input [7:0] a;
input [7:0] b;
input ci;
output [7:0] sum;
assign sum = a + b + ci;
endmodule
Verilog code for an
unsigned 8-bit adder with carry out. module adder(a, b, sum, co);
input [7:0] a;
input [7:0] b;
output [7:0] sum;
output co;
wire [8:0] tmp;
assign tmp = a + b;
assign sum = tmp [7:0];
assign co = tmp [8];
endmodule
module adder(a, b, ci, sum, co);
input ci;
input [7:0] a;
input [7:0] b;
output [7:0] sum;
output co;
wire [8:0] tmp;
assign tmp = a + b + ci;
assign sum = tmp [7:0];
assign co = tmp [8];
endmodule
module addsub(a, b, oper, res);
input oper;
input [7:0] a;
input [7:0] b;
output [7:0] res;
reg [7:0] res;
always @(a or b or oper)
begin
if (oper == 1’b0)
res = a + b;
else
res = a - b;
end
endmodule
Thanks a lot kumar
ReplyDeleteDear,
ReplyDeleteYou can help me for code verilog and testbench of this topic "signed adder 16 bit have carry in.out flag}
my email: ndphong18@gmail.com
thanks so much,
Hello, can you help me with my verilog program and testbench. Really need a help. My email is emyraclarasalvatore@gmail.com
ReplyDeleteHi
ReplyDeleteCan help me
Verilog code for adder/subtractor comparator
can u give me testbench for adder/subtractor
ReplyDelete