The mind is a software, make no mistake. In fact, it is the best one known to man. The brain is the hardware on which it runs.
Like an Operating System, it is made up of various processes. We call them thoughts. Thoughts can be words while awake and images when asleep. They can be pain, emotions, cravings, etc. In what form they present themselves is not important. Rather the common nature of all forms of thought is important to understand.