Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

typedef enum

Altera_Forum
Honored Contributor II
1,737 Views

Hi there, 

 

I ve written a module by using "typedef enum" as shown below and it cannot be synthesis. Syntax Error stated :  

- Expecting module level statement 

- Expecting target variable, got p_state - Misspelling? 

- Expecting radix character (one of b, o, h, or d) or unsized single bit literal (one of '1, '0, 'x, 'z) 

 

Can anyone give me some advice on this? thank you very much. 

 

typedef enum logic ΐ:0]{ 

Idle = 0,  

Fetch = 1,  

Exe = 2  

} state_type; 

state_type p_state, n_state; 

 

always @ ( posedge clk or negedge nreset) 

begin 

if (~nreset)  

p_state = Idle; 

else if (clk)  

p_state = n_state; 

end
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
801 Views

use parameters to define states in verilog. 

 

--dalon
0 Kudos
Reply