OpenCores
URL https://opencores.org/ocsvn/ion/ion/trunk

Subversion Repositories ion

[/] [ion/] [trunk/] [src/] [opcodes/] [opcodes.s] - Diff between revs 2 and 4

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 4
Line 1... Line 1...
################################################################################
################################################################################
# opcode.s -- MIPS opcode tester for xxx project
# opcode.s -- MIPS opcode tester for Ion project
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# ORIGINAL AUTHOR: Steve Rhoads (rhoadss@yahoo.com) -- 1/10/01
# ORIGINAL AUTHOR: Steve Rhoads (rhoadss@yahoo.com) -- 1/10/01
#
#
# This file is an edited version of 'opcodes.asm', which is part of the Plasma
# This file is an edited version of 'opcodes.asm', which is part of the Plasma
# project (http://opencores.org/project,plasma).
# project (http://opencores.org/project,plasma).
# COPYRIGHT: Software placed into the public domain by the original author.
# COPYRIGHT: Software placed into the public domain by the original author.
# Software 'as is' without warranty.  Author liable for nothing.
# Software 'as is' without warranty.  Author liable for nothing.
 
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This assembly file tests all of the opcodes supported by the xxx core.
#
 
# This assembly file tests all of the opcodes supported by the Ion core.
# This test assumes that address 0x20000000 is the UART write register.
# This test assumes that address 0x20000000 is the UART write register.
# Successful tests will print out "A" or "AB" or "ABC" or ....
# Successful tests will print out "A" or "AB" or "ABC" or ....
# Missing letters or letters out of order indicate a failure.
# Missing letters or letters out of order indicate a failure.
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# The core supports all the MIPS-I instructions, except for MULT* and DIV*.
# NOTE: This test bench relies on the simulation logs to catch errors. That is,
# C code needs to be compiled with the "-mno-mul" flag and linked with 'math.c'.
# unlike the original Plasma code, this one does not test the test success
# NOTE: the regular gcc compiler (v xxx) does NOT support this option!
# conditions. instead, it performs the operations to be tested and relies on you
#-------------------------------------------------------------------------------
# to compare the logs from the logic simulation and the software simulation.
# Summary of differences to original code:
# Test that work this way have been commented with this tag: "@log"
#
#
# 1.- MUL* or DIV* are not implemented so that part has been commented out.
#-------------------------------------------------------------------------------
# 2.- Plasma does not need a 'delay slot' after a L* before the result is used,
# NOTE: NOPs have been inserted after load instructions.
#     unlike the conventional MIPS-I architecture. In this code NOPs have been
 
#     inserted where necessary so that it works whether or not the core has load
 
#     delay slots (as opposed to load interlock). This means that this code
 
#     can't be used to validate load interlock implementation.
 
#
#
################################################################################
################################################################################
 
 
 
    #-- Set flags below to >0 to enable/disable test assembly ------------------
 
 
    # Set to >0 to test unaligned loads and/or stores
    .set TEST_UNALIGNED_LOADS, 0        # unaligned loads
    .set TEST_UNALIGNED_LOADS, 0
    .set TEST_UNALIGNED_STORES, 0       # unaligned stores
    .set TEST_UNALIGNED_STORES, 0
    .set TEST_BREAK, 1                  # BREAK instruction
 
    # WARNING: the assembler expands div instructions, see 'as' manual
    .text
    .set TEST_DIV, 0                    # DIV* instructions
    .align  2
    .set TEST_MUL, 0                    # MUL* instructions
    .globl  entry
 
    .ent    entry
    #---------------------------------------------------------------------------
entry:
 
    .set    noreorder
    .text
 
    .align  2
    la      $gp, _gp            #initialize stack pointer
    .globl  entry
    la      $4, __bss_start     #$4 = .sbss_start
    .ent    entry
    la      $5, _end            #$5 = .bss_end
entry:
    nop                         #no stack needed
    .set    noreorder
    nop
 
 
    la      $gp, _gp            #initialize stack pointer
 
    la      $4, __bss_start     #$4 = .sbss_start
 
    la      $5, _end            #$5 = .bss_end
 
    nop                         #no stack needed
 
    nop
 
 
    b       StartTest
    b       StartTest
    nop                         #nops required to place ISR at 0x3c
    nop                         #nops required to place ISR at 0x3c
    nop
    nop
 
 
OS_AsmPatchValue:
OS_AsmPatchValue:
    #Code to place at address 0x3c
    #Code to place at address 0x3c
    lui     $26, 0x1000
    lui     $26, 0x1000
    ori     $26, $26, 0x3c
    ori     $26, $26, 0x3c
    jr      $26
    jr      $26
    nop
    nop
 
 
    .org    0x3c
    .org    0x3c
InterruptVector:                # Address=0x3c
InterruptVector:                # Address=0x3c
    mfc0    $26,$14             # C0_EPC=14 (Exception PC)
    mfc0    $26,$14             # C0_EPC=14 (Exception PC)
    jr      $26
    jr      $26
    add     $4,$4,5
    add     $4,$4,5
 
 
StartTest:
StartTest:
    mtc0    $0,$12              # disable interrupts
    mtc0    $0,$12              # disable interrupts
    lui     $20,0x2000          # serial port write address
    lui     $20,0x2000          # serial port write address
    ori     $21,$0,'\n'         # <CR> character
    ori     $21,$0,'\n'         # <CR> character
    ori     $22,$0,'X'          # 'X' letter
    ori     $22,$0,'X'          # 'X' letter
    ori     $23,$0,'\r'
    ori     $23,$0,'\r'
    ori     $24,$0,0x0f80       # temp memory
    ori     $24,$0,0x0f80       # temp memory
 
 
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #Patch interrupt vector to 0x1000003c
    #Patch interrupt vector to 0x1000003c
    la      $5, OS_AsmPatchValue
    la      $5, OS_AsmPatchValue
    sub     $6,$5,0x1000
    sub     $6,$5,0x1000
    blez    $6,NoPatch
    blez    $6,NoPatch
    nop
    nop
    #lw     $6, 0($5)
    #lw     $6, 0($5)
    #sw     $6, 0x3c($0)
    #sw     $6, 0x3c($0)
    #lw     $6, 4($5)
    #lw     $6, 4($5)
    #sw     $6, 0x40($0)
    #sw     $6, 0x40($0)
    #lw     $6, 8($5)
    #lw     $6, 8($5)
    #sw     $6, 0x44($0)
    #sw     $6, 0x44($0)
    #lw     $6, 12($5)
    #lw     $6, 12($5)
    #sw     $6, 0x48($0)
    #sw     $6, 0x48($0)
NoPatch:
NoPatch:
 
 
    ######################################
    ######################################
    #Arithmetic Instructions
    #Arithmetic Instructions
    ######################################
    ######################################
