Stepper Coil Sequencer
A two-phase stepper motor turns one step each time its four coil drivers move to the next pattern in a fixed four-row table. The motion controller hands you a 2-bit step index and a drive enable; you produce the coil pattern. While the enable is low, every coil is released: the motor freewheels and nothing heats up.
Optional practice with table selection and an enable override.
Interface
| Port | Direction | Type | Description |
|---|---|---|---|
step_i | in | 2-bit vector | Position in the four-step sequence |
enable_i | in | 1 bit | Drive enable; releases all coils when low |
coils_o | out | 4-bit vector | Coil drivers: coil A on bit 3 down to coil D on bit 0 |
Behavior
The full-step table, while enable_i = '1':
step_i | coils_o | Coils energized |
|---|---|---|
00 | 1100 | A, B |
01 | 0110 | B, C |
10 | 0011 | C, D |
11 | 1001 | D, A |
- While
enable_i = '0',coils_ois"0000"for every step value, including whilestep_ikeeps changing - When
enable_irises again, the pattern for the current step appears immediately
Constraints
STRUCTURE: write the table as a
with/selectselected assignment driving an internal pattern signal. Gate that signal with one conditional assignment for the enable.
- Finish the table with
when othersdriving"0000"; a selector carrying a metavalue such as'X'or'U'should leave the coils safe. The testbench drives an"XX"step with the drive enabled and expects released coils. - No procedural blocks
The two separate assignments are the syntax practice here; tests check the coil values. While disabled, advance the step index twice. Which pattern should appear when you enable the driver again?
Click Run to execute your code. Output will appear here.