dpaul81
Newbie level 6
HI all,
I am very new to Verilog and am getting the following error!
"A net is not a legal lvalue in this context"
The places where I am getting the errors have been marked in the code given below:
`timescale 1 ns / 1 ns
module up_down_counter (clk, n_reset, up_down, inp_data, cnt_out);
// Port Names
input clk, n_reset;
input [1:0] up_down;
input [7:0] inp_data;
output [7:0] cnt_out;
// Int. Variables
reg [7:0] count;
// Main Code
always @(posedge clk)
begin
if (n_reset) // active high reset
begin
cnt_out <= 8'b0; <-- ERR
end
else
begin
if (up_down == 2'b00) // do nothing
begin
cnt_out <= count; <-- ERR
end
else if (up_down == 2'b01) // count up
begin
cnt_out <= count + 1; <-- ERR
end
else if (up_down == 2'b10) // count down
begin
cnt_out <= count - 1; <-- ERR
end
else
begin // load data
count <= inp_data;
cnt_out <= count ; <-- ERR
end
end
end
endmodule
--------------------------------
Please help!!
Thanks in advance,
dpaul
I am very new to Verilog and am getting the following error!
"A net is not a legal lvalue in this context"
The places where I am getting the errors have been marked in the code given below:
`timescale 1 ns / 1 ns
module up_down_counter (clk, n_reset, up_down, inp_data, cnt_out);
// Port Names
input clk, n_reset;
input [1:0] up_down;
input [7:0] inp_data;
output [7:0] cnt_out;
// Int. Variables
reg [7:0] count;
// Main Code
always @(posedge clk)
begin
if (n_reset) // active high reset
begin
cnt_out <= 8'b0; <-- ERR
end
else
begin
if (up_down == 2'b00) // do nothing
begin
cnt_out <= count; <-- ERR
end
else if (up_down == 2'b01) // count up
begin
cnt_out <= count + 1; <-- ERR
end
else if (up_down == 2'b10) // count down
begin
cnt_out <= count - 1; <-- ERR
end
else
begin // load data
count <= inp_data;
cnt_out <= count ; <-- ERR
end
end
end
endmodule
--------------------------------
Please help!!
Thanks in advance,
dpaul