Using MIPS assembly language PLEASE HELP ME FIX THE FOLLOWING CODE RUNNING WITH FOLLOWING ERRORS: Error in C:\Users\supre\Documents\Assignment9.asm line 39 column 15: and $t1, $t1, 0b1011 # mask out irrelevant bits Invalid language element: 0b1011 Error in C:\Users\supre\Documents\Assignment9.asm line 45 column 15: and $t2, $t2, 0b0111 # mask out irrelevant bits Invalid language element: 0b0111 Error in C:\Users\supre\Documents\Assignment9.asm line 53 column 15: and $t2, $t2, 0b0001 # mask out irrelevant bits Invalid language element: 0b0001 Error in C:\Users\supre\Documents\Assignment9.asm line 39 column 15: and $t1, $t1, 0b1011 # mask out irrelevant bits Invalid language element: 0b1011 Error in C:\Users\supre\Documents\Assignment9.asm line 45 column 15: and $t2, $t2, 0b0111 # mask out irrelevant bits Invalid language element: 0b0111 Error in C:\Users\supre\Documents\Assignment9.asm line 53 column 15: and $t2, $t2, 0b0001 # mask out irrelevant bits Invalid language element: 0b0001 Assemble: operation completed with errors. Heres the code: # Program to generate Hamming code for an 8-bit byte # Program to generate Hamming code for an 8-bit byte .data prompt: .asciiz "Enter an 8-bit positive integer (0-255): " hamming_label: .asciiz "The Hamming code is: " .text .globl main main: # Prompt the user to input an 8-bit positive integer 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 im trying to create a MIPS programs that determines what the ECC code should be for a given number (an 8-bit byte). The codes should 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. When the program runs correctly, it should prompt the user to enter an 8-bit positive integer. After the input is received, the program will calculate the corresponding Hamming code using the algorithm described in the prompt. Finally, the program will output the Hamming code in hexadecimal format, along with an appropriate label.
Using MIPS assembly language
PLEASE HELP ME FIX THE FOLLOWING CODE RUNNING WITH FOLLOWING ERRORS:
Error in C:\Users\supre\Documents\Assignment9.asm line 39 column 15: and $t1, $t1, 0b1011 # mask out irrelevant bits
Invalid language element: 0b1011
Error in C:\Users\supre\Documents\Assignment9.asm line 45 column 15: and $t2, $t2, 0b0111 # mask out irrelevant bits
Invalid language element: 0b0111
Error in C:\Users\supre\Documents\Assignment9.asm line 53 column 15: and $t2, $t2, 0b0001 # mask out irrelevant bits
Invalid language element: 0b0001
Error in C:\Users\supre\Documents\Assignment9.asm line 39 column 15: and $t1, $t1, 0b1011 # mask out irrelevant bits
Invalid language element: 0b1011
Error in C:\Users\supre\Documents\Assignment9.asm line 45 column 15: and $t2, $t2, 0b0111 # mask out irrelevant bits
Invalid language element: 0b0111
Error in C:\Users\supre\Documents\Assignment9.asm line 53 column 15: and $t2, $t2, 0b0001 # mask out irrelevant bits
Invalid language element: 0b0001
Assemble: operation completed with errors.
Heres the code:
# Program to generate Hamming code for an 8-bit byte
# Program to generate Hamming code for an 8-bit byte
.data
prompt: .asciiz "Enter an 8-bit positive integer (0-255): "
hamming_label: .asciiz "The Hamming code is: "
.text
.globl main
main:
# Prompt the user to input an 8-bit positive integer
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
im trying to create a MIPS programs that determines what the ECC code should be for a given number (an 8-bit byte). The codes should 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.
When the program runs correctly, it should prompt the user to enter an 8-bit positive integer. After the input is received, the program will calculate the corresponding Hamming code using the
Trending now
This is a popular solution!
Step by step
Solved in 3 steps