R
Robert Willy
Guest
Hi,
I build the following small project. Modelsim complains the error:
vlog -work work -vopt C:/modeltech_10.1c/examples/impinj/Page2_loop.v
Model Technology ModelSim SE vlog 10.1c Compiler 2012.07 Jul 27 2012
-- Compiling module sc_power3
** Error: C:/modeltech_10.1c/examples/impinj/Page2_loop.v(8): 'XPower'
already declared in this scope (sc_power3).
The code is exactly copied from a book.
Why does this it happen?
Thanks,
module sc_power3(
output [7:0] XPower,
output finished,
input [7:0] X,
input clk, start);
reg [7:0] ncount;
reg [7:0] XPower;
assign finished = (ncount == 0);
always@(posedge clk)
if (start) begin
XPower <= X;
ncount <= 2;
end
else if( !finished) begin
ncount <= ncount - 1;
XPower <= XPower * X;
end
endmodule
I build the following small project. Modelsim complains the error:
vlog -work work -vopt C:/modeltech_10.1c/examples/impinj/Page2_loop.v
Model Technology ModelSim SE vlog 10.1c Compiler 2012.07 Jul 27 2012
-- Compiling module sc_power3
** Error: C:/modeltech_10.1c/examples/impinj/Page2_loop.v(8): 'XPower'
already declared in this scope (sc_power3).
The code is exactly copied from a book.
Why does this it happen?
Thanks,
module sc_power3(
output [7:0] XPower,
output finished,
input [7:0] X,
input clk, start);
reg [7:0] ncount;
reg [7:0] XPower;
assign finished = (ncount == 0);
always@(posedge clk)
if (start) begin
XPower <= X;
ncount <= 2;
end
else if( !finished) begin
ncount <= ncount - 1;
XPower <= XPower * X;
end
endmodule