The output from a flip-flop is your next value, as synchronous logic you could just write:
For FPGA intial can be used to set initial values for ASIC active low resets are used
module statemac_posed(
input clk,
output reg a,
output reg b
);
initial begin
a = 'b0;
b = 'b0;
end
//On clock edge update a &b with new values based on previous a & b value
always@(posedge clk) begin
a <= a|b;
b <= ~a|b;
end
endmodule
This is equivalent to :
module statemac_posed(
input clk,
output reg a,
output reg b
);
reg a_next;
reg b_next;
//Combinatorial take outputs from flip-flops and combinatorial define next value
always @* begin
a_next = a|b;
b_next = ~a|b;
end
initial begin
a = 'b0;
b = 'b0;
end
//on Clock edge take the next values
always @(posedge clk) begin
a <= a_next;
b <= b_next;
end
endmodule
Any variable assigned to inside an initial or always needs to be of type reg. logic is also valid if using SystemVerilog. Not doing this was the cause of the errors you mentioned in comments.
This should give some insight into how to use verilog.
NB: use blocking (=) with combinatorial (@*). non-blocking (<=) with edge triggered (@(posedge clk)) to correctly describe hardware.
A(t)'mean (')?AstandBstin the module, makealwaisblock sensitive to clock and assign expressions to these registers, and assign these registers to outputs. If this dosn't work - please provide Your non-working code.