Please help me find the bug a MIPS assembly program that takes input of an integer and  prints out a string that shows how that integer should be encoded using 16 bits. Please help me find the bug It is supposed to handle both positive and negative valued inputs. The program should also print out an error message if the given input cannot be expressed as a 16 bit signed integer.   As an example, if the input is 12, the program should output 0000000000001100.   The error I get is Error in H:\Downloads\hw2221 line 24 column 10: "input": operand is of incorrect type     The program is  .datainput: .word 0output: .asciiz ""str1: .asciiz " Please enter an integer: ".text.globl main main: li $v0, 5syscall sw $v0, inputli $t1, 16li $t0, 0loop:beq $t1, $t0, endlw $t2, inputand $t2, $t2, 1sll $t2, $t2, 31or $t2, $t2, $t3srl $t3, $t3, 1srl $t2, input, 1sw $t2, inputaddi $t0, $t0, 1j loopend:move $a0, $t3li $v0, 1syscallli $v0, 10syscall

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question

Please help me find the bug

a MIPS assembly program that takes input of an integer and  prints out a string that shows how that integer should be encoded using 16 bits.

Please help me find the bug

It is supposed to handle both positive and negative valued inputs.

The program should also print out an error message if the given input cannot be expressed as a 16 bit signed integer.

 

As an example, if the input is 12, the program should output 0000000000001100.

 

The error I get is

Error in H:\Downloads\hw2221 line 24 column 10: "input": operand is of incorrect type

 

 

The program is 

.data
input: .word 0
output: .asciiz ""
str1: .asciiz " Please enter an integer: "
.text
.globl main


main:

li $v0, 5
syscall

sw $v0, input
li $t1, 16
li $t0, 0
loop:
beq $t1, $t0, end
lw $t2, input
and $t2, $t2, 1
sll $t2, $t2, 31
or $t2, $t2, $t3
srl $t3, $t3, 1
srl $t2, input, 1
sw $t2, input
addi $t0, $t0, 1
j loop
end:
move $a0, $t3
li $v0, 1
syscall
li $v0, 10
syscall

AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education