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.

How to Write "Literate" FSM in Verilog HDL?

Status
Not open for further replies.

cevitamic

Newbie level 6
Newbie level 6
Joined
Dec 15, 2003
Messages
13
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
192
verilog fsm parameter

In VHDL, the states of a FSM can be defined as enumerate types, so that in ModelSim, literate state names can be shown. How can I do the similar thing in Verilog HDL?
 

verilog `define fsm

You cannot do the same thing in Verilog as far as I know.
However, you can define the state coding using parameter statement.

Regards,
 

fsm verilog example parameter

You can add some for debug conversion as below


// synopsys translate_off
reg [12*8-1:0] curr_state_name; // one char need 8-bit, therefore curr_state_name can contain 12 chars

always @(curr_state) // curr_state is your FSM registers
begin
case(curr_state)
STATE_0: curr_state_name = "string_0"; // string_0 is the the name you want to show
STATE_1: curr_state_name = "string_1";
STATE_2: curr_state_name = "string_2";
STATE_3: curr_state_name = "string_3";
endcase
end
// synopsys translate_on


After you do so, you can probe the curr_state_name instead of curr_state when you watch the waveform.
(It is supposed that the waveform viewer can display ASCII type)

Regards,
Jarod
 

    cevitamic

    Points: 2
    Helpful Answer Positive Rating
Or you can use system verilog which supports enumerated types.
 

you can use parameter to define state in verilog hdl.

for example, if you want to use four state named as

s1, s2, s3, s4,

you can define them use parameter as follow:

parameter s1 = 0;
parameter s2 = 1;
parameter s3 = 2;
parameter s4 = 3;


cevitamic said:
In VHDL, the states of a FSM can be defined as enumerate types, so that in ModelSim, literate state names can be shown. How can I do the similar thing in Verilog HDL?
 

hi,
refer to verilog hdl by samir palnitkar it will helpful to you.

with regards,
srik.
 

you can define them use parameter or use define
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top