Posts

Showing posts with the label MIPS

A simple binary tree program -- in assembler

I believe every programmer must learn assembly programming. It brings the programmer and the machine closer and strengthens the bond between them. I learned the term GIGO (Garbage In Garbage Out) when I got first introduced to computer programming. Nothing has changed since. The languages and their environments have become better beyond doubt. Still, a computer and its resources are as good as its programmer. Assembly language makes you understand how the machine is working beyond all that glittery higher level languages. If you are a system programmer, learning assembly becomes a must because there are things that C can't handle. I will leave more discussion on "Why learning assembly is important" for later post. Every new architecture that I learn, I learn its assembler first. When I got first introduced to MIPS, I learned its assembly language. Below is a program that I wrote to achieve that.     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

MIPS Bootstrapping

Image
Bootstrapping is the process of taking a CPU just out of reset, fetching and executing instructions serially, to a more complex running environment. The program that does that is called a "Boot loader" or "Boot strap code" or simply "Boot code". First Instruction Fetch When power is applied to a processor and it comes out of reset, it fetches its first instruction from an address that is hardwired. This address is known as the " Boot Vector " or the " Reset Vector ". The MIPS processors' boot vector is located at physical address 0x1FC00000. The MIPS processors have MMU enabled as soon as they are powered on. The MIPS core thus presents a virtual address of 0xBFC00000. The MMU translates this address to physical address of 0x1FC00000, the boot vector. This translation again is hardwired. Typically, a boot device is present at this address and responds to the read request of the processor2. See Firgure 1.  The offset 0 of bootstr