Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

separate sequential logic and combinational logic, why?

Status
Not open for further replies.

elvis1228

Newbie level 2
Joined
Jan 17, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,297
Hi,
why does some RTL coding Guideline recommand to separate sequential logic and combinational logic (write them in different always block), can you tell me the reason? Thanks.
 

Because they behave differently. In combinational logic block, the output changes whenever any input changes. In sequential logic, output only changes at the edges of the clock.
 

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?
 

I think it's just for clarity of code & reusability
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top