Learn

0/8
0/6
0/6
0/6

Practice

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

PortDirectionTypeDescription
step_iin2-bit vectorPosition in the four-step sequence
enable_iin1 bitDrive enable; releases all coils when low
coils_oout4-bit vectorCoil drivers: coil A on bit 3 down to coil D on bit 0

Behavior

The full-step table, while enable_i = '1':

step_icoils_oCoils energized
001100A, B
010110B, C
100011C, D
111001D, A
  • While enable_i = '0', coils_o is "0000" for every step value, including while step_i keeps changing
  • When enable_i rises again, the pattern for the current step appears immediately

Constraints

STRUCTURE: write the table as a with/select selected assignment driving an internal pattern signal. Gate that signal with one conditional assignment for the enable.

  • Finish the table with when others driving "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?

Loading editor...

Click Run to execute your code. Output will appear here.