Shift Left Logical-MIPS SLL Instruction with Example

A Shift Left Logical instruction in MIPS assembly is used for shifting the bits to the left. The amount of shift depends on the value we give it. When we perform a shift left logical instruction the low bits at right most is replaced by zeros and the high right most bit is discarded. (Number of discarded bits depend on the amount of shift)

To understand the full logic see the below picture:

shift left logical example

In the picture, you can see that performing sll one time on an 8-bit pattern causes the whole pattern shift by one bit.

Shift logical left by one causes the number multiplied by 2.

It’s general form is as follows: sll destination, target, shift_amount

Shift Left Logical-MIPS Program

Q: Write a program in MIPS, that take an integer from the user, perform SLL and Print the output.



That was all about MIPS SLL, questions in the comment box will be appreciated!

Nauman Rehmat

Nauman Rehmat is the owner of Assembly Language Tuts.He is interested in Programming and SEO. He is also pursuing a degree in Computer Software Engineering from Comsats.