T
Travis
Guest
I got this example from
http://asic.co.in/Index_files/verilogexamples.htm#link37
Quote follows:
"Following is the Verilog code for an unsigned 8-bit adder with carry in and carry out.
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
"
I see that tmp is assigned as a wire. Wouldn't tmp have to be a register, as it is storing a value? Also, wouldn't output have to be an output reg, if it is storing this value?
It looks like something that'd be fine for simulation, but wouldn't work correctly for synthesis.
Thanks all!
http://asic.co.in/Index_files/verilogexamples.htm#link37
Quote follows:
"Following is the Verilog code for an unsigned 8-bit adder with carry in and carry out.
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
"
I see that tmp is assigned as a wire. Wouldn't tmp have to be a register, as it is storing a value? Also, wouldn't output have to be an output reg, if it is storing this value?
It looks like something that'd be fine for simulation, but wouldn't work correctly for synthesis.
Thanks all!