ArthmeticTest:
ArthmeticTest:
    ori     $2,$0,'A'
    ori     $2,$0,'A'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'r'
    ori     $2,$0,'r'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'i'
    ori     $2,$0,'i'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'t'
    ori     $2,$0,'t'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'h'
    ori     $2,$0,'h'
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #a: ADD
    #a: ADD
    ori     $2,$0,'a'
    ori     $2,$0,'a'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $3,$0,5
    ori     $3,$0,5
    ori     $4,$0,60
    ori     $4,$0,60
    add     $2,$3,$4
    add     $2,$3,$4
    sb      $2,0($20)    #A
    sb      $2,0($20)    #A
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #b: ADDI
    #b: ADDI
    ori     $2,$0,'b'
    ori     $2,$0,'b'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $4,$0,60
    ori     $4,$0,60
    addi    $2,$4,5
    addi    $2,$4,5
    sb      $2,0($20)    #A
    sb      $2,0($20)    #A
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #c: ADDIU
    #c: ADDIU
    ori     $2,$0,'c'
    ori     $2,$0,'c'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $4,$0,50
    ori     $4,$0,50
    addiu   $5,$4,15
    addiu   $5,$4,15
    sb      $5,0($20)    #A
    sb      $5,0($20)    #A
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #d: ADDU
    #d: ADDU
    ori     $2,$0,'d'
    ori     $2,$0,'d'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $3,$0,5
    ori     $3,$0,5
    ori     $4,$0,60
    ori     $4,$0,60
    add     $2,$3,$4
    add     $2,$3,$4
    sb      $2,0($20)    #A
    sb      $2,0($20)    #A
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    # DIV not implemented so skip div test
    # DIV tests, skip conditionally
    # FIXME skip conditionaly
    .ifgt TEST_DIV
    j       skip_div_test
 
    nop
    #e: DIV
 
    ori     $2,$0,'e'
    #e: DIV
    sb      $2,0($20)
    ori     $2,$0,'e'
    ori     $2,$0,65*117+41
    sb      $2,0($20)
    ori     $3,$0,117
    ori     $2,$0,65*117+41
    div     $2,$3
    ori     $3,$0,117
    nop
    div     $2,$3
    mflo    $4
    nop
    sb      $4,0($20)    #A
    mflo    $4
    mfhi    $4
    sb      $4,0($20)    #A
    addi    $4,$4,66-41
    mfhi    $4
    sb      $4,0($20)    #B
    addi    $4,$4,66-41
    li      $2,-67*19
    sb      $4,0($20)    #B
    ori     $3,$0,19
    li      $2,-67*19
    div     $2,$3
    ori     $3,$0,19
    nop
    div     $2,$3
    mflo    $4
    nop
    sub     $4,$0,$4
    mflo    $4
    sb      $4,0($20)    #C
    sub     $4,$0,$4
    ori     $2,$0,68*23
    sb      $4,0($20)    #C
    li      $3,-23
    ori     $2,$0,68*23
    div     $2,$3
    li      $3,-23
    nop
    div     $2,$3
    mflo    $4
    nop
    sub     $4,$0,$4
    mflo    $4
    sb      $4,0($20)    #D
    sub     $4,$0,$4
    li      $2,-69*13
    sb      $4,0($20)    #D
    li      $3,-13
    li      $2,-69*13
    div     $2,$3
    li      $3,-13
    mflo    $4
    div     $2,$3
    sb      $4,0($20)    #E
    mflo    $4
    sb      $23,0($20)
    sb      $4,0($20)    #E
    sb      $21,0($20)
    sb      $23,0($20)
 
    sb      $21,0($20)
    #f: DIVU
 
    ori     $2,$0,'f'
    #f: DIVU
    sb      $2,0($20)
    ori     $2,$0,'f'
    ori     $2,$0,65*13
    sb      $2,0($20)
    ori     $3,$0,13
    ori     $2,$0,65*13
    divu    $2,$3
    ori     $3,$0,13
    nop
    divu    $2,$3
    mflo    $4
    nop
    sb      $4,0($20)    #A
    mflo    $4
    sb      $23,0($20)
    sb      $4,0($20)    #A
    sb      $21,0($20)
    sb      $23,0($20)
    .endif
    sb      $21,0($20)
 
 
    # MUL tests, skip conditionally
skip_div_test:
    .ifgt   TEST_MUL
 
 
    # MUL not implemented so skip mul test
    #g: MULT
    # FIXME skip conditionaly
    ori     $2,$0,'g'
    j       skip_mult_test
    sb      $2,0($20)
    nop
    ori     $2,$0,5
 
    ori     $3,$0,13
    #g: MULT
    mult    $2,$3
    ori     $2,$0,'g'
    nop
    sb      $2,0($20)
    mflo    $4
    ori     $2,$0,5
    sb      $4,0($20)    #A
    ori     $3,$0,13
    li      $2,-5
    mult    $2,$3
    ori     $3,$0,13
    nop
    mult    $2,$3
    mflo    $4
    mfhi    $5
    sb      $4,0($20)    #A
    mflo    $4
    li      $2,-5
    sub     $4,$0,$4
    ori     $3,$0,13
    addu    $4,$4,$5
    mult    $2,$3
    addi    $4,$4,2
    mfhi    $5
    sb      $4,0($20)    #B
    mflo    $4
    ori     $2,$0,5
    sub     $4,$0,$4
    li      $3,-13
    addu    $4,$4,$5
    mult    $2,$3
    addi    $4,$4,2
    mfhi    $5
    sb      $4,0($20)    #B
    mflo    $4
    ori     $2,$0,5
    sub     $4,$0,$4
    li      $3,-13
    addu    $4,$4,$5
    mult    $2,$3
    addi    $4,$4,3
    mfhi    $5
    sb      $4,0($20)    #C
    mflo    $4
    li      $2,-5
    sub     $4,$0,$4
    li      $3,-13
    addu    $4,$4,$5
    mult    $2,$3
    addi    $4,$4,3
    mfhi    $5
    sb      $4,0($20)    #C
    mflo    $4
    li      $2,-5
    addu    $4,$4,$5
    li      $3,-13
    addi    $4,$4,3
    mult    $2,$3
    sb      $4,0($20)    #D
    mfhi    $5
    lui     $4,0xfe98
    mflo    $4
    ori     $4,$4,0x62e5
    addu    $4,$4,$5
    lui     $5,0x6
    addi    $4,$4,3
    ori     $5,0x8db8
    sb      $4,0($20)    #D
    mult    $4,$5
    lui     $4,0xfe98
    mfhi    $6
    ori     $4,$4,0x62e5
    addiu   $7,$6,2356+1+'E' #E
    lui     $5,0x6
    sb      $7,0($20)
    ori     $5,0x8db8
    sb      $23,0($20)
    mult    $4,$5
    sb      $21,0($20)
    mfhi    $6
 
    addiu   $7,$6,2356+1+'E' #E
    #h: MULTU
    sb      $7,0($20)
    ori     $2,$0,'h'
    sb      $23,0($20)
    sb      $2,0($20)
    sb      $21,0($20)
    ori     $2,$0,5
 
    ori     $3,$0,13
    #h: MULTU
    multu   $2,$3
    ori     $2,$0,'h'
    nop
    sb      $2,0($20)
    mflo    $4
    ori     $2,$0,5
    sb      $4,0($20)    #A
    ori     $3,$0,13
    sb      $23,0($20)
    multu   $2,$3
    sb      $21,0($20)
    nop
    .endif
    mflo    $4
 
    sb      $4,0($20)    #A
    #i: SLT
    sb      $23,0($20)
    ori     $2,$0,'i'
    sb      $21,0($20)
    sb      $2,0($20)
 
    ori     $2,$0,10
