Aussie Susan
Advanced Member level 5
I am very new to FPGA programming and I'm trying to learn using Verilog. (40+ years of procedural programming from Cobol, Pascal, Fortran, all variants of C etc are probably getting in the way!). I have a Digilent Basys3 board and have installed Vivado 2022.1 on a Linux box as my environment.
I've managed to get a 'debounce' module working and using that to toggle a LED - that is the level I'm at!
I've been looking at several code examples of a UART transmitter and they all use a FSM - fair enough as I'm familiar with those from way back in my Electrical Engineering student days. What I don't understand is why they all seem to create 2 'always' blocks, both sensitive to the 'posedge' of the same clock. One seems to handle the state transitions and the other handles the inputs and outputs.
I hope this is not a 'flame war' question but why use 2 FSMs running in parallel? It would seem to me that it is be more 'readable' to have a single FSM that does all the work within each state.
What are the benefits and problems with each style?
Susan
I've managed to get a 'debounce' module working and using that to toggle a LED - that is the level I'm at!
I've been looking at several code examples of a UART transmitter and they all use a FSM - fair enough as I'm familiar with those from way back in my Electrical Engineering student days. What I don't understand is why they all seem to create 2 'always' blocks, both sensitive to the 'posedge' of the same clock. One seems to handle the state transitions and the other handles the inputs and outputs.
I hope this is not a 'flame war' question but why use 2 FSMs running in parallel? It would seem to me that it is be more 'readable' to have a single FSM that does all the work within each state.
What are the benefits and problems with each style?
Susan