Do I need to define inputs + outputs as reg or wire? Or entry and exit! enough?
Inputs are always wires, although this does not really matter, since you do not assign them. Outputs are the default wires, although you can also declare output reg if you want to register instead.
Should I provide a vector dimension for reg, nextstate state? If so, how do you know which measurement to choose?
Yes, you must declare a measurement, otherwise your design will disastrously fail when verilog silently truncates all your states to 0 or 1 . The width of the states should be the same width of the local parameters that you use to define state names, or, more generally, should be log2(number of input states) .
Can I write statements at the end like state0 and input1?
I do not think this is what you want. State0 is just a constant number. If you want to know if the state machine is in state 0, you need to compare the current state with the constant state0. Also you probably don't want bitwise And here, so use regular and && . Must be:
output = (state == state0) && input1;
source share