skip_mult_test:
    ori     $3,$0,12
 
    slt     $4,$2,$3
    #i: SLT
    addi    $5,$4,64
    ori     $2,$0,'i'
    sb      $5,0($20)    #A
    sb      $2,0($20)
    slt     $4,$3,$2
    ori     $2,$0,10
    addi    $5,$4,66
    ori     $3,$0,12
    sb      $5,0($20)    #B
    slt     $4,$2,$3
    li      $2,0xfffffff0
    addi    $5,$4,64
    slt     $4,$2,$3
    sb      $5,0($20)    #A
    addi    $5,$4,66
    slt     $4,$3,$2
    sb      $5,0($20)    #C
    addi    $5,$4,66
    slt     $4,$3,$2
    sb      $5,0($20)    #B
    addi    $5,$4,68
    li      $2,0xfffffff0
    sb      $5,0($20)    #D
    slt     $4,$2,$3
    li      $3,0xffffffff
    addi    $5,$4,66
    slt     $4,$2,$3
    sb      $5,0($20)    #C
    addi    $5,$4,68
    slt     $4,$3,$2
    sb      $5,0($20)    #E
    addi    $5,$4,68
    slt     $4,$3,$2
    sb      $5,0($20)    #D
    addi    $5,$4,70
    li      $3,0xffffffff
    sb      $5,0($20)    #F
    slt     $4,$2,$3
    sb      $23,0($20)
    addi    $5,$4,68
    sb      $21,0($20)
    sb      $5,0($20)    #E
 
    slt     $4,$3,$2
    #j: SLTI
    addi    $5,$4,70
    ori     $2,$0,'j'
    sb      $5,0($20)    #F
    sb      $2,0($20)
    sb      $23,0($20)
    ori     $2,$0,10
    sb      $21,0($20)
    slti    $4,$2,12
 
    addi    $5,$4,64
    #j: SLTI
    sb      $5,0($20)    #A
    ori     $2,$0,'j'
    slti    $4,$2,8
    sb      $2,0($20)
    addi    $5,$4,66
    ori     $2,$0,10
    sb      $5,0($20)    #B
    slti    $4,$2,12
    sb      $23,0($20)
    addi    $5,$4,64
    sb      $21,0($20)
    sb      $5,0($20)    #A
 
    slti    $4,$2,8
    #k: SLTIU
    addi    $5,$4,66
    ori     $2,$0,'k'
    sb      $5,0($20)    #B
    sb      $2,0($20)
    sb      $23,0($20)
    ori     $2,$0,10
    sb      $21,0($20)
    sltiu   $4,$2,12
 
    addi    $5,$4,64
    #k: SLTIU
    sb      $5,0($20)    #A
    ori     $2,$0,'k'
    sltiu   $4,$2,8
    sb      $2,0($20)
    addi    $5,$4,66
    ori     $2,$0,10
    sb      $5,0($20)    #B
    sltiu   $4,$2,12
    sb      $23,0($20)
    addi    $5,$4,64
    sb      $21,0($20)
    sb      $5,0($20)    #A
 
    sltiu   $4,$2,8
    #l: SLTU
    addi    $5,$4,66
    ori     $2,$0,'l'
    sb      $5,0($20)    #B
    sb      $2,0($20)
    sb      $23,0($20)
    ori     $2,$0,10
    sb      $21,0($20)
    ori     $3,$0,12
 
    slt     $4,$2,$3
    #l: SLTU
    addi    $5,$4,64
    ori     $2,$0,'l'
    sb      $5,0($20)    #A
    sb      $2,0($20)
    slt     $4,$3,$2
    ori     $2,$0,10
    addi    $5,$4,66
    ori     $3,$0,12
    sb      $5,0($20)    #B
    slt     $4,$2,$3
    sb      $23,0($20)
    addi    $5,$4,64
    sb      $21,0($20)
    sb      $5,0($20)    #A
 
    slt     $4,$3,$2
    #m: SUB
    addi    $5,$4,66
    ori     $2,$0,'m'
    sb      $5,0($20)    #B
    sb      $2,0($20)
    sb      $23,0($20)
    ori     $3,$0,70
    sb      $21,0($20)
    ori     $4,$0,5
 
    sub     $2,$3,$4
    #m: SUB
    sb      $2,0($20)    #A
    ori     $2,$0,'m'
    sb      $23,0($20)
    sb      $2,0($20)
    sb      $21,0($20)
    ori     $3,$0,70
 
    ori     $4,$0,5
    #n: SUBU
    sub     $2,$3,$4
    ori     $2,$0,'n'
    sb      $2,0($20)    #A
    sb      $2,0($20)
    sb      $23,0($20)
    ori     $3,$0,70
    sb      $21,0($20)
    ori     $4,$0,5
 
    sub     $2,$3,$4
    #n: SUBU
    sb      $2,0($20)    #A
    ori     $2,$0,'n'
    sb      $23,0($20)
    sb      $2,0($20)
    sb      $21,0($20)
    ori     $3,$0,70
 
    ori     $4,$0,5
 
    sub     $2,$3,$4
 
    sb      $2,0($20)    #A
 
    sb      $23,0($20)
 
    sb      $21,0($20)
 
 
 
    ######################################
    ######################################
    #Branch and Jump Instructions
    #Branch and Jump Instructions
    ######################################
    ######################################
BranchTest:
BranchTest:
    ori     $2,$0,'B'
    ori     $2,$0,'B'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'r'
    ori     $2,$0,'r'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'a'
    ori     $2,$0,'a'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'n'
    ori     $2,$0,'n'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'c'
    ori     $2,$0,'c'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'h'
    ori     $2,$0,'h'
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #a: B
    #a: B
    ori     $2,$0,'a'
    ori     $2,$0,'a'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $10,$0,'A'
    ori     $10,$0,'A'
    ori     $11,$0,'B'
    ori     $11,$0,'B'
    b       $B1
    b       $B1
    sb      $10,0($20)
    sb      $10,0($20)
    sb      $22,0($20)
    sb      $22,0($20)
