Forums - Open Redstone Engineers
Starting with MIPS - Printable Version

+- Forums - Open Redstone Engineers (https://forum.openredstone.org)
+-- Forum: Off-Topic (https://forum.openredstone.org/forum-4.html)
+--- Forum: Programming (https://forum.openredstone.org/forum-8.html)
+--- Thread: Starting with MIPS (/thread-3250.html)



Starting with MIPS - jxu - 04-25-2014

Does anyone have any experience with MIPS? I've found that the machine code used in minecraft CPUs are often very crude compared to actual architectures. I'm not an expert, but usually they have awkward I/O and never handle strings. Also they lack addresses.

Here is some example (modified) code:
Code:
    .text  # Begin
    
    .globl    main
main:

        # Input A
    li    $v0,5                # read_int syscall code = 5
    syscall    
    move    $t0,$v0            # syscall results returned in $v0

        # Input B
    li    $v0,5                # read_int syscall code = 5
    syscall    
    move    $t1,$v0        # syscall results returned in $v0

    add    $t0, $t0, $t1    # A = A + B

        # Print sum (integer)
    li    $v0,1                # print_int syscall code = 1
    move    $a0, $t0            # int to print must be loaded into $a0
    syscall

    li    $v0,4                # print_string syscall code = 4
    la    $a0, newline
    syscall

    li    $v0,10        # exit
    syscall

    # Start .data segment
    .data

newline:   .asciiz    "\n"



RE: Starting with MIPS - Cutlassw30 - 04-25-2014

MIPS is cool and all but I think its "too RISC". No push/pop commands mean you need a software stack which adds a lot of overhead. It also uses memory mapped I/O and while a lot of good processors did use this (MOS 6502 for example) I prefer port mapped I/O for a simpler memory map and programming model. Also the big downside is that MIPS is a fixed length ISA which means code uses a lot of RAM. This is generally not a bad thing for RISC but in MIPS case a lot of bits just go to waste (For example 5 bits EVERY instruction are used as a SHAMT which may only be used with shifting but is wasted space in other RR-type instructions). This is probably why MIPS never caught on and ARM/x86 still rule the market.