Thank you for reply. but I still don't understand.
for example:
I usually write RTL code in this style:
always @(posedge clk or negedge rst_n)
begin
if(rst_n)
dout <= 2'b0;
else if(sel == 1'b0)
dout <= din_a;
else
dout <= din_b;
end
but I saw some engineer write the RTL like this style (some RTL guideline recommanded, separate the sequential and combinational logic):
always @(*) begin
if(sel == 1'b0)
w_dout = din_a;
else
w_dout = din_b;
end
always @(posedge clk or negedge rst_n) begin
if(rst_n == 1'b0)
dout <= 2'd0 ;
else
dout <= w_dout ;
end
In my opinion, these two RTL code is equivalent, can anybody tell me the advantage of the style of separating sequential and combinational logic?