A memory controller uses a power- and performance-aware scheduler which
reorders memory commands based on power priorities. Selected memory ranks
of the memory device are then powered down based on rank localities of
the reordered commands. The highest power priority may be given to memory
commands having the same rank as the last command sent to the memory
device. Any memory commands having the same power priority can be further
sorted based on one or more performance criteria such as an expected
latency of the memory commands and an expected ratio of read and write
memory commands. To optimize the power-down function, the power-down
command is only sent when the selected memory rank is currently idle, the
selected memory rank is not already powered down, none of the reordered
memory commands correspond to the selected rank, and a currently pending
memory command cannot be issued in the current clock cycle.