$B1:
$B1:
    sb      $11,0($20)
    sb      $11,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #b: BAL
    #b: BAL
    ori     $2,$0,'b'
    ori     $2,$0,'b'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $10,$0,'A'
    ori     $10,$0,'A'
    ori     $11,$0,'B'
    ori     $11,$0,'B'
    ori     $12,$0,'C'
    ori     $12,$0,'C'
    ori     $13,$0,'D'
    ori     $13,$0,'D'
    ori     $14,$0,'E'
    ori     $14,$0,'E'
    ori     $15,$0,'X'
    ori     $15,$0,'X'
    bal     $BAL1
    bal     $BAL1
    sb      $10,0($20)
    sb      $10,0($20)
    sb      $13,0($20)
    sb      $13,0($20)
    b       $BAL2
    b       $BAL2
    sb      $14,0($20)
    sb      $14,0($20)
    sb      $15,0($20)
    sb      $15,0($20)
$BAL1:
$BAL1:
    sb      $11,0($20)
    sb      $11,0($20)
    jr      $31
    jr      $31
    sb      $12,0($20)
    sb      $12,0($20)
    sb      $22,0($20)
    sb      $22,0($20)
$BAL2:
$BAL2:
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #c: BEQ
    #c: BEQ
    ori     $2,$0,'c'
    ori     $2,$0,'c'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $10,$0,'A'
    ori     $10,$0,'A'
    ori     $11,$0,'B'
    ori     $11,$0,'B'
    ori     $12,$0,'C'
    ori     $12,$0,'C'
    ori     $13,$0,'D'
    ori     $13,$0,'D'
    ori     $2,$0,100
    ori     $2,$0,100
    ori     $3,$0,123
    ori     $3,$0,123
    ori     $4,$0,123
    ori     $4,$0,123
    beq     $2,$3,$BEQ1
    beq     $2,$3,$BEQ1
    sb      $10,0($20)
    sb      $10,0($20)
    sb      $11,0($20)
    sb      $11,0($20)
    beq     $3,$4,$BEQ1
    beq     $3,$4,$BEQ1
    sb      $12,0($20)
    sb      $12,0($20)
    sb      $22,0($20)
    sb      $22,0($20)
$BEQ1:
$BEQ1:
    sb      $13,0($20)
    sb      $13,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #d: BGEZ
    #d: BGEZ
    ori     $2,$0,'d'
    ori     $2,$0,'d'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $10,$0,'A'
    ori     $10,$0,'A'
    ori     $11,$0,'B'
    ori     $11,$0,'B'
    ori     $12,$0,'C'
    ori     $12,$0,'C'
    ori     $13,$0,'D'
    ori     $13,$0,'D'
    or      $15,$0,'X'
    or      $15,$0,'X'
    ori     $2,$0,100
    ori     $2,$0,100
    li      $3,0xffff1234
    li      $3,0xffff1234
    ori     $4,$0,123
    ori     $4,$0,123
    bgez    $3,$BGEZ1
    bgez    $3,$BGEZ1
    sb      $10,0($20)
    sb      $10,0($20)
    sb      $11,0($20)
    sb      $11,0($20)
    bgez    $2,$BGEZ1
    bgez    $2,$BGEZ1
    sb      $12,0($20)
    sb      $12,0($20)
    sb      $22,0($20)
    sb      $22,0($20)
$BGEZ1:
$BGEZ1:
    bgez    $0,$BGEZ2
    bgez    $0,$BGEZ2
    nop
    nop
    sb      $15,0($20)
    sb      $15,0($20)
$BGEZ2:
$BGEZ2:
    sb      $13,0($20)
    sb      $13,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #e: BGEZAL
    #e: BGEZAL
    ori     $2,$0,'e'
    ori     $2,$0,'e'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $10,$0,'A'
    ori     $10,$0,'A'
    ori     $11,$0,'B'
    ori     $11,$0,'B'
    ori     $12,$0,'C'
    ori     $12,$0,'C'
    ori     $13,$0,'D'
    ori     $13,$0,'D'
    ori     $14,$0,'E'
    ori     $14,$0,'E'
    ori     $15,$0,'X'
    ori     $15,$0,'X'
    li      $3,0xffff1234
    li      $3,0xffff1234
    bgezal  $3,$BGEZAL1
    bgezal  $3,$BGEZAL1
    nop
    nop
    sb      $10,0($20)
    sb      $10,0($20)
    bgezal  $0,$BGEZAL1
    bgezal  $0,$BGEZAL1
    nop
    nop
    sb      $13,0($20)
    sb      $13,0($20)
    b       $BGEZAL2
    b       $BGEZAL2
    sb      $14,0($20)
    sb      $14,0($20)
    sb      $15,0($20)
    sb      $15,0($20)
$BGEZAL1:
$BGEZAL1:
    sb      $11,0($20)
    sb      $11,0($20)
    jr      $31
    jr      $31
    sb      $12,0($20)
    sb      $12,0($20)
    sb      $22,0($20)
    sb      $22,0($20)
$BGEZAL2:
$BGEZAL2:
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #f: BGTZ
    #f: BGTZ
    ori     $2,$0,'f'
    ori     $2,$0,'f'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $10,$0,'A'
    ori     $10,$0,'A'
    ori     $11,$0,'B'
    ori     $11,$0,'B'
    ori     $12,$0,'C'
    ori     $12,$0,'C'
    ori     $13,$0,'D'
    ori     $13,$0,'D'
    ori     $2,$0,100
    ori     $2,$0,100
    li      $3,0xffff1234
    li      $3,0xffff1234
    bgtz    $3,$BGTZ1
    bgtz    $3,$BGTZ1
    sb      $10,0($20)
    sb      $10,0($20)
    sb      $11,0($20)
    sb      $11,0($20)
    bgtz    $2,$BGTZ1
    bgtz    $2,$BGTZ1
    sb      $12,0($20)
    sb      $12,0($20)
    sb      $22,0($20)
    sb      $22,0($20)
