Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17268 Discussions

Probem in a state machine code

Altera_Forum
Honored Contributor II
1,752 Views

Hi, I'm new in VHDL and I have a problem with this code: 

 

The problem is that when I program it on The FPGA, even when SW(4) is equal to 0, LEDR(0) is equal to 1. And It stays on this state even if I move on the others switches (SW(0),SW(1),SW(2)). 

 

Thank you very much for any help.
0 Kudos
8 Replies
Altera_Forum
Honored Contributor II
1,002 Views

I didn't look at your code, but you should check your board documentation to see if the switches or LEDs are wired as active low rather than active high.

0 Kudos
Altera_Forum
Honored Contributor II
1,002 Views

 

--- Quote Start ---  

I didn't look at your code, but you should check your board documentation to see if the switches or LEDs are wired as active low rather than active high. 

--- Quote End ---  

 

I have already done it. They are active high.
0 Kudos
Altera_Forum
Honored Contributor II
1,002 Views

Have you written a simulation testbench?  

Why have you used > to compare the switch values?
0 Kudos
Altera_Forum
Honored Contributor II
1,002 Views

 

--- Quote Start ---  

Have you written a simulation testbench?  

Why have you used > to compare the switch values? 

--- Quote End ---  

 

 

No, I didn't write a simulation testbench. I've just tested this code on the FPGA. 

Actually, I didn't write the code. It is automatically generated by HDL coder based on a state machine in Matlab/Simulink. That's why > are used. But, I've tried ='1' to compare the switch values and it leads always to the same results : the code doesn't work. 

Please, any help ?
0 Kudos
Altera_Forum
Honored Contributor II
1,002 Views

Have you assigned the correct pins to the ports?

0 Kudos
Altera_Forum
Honored Contributor II
1,002 Views

 

--- Quote Start ---  

Have you assigned the correct pins to the ports? 

--- Quote End ---  

 

Yes, I absolutely did. 

The problem can't be in the syntax of clk_50 ? Shouldn't I write clock_50 rather than clk_50 ?
0 Kudos
Altera_Forum
Honored Contributor II
1,002 Views

if there was a syntax error, it would be obvious. 

Have you got the clock connected?
0 Kudos
Altera_Forum
Honored Contributor II
1,002 Views

 

--- Quote Start ---  

if there was a syntax error, it would be obvious. 

Have you got the clock connected? 

--- Quote End ---  

 

Yes, the clock is connected.
0 Kudos
Reply