3 ms·
Starting from a functional programming or even Prolog background may give you some useful insights. You also absolutely have to learn state machines. The first
by pjc50 9y ago
Starting from a functional programming or even Prolog background may give you some useful insights. You also absolutely have to learn state machines.
The first thing to realise is that FPGAs do not have linear execution. It "begins" everywhere at once. You define a set of logic, and all of it executes concurrently. Between logic blocks are state elements (flip-flops) which capture the state at every tick of the clock. If you want to impose some sort of temporal order on things, you have to do it yourself - with a state machine or a counter. You also need to define a "reset" state.
Normally you would work with a simulator (Modelsim is the usual choice for students), which lets you run your code or a subset of it on your PC with a "testbench".
One of the frustrating things for newbies is that the same language - Verilog or VHDL - has some features that are "synthesisable" and some that only work in the simulator, and it's not at all obvious which is which!