Menu

[Solved]Language Used Plp 52 Cse 230 Project 4 Pardon Interruption Learning Objectives Implement I Q37080176

LANGUAGE USED: PLP 5.2

CSE 230 Project 4: Pardon the Interruption

Learning Objectives:

● Implement an interrupt service routine in a program containingexisting functionality

The Task

In this project, you will be adding an interrupt service routine(ISR) to an existing program. The program is already fullyfunctional hexadecimal counter that shows the current counter valueon the seven-segment display. You will use the timer to generate aninterrupt every x cycles (where x can be between 100 and 200cycles). Your ISR needs to do the following things:

1. Toggle all eight LEDs (i.e. if they are all off, they shouldall be turned on and if they are already on, turn them off)

2. Perform any tasks necessary to allow another timer interruptwithin 100 to 200 cycles

No changes should be made to the existing main loop orsseg_display.asm. Code should only be added following the TODOcomments.

——————————————————————————–

——————————————————————————–

THE FOLLOWING IS THE MAIN main.asm:

.org 0x10000000

li $sp, 0x10fffffc   # Stack pointerinitialization
li $s0, sseg_lut   # Lookup table address used bysseg_display
lui $s1, 0xf070   # Interrupt controller register
lui $s2, 0xf0a0   # Seven segment display

# ****************************
# TODO: enable interrupts below
# ****************************

# NOTE: Do not add or modify any code within this main loop
main:
   jal sseg_display
   nop
   addiu $a0, $a0, 1
   j main
   nop

# ****************************************
# TODO: add interrupt service routine below
# ****************************************

——————————————————————————–

——————————————————————————–

THE FOLLOWING IS THE sseg_display.asm:

asm_file_trap:
   # If your program ends up in this loop then your ISRis not being exited correctly
   lui $s0, 0xf0a0
   li $t0, 0x86afafff    # “Err” on sevensegment
   sw $t0, 0($s0)
   j asm_file_trap
   nop

sseg_display:

   move $t1, $a0
   move $t3, $0

   # Position 0
   andi $t2, $t1, 0xf
   sll $t2, $t2, 2
   addu $t2, $t2, $s0   # Calculate LUTaddress
   lw $t2, 0($t2)
   or $t3, $t3, $t2
  
   # Position 1
   andi $t2, $t1, 0xf0
   srl $t2, $t2, 2
   addu $t2, $t2, $s0   # Calculate LUTaddress
   lw $t2, 0($t2)
   sll $t2, $t2, 8
   or $t3, $t3, $t2

   # Position 2
   andi $t2, $t1, 0xf00
   srl $t2, $t2, 6
   addu $t2, $t2, $s0   # Calculate LUTaddress
   lw $t2, 0($t2)
   sll $t2, $t2, 16
   or $t3, $t3, $t2

   # Position 3
   andi $t2, $t1, 0xf000
   srl $t2, $t2, 10
   addu $t2, $t2, $s0   # Calculate LUTaddress
   lw $t2, 0($t2)
   sll $t2, $t2, 24
   or $t3, $t3, $t2

   # Write to seven segment and increment
   jr $ra
   sw $t3, 0($s2)

# Seven segment display lookup table
sseg_lut:
   .word    0xc0   # 0
   .word   0xf9   # 1
   .word   0xa4   # 2
   .word   0xb0   # 3
   .word   0x99   # 4
   .word   0x92   # 5
   .word   0x82   # 6
   .word   0xf8   # 7
   .word   0x80   # 8
   .word   0x90   # 9
   .word   0x88   # a
   .word   0x83   # b
   .word   0xc6   # c
   .word   0xa1   # d
   .word   0x86   # e
   .word   0x8e   # f

Expert Answer


Answer to LANGUAGE USED: PLP 5.2 CSE 230 Project 4: Pardon the Interruption Learning Objectives: ● Implement an interrupt servic… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *