Using MIPS assembly language, write a MIPS programs that the determines what the ECC code should be for a given number (an 8-bit byte).The codes you create are to work for 8-bit positive numbers as these are simpler to work with than larger numbers. The program is to request the user to enter a byte of data (a positive integer in the range of 0 to 255 in decimal) and then create the 12-bit Hamming code as described in your text (see above). The program is to then output this (with an appropriate label) in hex. the following code is not working and has errors: # Prompt user for input li $v0, 4       # system call for printing string la $a0, prompt  # prompt string syscall # Read input byte li $v0, 5       # system call for reading integer syscall move $t0, $v0   # store the byte in register $t0 # Calculate ECC Hamming code srl $t1, $t0, 4   # extract the first 4 bits xor $t1, $t1, $t0 # calculate parity and $t1, $t1, 0b1011 # mask out irrelevant bits sll $t1, $t1, 8   # shift left by 8 bits srl $t2, $t0, 4   # extract the first 4 bits again and $t2, $t2, 0b0111 # mask out irrelevant bits or $t1, $t1, $t2  # combine with the second 4 bits sll $t1, $t1, 4   # shift left by 4 bits srl $t2, $t0, 4   # extract the first 4 bits yet again and $t2, $t2, 0b0001 # mask out irrelevant bits sll $t2, $t2, 11  # shift left by 11 bits or $t1, $t1, $t2  # combine with the first two bytes ori $t1, $t1, 0x8000 # set the leftmost bit to 1 for error detection # Print ECC Hamming code in hex li $v0, 34          # system call for printing integer in hex move $a0, $t1 syscall # Exit program li $v0, 10          # system call for exit syscall .data prompt: .asciiz "Enter a byte of data (0-255): "   THE PROGRAM ERRORS WHEN TRIED RUNNING: $t1, $t1, 0b1011 # mask out irrelevant bits Invalid language element: 0b1011  and $t2, $t2, 0b0111 # mask out irrelevant bits Invalid language element: 0b0111 and $t2, $t2, 0b0001 # mask out irrelevant bits Invalid language element: 0b0001 and $t1, $t1, 0b1011 # mask out irrelevant bits Invalid language element: 0b1011 and $t2, $t2, 0b0111 # mask out irrelevant bits Invalid language element: 0b0111 : and $t2, $t2, 0b0001 # mask out irrelevant bits Invalid language element: 0b0001   PLEASE FIX AND GIVE CORRECT CODE

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
Question

Using MIPS assembly language, write a MIPS programs that the determines what the ECC code should be for a given number (an 8-bit byte).The codes you create are to work for 8-bit positive numbers as these are simpler to work with than larger numbers. The program is to request the user to enter a byte of data (a positive integer in the range of 0 to 255 in decimal) and then create the 12-bit Hamming code as described in your text (see above). The program is to then output this (with an appropriate label) in hex.

the following code is not working and has errors:

# Prompt user for input
li $v0, 4       # system call for printing string
la $a0, prompt  # prompt string
syscall

# Read input byte
li $v0, 5       # system call for reading integer
syscall
move $t0, $v0   # store the byte in register $t0

# Calculate ECC Hamming code
srl $t1, $t0, 4   # extract the first 4 bits
xor $t1, $t1, $t0 # calculate parity
and $t1, $t1, 0b1011 # mask out irrelevant bits
sll $t1, $t1, 8   # shift left by 8 bits
srl $t2, $t0, 4   # extract the first 4 bits again
and $t2, $t2, 0b0111 # mask out irrelevant bits
or $t1, $t1, $t2  # combine with the second 4 bits
sll $t1, $t1, 4   # shift left by 4 bits
srl $t2, $t0, 4   # extract the first 4 bits yet again
and $t2, $t2, 0b0001 # mask out irrelevant bits
sll $t2, $t2, 11  # shift left by 11 bits
or $t1, $t1, $t2  # combine with the first two bytes
ori $t1, $t1, 0x8000 # set the leftmost bit to 1 for error detection

# Print ECC Hamming code in hex
li $v0, 34          # system call for printing integer in hex
move $a0, $t1
syscall

# Exit program
li $v0, 10          # system call for exit
syscall

.data
prompt: .asciiz "Enter a byte of data (0-255): "

 

THE PROGRAM ERRORS WHEN TRIED RUNNING:

$t1, $t1, 0b1011 # mask out irrelevant bits
Invalid language element: 0b1011
 and $t2, $t2, 0b0111 # mask out irrelevant bits
Invalid language element: 0b0111
and $t2, $t2, 0b0001 # mask out irrelevant bits
Invalid language element: 0b0001
and $t1, $t1, 0b1011 # mask out irrelevant bits
Invalid language element: 0b1011
and $t2, $t2, 0b0111 # mask out irrelevant bits
Invalid language element: 0b0111
: and $t2, $t2, 0b0001 # mask out irrelevant bits
Invalid language element: 0b0001

 

PLEASE FIX AND GIVE CORRECT CODE

 

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Binary numbers
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
  • SEE MORE 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