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.

Two Verilog FSM style compare

Status
Not open for further replies.

davyzhu

Advanced Member level 1
Joined
May 23, 2004
Messages
494
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Location
oriental
Activity points
4,436
+compare verilog

Hi all,

There is a problem on How to write FSM in Verilog(https://www.asic-world.com/tidbits/verilog_fsm.html).
Most synthesis tools recommend second "Using Two Always Blocks" style. But I would like to use third "Single Always" style. It seems more compact.

What's the pros and cons between the two styles? I see that the third style may have state transition latency. But does the third style gain higher frequency and shorter critical path?
Thanks!

Best regards,
Davy
 

masai_mara

Advanced Member level 4
Joined
Aug 13, 2004
Messages
118
Helped
8
Reputation
14
Reaction score
2
Trophy points
1,298
Activity points
1,426
fsm in verilog

You can use any of the three stsyles mentioned depending on your convenience. But its a better practice to have multiple always blocks since it aids in efficient debugging.
 

    davyzhu

    Points: 2
    Helpful Answer Positive Rating

no_mad

Full Member level 5
Joined
Dec 10, 2004
Messages
272
Helped
30
Reputation
60
Reaction score
11
Trophy points
1,298
Location
Naboo
Activity points
2,468
verilog fsm

As for me, I always use 2 always block. This is because first always block is my state (present n next) and the second always block is my combo logic block.

As we all know, fsm basically, have 2 part.
1. flip flops
2. combo logic

Thus, by using 2 always block it made my life more easier to code and to debug.

But again, "it is depending on your convenience ", masai_mara :)
 

stocking

Member level 5
Joined
Nov 5, 2004
Messages
91
Helped
5
Reputation
10
Reaction score
1
Trophy points
1,288
Activity points
704
verilog compare

I deem that the style of two block of always is better since it is good at the area and timing!!
 

nittinsharma80

Member level 5
Joined
Apr 11, 2005
Messages
93
Helped
11
Reputation
22
Reaction score
2
Trophy points
1,288
Location
INDIA
Activity points
2,337
fsm verilog

Hi
find the attached paper that describes th epros and cons of the various coding styles
i hope it helps
regards
 

    davyzhu

    Points: 2
    Helpful Answer Positive Rating

nemolee

Full Member level 3
Joined
Dec 28, 2004
Messages
155
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,298
Activity points
1,457
fsm coding styles

davyzhu said:
What's the pros and cons between the two styles? I see that the third style may have state transition latency. But does the third style gain higher frequency and shorter critical path?

I think single always and dual always will have the same performance.
The chip performance is based on your coding style.
If you will gain higher frequency, you can use pipeline architecture.
But dual always approach have more easy debuging.
 

funster

Full Member level 4
Joined
Jun 30, 2005
Messages
233
Helped
19
Reputation
38
Reaction score
4
Trophy points
1,298
Activity points
2,742
fsm 2 always 1

I usually use three always blocks to describe a finite state machine.

one block is sequential logic;
second block is next state combinational logic;
third block is output logic.

I feel this style is very clear and ease to debug.

for synthesis, I think all style will be same, because

DC is clever enough.

best regards




davyzhu said:
Hi all,

There is a problem on How to write FSM in Verilog(h**p://www.asic-world.com/tidbits/verilog_fsm.html).
Most synthesis tools recommend second "Using Two Always Blocks" style. But I would like to use third "Single Always" style. It seems more compact.

What's the pros and cons between the two styles? I see that the third style may have state transition latency. But does the third style gain higher frequency and shorter critical path?
Thanks!

Best regards,
Davy
 

dBUGGER

Advanced Member level 4
Joined
Apr 18, 2005
Messages
108
Helped
13
Reputation
26
Reaction score
1
Trophy points
1,298
Location
Milky Way
Activity points
2,430
HI,
refer to cummings papers. Even three always block can be reduced to two with the o/p encoded with the state. In this case two always bocks else three will be good.
best Regards,
 

nanako

Member level 5
Joined
Jul 20, 2001
Messages
91
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
828
whether you use 1, 2 or 3 always block, the synthesis result should be the same. 2 or 3 always block should be good as it provide better readability to the rtl code. i used to usse 3 always block but later when design get bigger and more states to code, change to 2 as easier to track and trace state and outputs.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top