chisel: Factor out memory controller so the controller and Patmos can be generated separately.