As Vlad Lazarenko has pointed out you can not assign values to wires inside initial
or always@
blocks.
The fix for this is to simply to change the type from wire
to reg
.
Or declare everything (except tristate buses) as logic
if you are using SystemVerilog.
The definition of reg or wire only applies to that level of hierarchy. A reg can drive a port which is treated as wire inside that module.
Reg does not imply a flip-flop or register it is a simulator optimisation.
It is also worth noting that a flip-flop is normally instantiated via:
reg x;
always @(posedge clk or negedge rst_n) begin
if(~rst_n) begin
//reset condition
x <= 1'b0;
end
else begin
x <= next_value;
end
end