• mbaxter's avatar
    cannon: Modularize mipsevm packages (#11135) · 4584c976
    mbaxter authored
    * cannon: Isolate test utilities, rework types to avoid circular dependencies
    
    * cannon: Rollback changes to MIPSEVM.EncodePreimageOracleInput
    
    * cannon: Move open_mips_tests to tests subpackage
    
    * cannon: Update some paths to open_mips_tests
    
    * cannon: Collect oracle utils, move generic tests to tests package
    
    * cannon: Move common state constants and utilities to core pkg
    
    * cannon: Move state.go and state_mt.go into impls package
    
    * cannon: Create a memory subpackage
    
    * cannon: Create exec pkg for mips logic
    
    * cannon: Wrap remaining core files in isolated pkgs
    
    * cannon: Create a few more subpackages
    
    * cannon: Rename state_mt to state
    
    * cannon: Move hex utility
    
    * cannon: Pull loading functionality out of patch.go
    
    * cannon: Remove 'MT' prefixes on multi_threaded/state.go symbols
    
    * cannon: Add compile-time PreimageOracle check back in
    
    * cannon: Undo excessive nesting in core package
    
    * cannon: Reorganize single- and multithreaded pkgs
    
    * cannon: Rename test_util pkg to testutil
    
    * cannon: Move instrumented_state logic into singlethreaded pkg
    
    * cannon: Fix test paths
    
    * cannon: Move core pkgs back to root mipsevm pkg
    
    * cannon: Flatten util pkg back into main mipsevm pkg
    
    * cannon: Cleanup - don't use vmstate for mipsevm pkg
    
    * cannon: Add godoc for FPVMState.GetRegisters()
    
    * cannon: Cleanup - fix pkg name, fn visibility
    4584c976
andi.asm 1.02 KB
###############################################################################
# File         : andi.asm
# Project      : MIPS32 MUX
# Author:      : Grant Ayers (ayers@cs.stanford.edu)
#
# Standards/Formatting:
#   MIPS gas, soft tab, 80 column
#
# Description:
#   Test the functionality of the 'andi' instruction.
#
###############################################################################


    .section .test, "x"
    .balign 4
    .set    noreorder
    .global test
    .ent    test
test:
    lui     $s0, 0xbfff         # Load the base address 0xbffffff0
    ori     $s0, 0xfff0
    ori     $s1, $0, 1          # Prepare the 'done' status

    #### Test code start ####

    ori     $t0, $0,  0xcafe    # A = 0xcafe
    andi    $t1, $t0, 0xaaaa    # B = A & 0xaaaa = 0x8aaa
    andi    $t2, $t1, 0x5555    # C = B & 0x5555 = 0
    sltiu   $v0, $t2, 1

    #### Test code end ####

    sw      $v0, 8($s0)         # Set the test result
    sw      $s1, 4($s0)         # Set 'done'

$done:
    jr      $ra
    nop

    .end test