$BGTZ1:
$BGTZ1:
    sb      $13,0($20)
    sb      $13,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #g: BLEZ
    #g: BLEZ
    ori     $2,$0,'g'
    ori     $2,$0,'g'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $10,$0,'A'
    ori     $10,$0,'A'
    ori     $11,$0,'B'
    ori     $11,$0,'B'
    ori     $12,$0,'C'
    ori     $12,$0,'C'
    ori     $13,$0,'D'
    ori     $13,$0,'D'
    ori     $2,$0,100
    ori     $2,$0,100
    li      $3,0xffff1234
    li      $3,0xffff1234
    blez    $2,$BLEZ1
    blez    $2,$BLEZ1
    sb      $10,0($20)
    sb      $10,0($20)
    sb      $11,0($20)
    sb      $11,0($20)
    blez    $3,$BLEZ1
    blez    $3,$BLEZ1
    sb      $12,0($20)
    sb      $12,0($20)
    sb      $22,0($20)
    sb      $22,0($20)
$BLEZ1:
$BLEZ1:
    blez    $0,$BLEZ2
    blez    $0,$BLEZ2
    nop
    nop
    sb      $22,0($20)
    sb      $22,0($20)
$BLEZ2:
$BLEZ2:
    sb      $13,0($20)
    sb      $13,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #h: BLTZ
    #h: BLTZ
    ori     $2,$0,'h'
    ori     $2,$0,'h'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $10,$0,'A'
    ori     $10,$0,'A'
    ori     $11,$0,'B'
    ori     $11,$0,'B'
    ori     $12,$0,'C'
    ori     $12,$0,'C'
    ori     $13,$0,'D'
    ori     $13,$0,'D'
    ori     $14,$0,'E'
    ori     $14,$0,'E'
    ori     $2,$0,100
    ori     $2,$0,100
    li      $3,0xffff1234
    li      $3,0xffff1234
    ori     $4,$0,0
    ori     $4,$0,0
    bltz    $2,$BLTZ1
    bltz    $2,$BLTZ1
    sb      $10,0($20)
    sb      $10,0($20)
    sb      $11,0($20)
    sb      $11,0($20)
    bltz    $3,$BLTZ1
    bltz    $3,$BLTZ1
    sb      $12,0($20)
    sb      $12,0($20)
    sb      $22,0($20)
    sb      $22,0($20)
$BLTZ1:
$BLTZ1:
    bltz    $4,$BLTZ2
    bltz    $4,$BLTZ2
    nop
    nop
    sb      $13,0($20)
    sb      $13,0($20)
$BLTZ2:
$BLTZ2:
    sb      $14,0($20)
    sb      $14,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #i: BLTZAL
    #i: BLTZAL
    ori     $2,$0,'i'
    ori     $2,$0,'i'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $10,$0,'A'
    ori     $10,$0,'A'
    ori     $11,$0,'B'
    ori     $11,$0,'B'
    ori     $12,$0,'C'
    ori     $12,$0,'C'
    ori     $13,$0,'D'
    ori     $13,$0,'D'
    ori     $14,$0,'E'
    ori     $14,$0,'E'
    ori     $15,$0,'X'
    ori     $15,$0,'X'
    li      $3,0xffff1234
    li      $3,0xffff1234
    bltzal  $0,$BLTZAL1
    bltzal  $0,$BLTZAL1
    nop
    nop
    sb      $10,0($20)
    sb      $10,0($20)
    bltzal  $3,$BLTZAL1
    bltzal  $3,$BLTZAL1
    nop
    nop
    sb      $13,0($20)
    sb      $13,0($20)
    b       $BLTZAL2
    b       $BLTZAL2
    sb      $14,0($20)
    sb      $14,0($20)
    sb      $15,0($20)
    sb      $15,0($20)
$BLTZAL1:
$BLTZAL1:
    sb      $11,0($20)
    sb      $11,0($20)
    jr      $31
    jr      $31
    sb      $12,0($20)
    sb      $12,0($20)
    sb      $22,0($20)
    sb      $22,0($20)
$BLTZAL2:
$BLTZAL2:
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #j: BNE
    #j: BNE
    ori     $2,$0,'j'
    ori     $2,$0,'j'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $10,$0,'A'
    ori     $10,$0,'A'
    ori     $11,$0,'B'
    ori     $11,$0,'B'
    ori     $12,$0,'C'
    ori     $12,$0,'C'
    ori     $13,$0,'D'
    ori     $13,$0,'D'
    ori     $2,$0,100
    ori     $2,$0,100
    ori     $3,$0,123
    ori     $3,$0,123
    ori     $4,$0,123
    ori     $4,$0,123
    bne     $3,$4,$BNE1
    bne     $3,$4,$BNE1
    sb      $10,0($20)
    sb      $10,0($20)
    sb      $11,0($20)
    sb      $11,0($20)
    bne     $2,$3,$BNE1
    bne     $2,$3,$BNE1
    sb      $12,0($20)
    sb      $12,0($20)
    sb      $22,0($20)
    sb      $22,0($20)
$BNE1:
$BNE1:
    sb      $13,0($20)
    sb      $13,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #k: J
    #k: J
    ori     $2,$0,'k'
    ori     $2,$0,'k'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $10,$0,'A'
    ori     $10,$0,'A'
    ori     $11,$0,'B'
    ori     $11,$0,'B'
    ori     $15,$0,'X'
    ori     $15,$0,'X'
    j       $J1
    j       $J1
    sb      $10,0($20)
    sb      $10,0($20)
    sb      $15,0($20)
    sb      $15,0($20)
$J1:
$J1:
    sb      $11,0($20)
    sb      $11,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #l: JAL
    #l: JAL
    ori     $2,$0,'l'
    ori     $2,$0,'l'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $10,$0,'A'
    ori     $10,$0,'A'
    ori     $11,$0,'B'
    ori     $11,$0,'B'
    ori     $12,$0,'C'
    ori     $12,$0,'C'
    ori     $13,$0,'D'
    ori     $13,$0,'D'
    ori     $14,$0,'E'
    ori     $14,$0,'E'
    ori     $15,$0,'X'
    ori     $15,$0,'X'
    jal     $JAL1
    jal     $JAL1
    sb      $10,0($20)
    sb      $10,0($20)
    sb      $13,0($20)
    sb      $13,0($20)
    b       $JAL2
    b       $JAL2
    sb      $14,0($20)
    sb      $14,0($20)
    sb      $15,0($20)
    sb      $15,0($20)
$JAL1:
$JAL1:
    sb      $11,0($20)
    sb      $11,0($20)
    jr      $31
    jr      $31
    sb      $12,0($20)
    sb      $12,0($20)
    sb      $22,0($20)
    sb      $22,0($20)
$JAL2:
$JAL2:
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #m: JALR
    #m: JALR
    ori     $2,$0,'m'
    ori     $2,$0,'m'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $10,$0,'A'
    ori     $10,$0,'A'
    ori     $11,$0,'B'
    ori     $11,$0,'B'
    ori     $12,$0,'C'
    ori     $12,$0,'C'
    ori     $13,$0,'D'
    ori     $13,$0,'D'
    ori     $14,$0,'E'
    ori     $14,$0,'E'
    ori     $15,$0,'X'
    ori     $15,$0,'X'
    la      $3,$JALR1
    la      $3,$JALR1
    jalr    $3
    jalr    $3
    sb      $10,0($20)
    sb      $10,0($20)
    sb      $13,0($20)
    sb      $13,0($20)
    b       $JALR2
    b       $JALR2
    sb      $14,0($20)
    sb      $14,0($20)
    sb      $15,0($20)
    sb      $15,0($20)
$JALR1:
$JALR1:
    sb      $11,0($20)
    sb      $11,0($20)
    jr      $31
    jr      $31
    sb      $12,0($20)
    sb      $12,0($20)
    sb      $22,0($20)
    sb      $22,0($20)
$JALR2:
$JALR2:
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #n: JR
    #n: JR
    ori     $2,$0,'n'
    ori     $2,$0,'n'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $10,$0,'A'
    ori     $10,$0,'A'
    ori     $11,$0,'B'
    ori     $11,$0,'B'
    ori     $15,$0,'X'
    ori     $15,$0,'X'
    la      $3,$JR1
    la      $3,$JR1
    jr      $3
    jr      $3
    sb      $10,0($20)
    sb      $10,0($20)
    sb      $15,0($20)
    sb      $15,0($20)
$JR1:
$JR1:
    sb      $11,0($20)
    sb      $11,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #o: NOP
    #o: NOP
    ori     $2,$0,'o'
    ori     $2,$0,'o'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,65
    ori     $2,$0,65
    nop
    nop
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
 #   b     LoadTest
 #   b     LoadTest
 
 
BreakTest:
 
    #p: BREAK
BreakTest:
    ori     $2,$0,'p'
    .ifgt TEST_BREAK
    sb      $2,0($20)
    #p: BREAK
    ori     $2,$0,'z'
    ori     $2,$0,'p'       # check if it jumps to break address and comes back
    ori     $4,$0,59
    sb      $2,0($20)
    break   0
    ori     $2,$0,'z'
    addi    $4,$4,1
    ori     $4,$0,59
    sb      $4,0($20)
    break   0
    sb      $23,0($20)
    addi    $4,$4,1
    sb      $21,0($20)
    sb      $4,0($20)
 
 
    #q: SYSCALL
    break   0               # check if load instruction is aborted (@log)
    ori     $2,$0,'q'
    lb      $2,16($2)
    sb      $2,0($20)
 
    ori     $4,$0,61
    break   0               # check if jump instruction is aborted (@log)
    syscall 0
    j       break_jump_test
    addi    $4,$4,-1
    add     $4,$4,5
    sb      $4,0($20)
 
    sb      $23,0($20)
break_jump_test:
    sb      $21,0($20)
    add     $4,$4,1         # make sure the jump shows in the log (@log)
 
 
 
    sb      $23,0($20)
 
    sb      $21,0($20)
 
    .endif
 
 
 
    #q: SYSCALL
 
    ori     $2,$0,'q'
 
    sb      $2,0($20)
 
    ori     $4,$0,61
 
    syscall 0
 
    addi    $4,$4,-1
 
    sb      $4,0($20)
 
    sb      $23,0($20)
 
    sb      $21,0($20)
 
 
 
 
    ######################################
    ######################################
    #Load, Store, and Memory Control Instructions
    #Load, Store, and Memory Control Instructions
    ######################################
    ######################################
LoadTest:
LoadTest:
    ori     $2,$0,'L'
    ori     $2,$0,'L'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'o'
    ori     $2,$0,'o'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'a'
    ori     $2,$0,'a'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'d'
    ori     $2,$0,'d'
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #a: LB
    #a: LB
    ori     $2,$0,'a'
    ori     $2,$0,'a'
    sb      $2,0($20)
    sb      $2,0($20)
    or      $2,$0,$24
    or      $2,$0,$24
    li      $3,0x414243fc
    li      $3,0x414243fc
    sw      $3,16($2)              # 16($2)    = 0x414243fc
    sw      $3,16($2)              # 16($2)    = 0x414243fc
    lb      $4,16($2)              # $4        = 0x41
    lb      $4,16($2)              # $4        = 0x41
    sb      $4,0($20)              # UART      = 0x41
    sb      $4,0($20)              # UART      = 0x41
    lb      $4,17($2)              # $4        = 0x42
    lb      $4,17($2)              # $4        = 0x42
    nop
    nop
    sb      $4,0($20)              # UART      = 0x42
    sb      $4,0($20)              # UART      = 0x42
    lb      $4,18($2)              # $4        = 0x43
    lb      $4,18($2)              # $4        = 0x43
    nop
    nop
    sb      $4,0($20)              # UART      = 0x43
    sb      $4,0($20)              # UART      = 0x43
    lb      $2,19($2)              # $2        = 0xffff.fffc
    lb      $2,19($2)              # $2        = 0xffff.fffc
    nop
    nop
    sra     $3,$2,8                # $3        = 0xffff.ffff
    sra     $3,$2,8                # $3        = 0xffff.ffff
    addi    $3,$3,0x45             # $3        = 0x44
    addi    $3,$3,0x45             # $3        = 0x44
    sb      $3,0($20)              # UART      = 0x44
    sb      $3,0($20)              # UART      = 0x44
    addi    $2,$2,0x49             # $4        = 0x45, overflow
    addi    $2,$2,0x49             # $4        = 0x45, overflow
    sb      $2,0($20)              # UART      = 0x45
    sb      $2,0($20)              # UART      = 0x45
    sb      $23,0($20)             # UART      = CR
    sb      $23,0($20)             # UART      = CR
    sb      $21,0($20)             # UART      = LF
    sb      $21,0($20)             # UART      = LF
 
 
    #b: LBU
    #b: LBU
    ori     $2,$0,'b'
    ori     $2,$0,'b'
    sb      $2,0($20)
    sb      $2,0($20)
    or      $2,$0,$24
    or      $2,$0,$24
    li      $3,0x41424344
    li      $3,0x41424344
    sw      $3,16($2)
    sw      $3,16($2)
    lb      $4,16($2)
    lb      $4,16($2)
    sb      $4,0($20)
    sb      $4,0($20)
    lb      $4,17($2)
    lb      $4,17($2)
    sb      $4,0($20)
    sb      $4,0($20)
    lb      $4,18($2)
    lb      $4,18($2)
    sb      $4,0($20)
    sb      $4,0($20)
    lb      $2,19($2)
    lb      $2,19($2)
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #c: LH
    #c: LH
    ori     $2,$0,'c'
    ori     $2,$0,'c'
    sb      $2,0($20)
    sb      $2,0($20)
    or      $2,$0,$24
    or      $2,$0,$24
    li      $3,0x00410042
    li      $3,0x00410042
    sw      $3,16($2)
    sw      $3,16($2)
    lh      $4,16($2)
    lh      $4,16($2)
    sb      $4,0($20)
    sb      $4,0($20)
    lh      $2,18($2)
    lh      $2,18($2)
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #d: LHU
    #d: LHU
    ori     $2,$0,'d'
    ori     $2,$0,'d'
    sb      $2,0($20)
    sb      $2,0($20)
    or      $2,$0,$24
    or      $2,$0,$24
    li      $3,0x00410042
    li      $3,0x00410042
    sw      $3,16($2)
    sw      $3,16($2)
    lh      $4,16($2)
    lh      $4,16($2)
    sb      $4,0($20)
    sb      $4,0($20)
    lh      $2,18($2)
    lh      $2,18($2)
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #e: LW
    #e: LW
    ori     $2,$0,'e'
    ori     $2,$0,'e'
    sb      $2,0($20)
    sb      $2,0($20)
    or      $2,$0,$24
    or      $2,$0,$24
    li      $3,'A'
    li      $3,'A'
    sw      $3,16($2)
    sw      $3,16($2)
    ori     $3,$0,0
    ori     $3,$0,0
    lw      $2,16($2)
    lw      $2,16($2)
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    .ifgt TEST_UNALIGNED_LOADS
    .ifgt TEST_UNALIGNED_LOADS
    #f: LWL & LWR
    #f: LWL & LWR
    ori     $2,$0,'f'
    ori     $2,$0,'f'
    sb      $2,0($20)
    sb      $2,0($20)
    or      $2,$0,$24
    or      $2,$0,$24
    li      $3,'A'
    li      $3,'A'
    sw      $3,16($2)
    sw      $3,16($2)
    ori     $3,$0,0
    ori     $3,$0,0
    lwl     $2,16($2)
    lwl     $2,16($2)
    lwr     $2,16($2)
    lwr     $2,16($2)
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
    .endif
    .endif
 
 
    #g: SB
    #g: SB
    ori     $2,$0,'g'
    ori     $2,$0,'g'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'A'
    ori     $2,$0,'A'
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #h: SH
    #h: SH
    ori     $2,$0,'h'
    ori     $2,$0,'h'
    sb      $2,0($20)
    sb      $2,0($20)
    or      $4,$0,$24
    or      $4,$0,$24
    ori     $2,$0,0x4142
    ori     $2,$0,0x4142
    sh      $2,16($4)
    sh      $2,16($4)
    lb      $3,16($4)
    lb      $3,16($4)
    sb      $3,0($20)
    sb      $3,0($20)
    lb      $2,17($4)
    lb      $2,17($4)
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #i: SW
    #i: SW
    ori     $2,$0,'i'
    ori     $2,$0,'i'
    sb      $2,0($20)
    sb      $2,0($20)
    or      $2,$0,$24
    or      $2,$0,$24
    li      $3,0x41424344
    li      $3,0x41424344
    sw      $3,16($2)
    sw      $3,16($2)
    lb      $4,16($2)
    lb      $4,16($2)
    sb      $4,0($20)
    sb      $4,0($20)
    lb      $4,17($2)
    lb      $4,17($2)
    sb      $4,0($20)
    sb      $4,0($20)
    lb      $4,18($2)
    lb      $4,18($2)
    sb      $4,0($20)
    sb      $4,0($20)
    lb      $2,19($2)
    lb      $2,19($2)
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    .ifgt  TEST_UNALIGNED_STORES
    .ifgt  TEST_UNALIGNED_STORES
    #j: SWL & SWR
    #j: SWL & SWR
    ori     $2,$0,'j'
    ori     $2,$0,'j'
    sb      $2,0($20)
    sb      $2,0($20)
    or      $2,$0,$24
    or      $2,$0,$24
    li      $3,0x41424344
    li      $3,0x41424344
    swl     $3,16($2)
    swl     $3,16($2)
    swr     $3,16($2)
    swr     $3,16($2)
    lb      $4,16($2)
    lb      $4,16($2)
    sb      $4,0($20)
    sb      $4,0($20)
    lb      $4,17($2)
    lb      $4,17($2)
    sb      $4,0($20)
    sb      $4,0($20)
    lb      $4,18($2)
    lb      $4,18($2)
    sb      $4,0($20)
    sb      $4,0($20)
    lb      $2,19($2)
    lb      $2,19($2)
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
    .endif
    .endif
 
 
    ######################################
    ######################################
    #Logical Instructions
    #Logical Instructions
    ######################################
    ######################################
LogicalTest:
LogicalTest:
    ori     $2,$0,'L'
    ori     $2,$0,'L'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'o'
    ori     $2,$0,'o'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'g'
    ori     $2,$0,'g'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'i'
    ori     $2,$0,'i'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'c'
    ori     $2,$0,'c'
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #a: AND
    #a: AND
    ori     $2,$0,'a'
    ori     $2,$0,'a'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,0x0741
    ori     $2,$0,0x0741
    ori     $3,$0,0x60f3
    ori     $3,$0,0x60f3
    and     $4,$2,$3
    and     $4,$2,$3
    sb      $4,0($20)
    sb      $4,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #b: ANDI
    #b: ANDI
    ori     $2,$0,'b'
    ori     $2,$0,'b'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,0x0741
    ori     $2,$0,0x0741
    andi    $4,$2,0x60f3
    andi    $4,$2,0x60f3
    sb      $4,0($20)
    sb      $4,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #c: LUI
    #c: LUI
    ori     $2,$0,'c'
    ori     $2,$0,'c'
    sb      $2,0($20)
    sb      $2,0($20)
    lui     $2,0x41
    lui     $2,0x41
    srl     $3,$2,16
    srl     $3,$2,16
    sb      $3,0($20)
    sb      $3,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #d: NOR
    #d: NOR
    ori     $2,$0,'d'
    ori     $2,$0,'d'
    sb      $2,0($20)
    sb      $2,0($20)
    li      $2,0xf0fff08e
    li      $2,0xf0fff08e
    li      $3,0x0f0f0f30
    li      $3,0x0f0f0f30
    nor     $4,$2,$3
    nor     $4,$2,$3
    sb      $4,0($20)
    sb      $4,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #e: OR
    #e: OR
    ori     $2,$0,'e'
    ori     $2,$0,'e'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,0x40
    ori     $2,$0,0x40
    ori     $3,$0,0x01
    ori     $3,$0,0x01
    or      $4,$2,$3
    or      $4,$2,$3
    sb      $4,0($20)
    sb      $4,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #f: ORI
    #f: ORI
    ori     $2,$0,'f'
    ori     $2,$0,'f'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,0x40
    ori     $2,$0,0x40
    ori     $4,$2,0x01
    ori     $4,$2,0x01
    sb      $4,0($20)
    sb      $4,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #g: XOR
    #g: XOR
    ori     $2,$0,'g'
    ori     $2,$0,'g'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,0xf043
    ori     $2,$0,0xf043
    ori     $3,$0,0xf002
    ori     $3,$0,0xf002
    xor     $4,$2,$3
    xor     $4,$2,$3
    sb      $4,0($20)
    sb      $4,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #h: XORI
    #h: XORI
    ori     $2,$0,'h'
    ori     $2,$0,'h'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,0xf043
    ori     $2,$0,0xf043
    xor     $4,$2,0xf002
    xor     $4,$2,0xf002
    sb      $4,0($20)
    sb      $4,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
 
 
    ######################################
    ######################################
    #Move Instructions
    #Move Instructions
    ######################################
    ######################################
MoveTest:
MoveTest:
    ori     $2,$0,'M'
    ori     $2,$0,'M'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'o'
    ori     $2,$0,'o'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'v'
    ori     $2,$0,'v'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'e'
    ori     $2,$0,'e'
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #a: MFHI
    #a: MFHI
    ori     $2,$0,'a'
    ori     $2,$0,'a'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,65
    ori     $2,$0,65
    mthi    $2
    mthi    $2
    mfhi    $3
    mfhi    $3
    sb      $3,0($20)
    sb      $3,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #b: MFLO
    #b: MFLO
    ori     $2,$0,'b'
    ori     $2,$0,'b'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,65
    ori     $2,$0,65
    mtlo    $2
    mtlo    $2
    mflo    $3
    mflo    $3
    sb      $3,0($20)
    sb      $3,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #c: MTHI
    #c: MTHI
    ori     $2,$0,'c'
    ori     $2,$0,'c'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,65
    ori     $2,$0,65
    mthi    $2
    mthi    $2
    mfhi    $3
    mfhi    $3
    sb      $3,0($20)
    sb      $3,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #d: MTLO
    #d: MTLO
    ori     $2,$0,'d'
    ori     $2,$0,'d'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,65
    ori     $2,$0,65
    mtlo    $2
    mtlo    $2
    mflo    $3
    mflo    $3
    sb      $3,0($20)
    sb      $3,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
 
 
    ######################################
    ######################################
    #Shift Instructions
    #Shift Instructions
    ######################################
    ######################################
ShiftTest:
ShiftTest:
    ori     $2,$0,'S'
    ori     $2,$0,'S'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'h'
    ori     $2,$0,'h'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'i'
    ori     $2,$0,'i'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'f'
    ori     $2,$0,'f'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'t'
    ori     $2,$0,'t'
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #a: SLL
    #a: SLL
    ori     $2,$0,'a'
    ori     $2,$0,'a'
    sb      $2,0($20)
    sb      $2,0($20)
    li      $2,0x40414243
    li      $2,0x40414243
    sll     $3,$2,8
    sll     $3,$2,8
    srl     $3,$3,24
    srl     $3,$3,24
    sb      $3,0($20)
    sb      $3,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #b: SLLV
    #b: SLLV
    ori     $2,$0,'b'
    ori     $2,$0,'b'
    sb      $2,0($20)
    sb      $2,0($20)
    li      $2,0x40414243
    li      $2,0x40414243
    ori     $3,$0,8
    ori     $3,$0,8
    sllv    $3,$2,$3
    sllv    $3,$2,$3
    srl     $3,$3,24
    srl     $3,$3,24
    sb      $3,0($20)
    sb      $3,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #c: SRA
    #c: SRA
    ori     $2,$0,'c'
    ori     $2,$0,'c'
    sb      $2,0($20)
    sb      $2,0($20)
    li      $2,0x40414243
    li      $2,0x40414243
    sra     $3,$2,16
    sra     $3,$2,16
    sb      $3,0($20)
    sb      $3,0($20)
    li      $2,0x84000000
    li      $2,0x84000000
    sra     $3,$2,25
    sra     $3,$2,25
    sub     $3,$3,0x80
    sub     $3,$3,0x80
    sb      $3,0($20)
    sb      $3,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #d: SRAV
    #d: SRAV
    ori     $2,$0,'d'
    ori     $2,$0,'d'
    sb      $2,0($20)
    sb      $2,0($20)
    li      $2,0x40414243
    li      $2,0x40414243
    ori     $3,$0,16
    ori     $3,$0,16
    srav    $3,$2,$3
    srav    $3,$2,$3
    sb      $3,0($20)
    sb      $3,0($20)
    ori     $3,$0,25
    ori     $3,$0,25
    li      $2,0x84000000
    li      $2,0x84000000
    srav    $3,$2,$3
    srav    $3,$2,$3
    sub     $3,$3,0x80
    sub     $3,$3,0x80
    sb      $3,0($20)
    sb      $3,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #e: SRL
    #e: SRL
    ori     $2,$0,'e'
    ori     $2,$0,'e'
    sb      $2,0($20)
    sb      $2,0($20)
    li      $2,0x40414243
    li      $2,0x40414243
    srl     $3,$2,16
    srl     $3,$2,16
    sb      $3,0($20)
    sb      $3,0($20)
    li      $2,0x84000000
    li      $2,0x84000000
    srl     $3,$2,25
    srl     $3,$2,25
    sb      $3,0($20)
    sb      $3,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
    #f: SRLV
    #f: SRLV
    ori     $2,$0,'f'
    ori     $2,$0,'f'
    sb      $2,0($20)
    sb      $2,0($20)
    li      $2,0x40414243
    li      $2,0x40414243
    ori     $3,$0,16
    ori     $3,$0,16
    srlv    $4,$2,$3
    srlv    $4,$2,$3
    sb      $4,0($20)
    sb      $4,0($20)
    ori     $3,$0,25
    ori     $3,$0,25
    li      $2,0x84000000
    li      $2,0x84000000
    srlv    $3,$2,$3
    srlv    $3,$2,$3
    sb      $3,0($20)
    sb      $3,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
 
 
    ori     $2,$0,'D'
    ori     $2,$0,'D'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'o'
    ori     $2,$0,'o'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'n'
    ori     $2,$0,'n'
    sb      $2,0($20)
    sb      $2,0($20)
    ori     $2,$0,'e'
    ori     $2,$0,'e'
    sb      $2,0($20)
    sb      $2,0($20)
    sb      $23,0($20)
    sb      $23,0($20)
    sb      $21,0($20)
    sb      $21,0($20)
 
 
 
 
$DONE:
$DONE:
    j       $DONE
    j       $DONE
    nop
    nop
 
 
 
    .set    reorder
 
    .end    entry
 
 
    .set    reorder
 
    .end    entry
 
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.