Question

Write Nios II assembler instructions that will invert bits 3 to 0, set (turn on) bits...

Write Nios II assembler instructions that will invert bits 3 to 0, set (turn on) bits 11 to 8 and reset (turn off) bits 31 to 12 in register r4. All other bits in r4 should be left unchanged. Finish off this piece of code with a jump immediate to address 0x00000040

0 0
Add a comment Improve this question Transcribed image text
Answer #1

L_PIN EQU 0
XOR temp,#0<<L_PIN ;invert bit 0
L_PIN EQU 1
XOR temp,#1<<L_PIN ;invert bit 1
L_PIN EQU 2
XOR temp,#2<<L_PIN ;invert bit 2
Setb acc.8 ;set bit 8
Setb acc.9 ;set bit 9
Setb acc.10 ;set bit 10
Setb acc.11 ;set bit 11
Btr acc.12 ;reset the bit 12
Btr acc.13 ;reset the bit 13
Btr acc.14 ;reset the bit 14
Btr acc.15 ;reset the bit 15
Btr acc.16 ;reset the bit 16
Btr acc.17 ;reset the bit 17
Btr acc.18 ;reset the bit 18
Btr acc.19 ;reset the bit 19
Btr acc.20 ;reset the bit 20
Btr acc.21 ;reset the bit 21
Btr acc.22 ;reset the bit 22
Btr acc.23 ;reset the bit 23
Btr acc.24 ;reset the bit 24
Btr acc.25 ;reset the bit 25
Btr acc.26 ;reset the bit 26
Btr acc.27 ;reset the bit 27
Btr acc.28 ;reset the bit 28
Btr acc.29 ;reset the bit 29
Btr acc.30 ;reset the bit 30
Btr acc.31 ;reset the bit 31
mov eax, 0x00000040
jmp eax ;jumo to address 0x00000040

Add a comment
Know the answer?
Add Answer to:
Write Nios II assembler instructions that will invert bits 3 to 0, set (turn on) bits...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A- Using either “ANDA” or “ORAA” instructions, write an HCS12 code to clear bits 0, 2,5,...

    A- Using either “ANDA” or “ORAA” instructions, write an HCS12 code to clear bits 0, 2,5, and 7 of register A and leave all other bits unchanged. B- Using either “ANDB” or “ORAB” instructions, write an HCS12 code to set bits 0, 3, and 6 of register B and leave all other bits unchanged.

  • Implement the following statements using MS430 assembly instructions. You may use more than one, ...

    Implement the following statements using MS430 assembly instructions. You may use more than one, but you should minimize the number of instructions required. You can use both native and emulated instructions. Use hex notation for all numbers 1. (a) Move the word located in register R14 to R15 (b) Increment the word in R6 by 2. (c) Perform a bitwise ANDing of the word located at address 0x0240 with the datum in R15, placing the results in R15. (d) Rotate...

  • MIPS coding

    Write a MIPS assembler language program to reverse the order of the bottom 16 bits of register $a0. At the start of your program you should load the initial bit pattern into $a0. The answer should be stored into $v0. Finish your program with an infinite loop (a jump instruction that jumps to itself).  For example:             $a0 = 00000011100000001111000000000001 in binary,   Reversing the order of the bottom 16 bits gives (modified bits are underlined):                                                  $v0 = 00000011100000001000000000001111 in binary   Here is...

  • Note: All assembly code should be well commented-similar level of detail to samples. 7. Write ARM...

    Note: All assembly code should be well commented-similar level of detail to samples. 7. Write ARM code that decodes the immediate value in an instruction-takes the last 12 bits and turns it into the value it represents a. Start by loading r1 with the value E3A01CFA (machine code for a move immediate into register) b. Isolate bits 0-7 (the rightmost 8 bits) the 8-bit binary number - into r2 c. Isolate bits 8-11 d. Multiply r3 by 2 to get...

  • b. A microprocessor has an instruction set that consists of 117 instructions, which need fetch, decode, read operand, execute, write and interrupt stages. Assume that as an average, each stage requir...

    b. A microprocessor has an instruction set that consists of 117 instructions, which need fetch, decode, read operand, execute, write and interrupt stages. Assume that as an average, each stage requires three micro- operations to complete. Also, assume that the control memory is N bits wide (i.e., control field bits + address selection field bits + address-one bits + address-two bits N bits). The control field bits are 15 and there are 15 flags to be monitored. i. How many...

  • 5 Exercises Now that everything is working you can try the following exercises. To complete them you will need to refer...

    5 Exercises Now that everything is working you can try the following exercises. To complete them you will need to refer to the documentation in Appendix A- The MiteASM Assembler and Appendix B - The MiteFPGA Processor. Write an assembly language program for an over counter for a cricket umpire. This should display a count on the 7-segment display. The count should increase by 1 when button 0 is 1. pressed. It should reset to 0 when button 1 is...

  • There is an example below Now that everything is working you can try the following exercises. To complete them you wi...

    There is an example below Now that everything is working you can try the following exercises. To complete them you will need to refer to the documentation in Appendix A The MiteASM Assembler and Appendix B The MiteFPGA Processor. Write an assembly language program for an over counter for a cricket umpire. This should 1. display a count on the 7-segment display. The count should increase by 1 when button 0 is pressed. It should reset to 0 when button...

  • Write assembly instructions to set Bit 3 of variable foo without changing other bits. Any quick...

    Write assembly instructions to set Bit 3 of variable foo without changing other bits. Any quick response to this would be highly appreciated.

  • 1.) a.) Using the simplified instruction set shown for part b, write code for the following....

    1.) a.) Using the simplified instruction set shown for part b, write code for the following. Suppose memory locations 1400 to 1449 contain 16-bit words. Each word represents 2 ASCII characters. Write code to read in and write out these 100 characters. Left-side character from location 1400 should be first, right-side character from location 1400 should be second, and remaining characters follow in numeric order. Assume you have access to 4 registers: R1, R2, R3, R4. Each register holds one...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT