Forum Discussion
MShai9
New Contributor
6 years agoGetting an error :object "led" on left-hand side of assignment must have a variable data type
module test (clk,led); input clk; output led; reg [7:0] counter; always@(posedge clk) begin if (counter < 100) counter <= counter +1; else counter <= 0; end always @ (counter) begin ...
a_x_h_75
Contributor
6 years agoYou need to declare 'led' as a reg, in the same way you've declared counter. Declaring it as an output to the module isn't enough (as it is in other languages).
You can either add:
reg led;
or change the output declaration to:
output reg led;
Cheers,
Alex