Alternative for sw MIPS instructionIs mars MIPS simulator Big or Little EndianWhat's the purpose of the LEA instruction?Spim Instruction divisionHow do I achieve the theoretical maximum of 4 FLOPs per cycle?Replacing a 32-bit loop counter with 64-bit introduces crazy performance deviationsMIPS Translation of li pseudo commandmips store instruction offset, and move instructionLoad Doubleword Pseudoinstruction in MIPSMIPS instruction and machine codeMips assembly save return value into specific adressWhat is the mips-command to load 4 bytes at the same time into a register?

If a spaceship ran out of fuel somewhere in space between Earth and Mars, does it slowly drift off to the Sun?

What makes learning more difficult as we age?

Which altitudes are safest for VFR?

What's the hidden joke/meaning behind "Don't drink and park - accidents cause people"?

An impressive body of work

Detail vs. filler

Codility's Permutation Check in C#

How do we know neutrons have no charge?

What is this end portal thingy?

Why aren't faces sharp in my f/1.8 portraits even though I'm carefully using center-point autofocus?

Do interval ratios take overtones into account or solely the fundamental frequency?

Speed and Velocity in Russian

Knights and Knaves: What does C say?

Why is STARTTLS still used?

Top off gas with old oil, is that bad?

Is it possible to use && operator in terminal command template loop?

Windows 10 deletes lots of tiny files super slowly. Anything that can be done to speed it up?

Can I exile my opponent's Progenitus/True-Name Nemesis with Teferi, Hero of Dominaria's emblem?

Why is the Common Agricultural Policy unfavourable to the UK?

Lost passport and visa, tried to reapply, got rejected twice. What are my next steps?

Is determiner 'a' needed here?

What does it mean by "my days-of-the-week underwear only go to Thursday" in this context?

Delete n lines skip 1 line script

How can I model regression with an asymmetric loss function?



Alternative for sw MIPS instruction


Is mars MIPS simulator Big or Little EndianWhat's the purpose of the LEA instruction?Spim Instruction divisionHow do I achieve the theoretical maximum of 4 FLOPs per cycle?Replacing a 32-bit loop counter with 64-bit introduces crazy performance deviationsMIPS Translation of li pseudo commandmips store instruction offset, and move instructionLoad Doubleword Pseudoinstruction in MIPSMIPS instruction and machine codeMips assembly save return value into specific adressWhat is the mips-command to load 4 bytes at the same time into a register?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








-2















What is an alternative to save a word from register into RAM?
For example i can explain lw command as lui, ori. How could be 4 Bytes stored into RAM without using sw?










share|improve this question



















  • 2





    No you can't. lw is not the same as lui and ori. You are probably thinking of la.

    – Jester
    Mar 28 at 19:17











  • Why not? lw loads one word to register. Is not same, but it's possible to do the same with lui and ori. And i'm looking for same instructions set, that could exchange sw.

    – dancingsushii
    Mar 28 at 19:34






  • 3





    No you can not do the same with lui and ori. lw accesses memory, the alternatives don't. You can only use lui/ori to load a known compile-time constant. lw reads memory. Tell me, how do you write for example lw $a0, ($t0) using lui/ori?

    – Jester
    Mar 28 at 19:36







  • 4





    "How could be 4 Bytes stored into RAM without using sw?" By using 4 sb instructions, or 2 sh instructions.

    – Michael
    Mar 28 at 20:45

















-2















What is an alternative to save a word from register into RAM?
For example i can explain lw command as lui, ori. How could be 4 Bytes stored into RAM without using sw?










share|improve this question



















  • 2





    No you can't. lw is not the same as lui and ori. You are probably thinking of la.

    – Jester
    Mar 28 at 19:17











  • Why not? lw loads one word to register. Is not same, but it's possible to do the same with lui and ori. And i'm looking for same instructions set, that could exchange sw.

    – dancingsushii
    Mar 28 at 19:34






  • 3





    No you can not do the same with lui and ori. lw accesses memory, the alternatives don't. You can only use lui/ori to load a known compile-time constant. lw reads memory. Tell me, how do you write for example lw $a0, ($t0) using lui/ori?

    – Jester
    Mar 28 at 19:36







  • 4





    "How could be 4 Bytes stored into RAM without using sw?" By using 4 sb instructions, or 2 sh instructions.

    – Michael
    Mar 28 at 20:45













-2












-2








-2








What is an alternative to save a word from register into RAM?
For example i can explain lw command as lui, ori. How could be 4 Bytes stored into RAM without using sw?










share|improve this question














What is an alternative to save a word from register into RAM?
For example i can explain lw command as lui, ori. How could be 4 Bytes stored into RAM without using sw?







assembly mips instructions






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 19:16









dancingsushiidancingsushii

31 bronze badge




31 bronze badge










  • 2





    No you can't. lw is not the same as lui and ori. You are probably thinking of la.

    – Jester
    Mar 28 at 19:17











  • Why not? lw loads one word to register. Is not same, but it's possible to do the same with lui and ori. And i'm looking for same instructions set, that could exchange sw.

    – dancingsushii
    Mar 28 at 19:34






  • 3





    No you can not do the same with lui and ori. lw accesses memory, the alternatives don't. You can only use lui/ori to load a known compile-time constant. lw reads memory. Tell me, how do you write for example lw $a0, ($t0) using lui/ori?

    – Jester
    Mar 28 at 19:36







  • 4





    "How could be 4 Bytes stored into RAM without using sw?" By using 4 sb instructions, or 2 sh instructions.

    – Michael
    Mar 28 at 20:45












  • 2





    No you can't. lw is not the same as lui and ori. You are probably thinking of la.

    – Jester
    Mar 28 at 19:17











  • Why not? lw loads one word to register. Is not same, but it's possible to do the same with lui and ori. And i'm looking for same instructions set, that could exchange sw.

    – dancingsushii
    Mar 28 at 19:34






  • 3





    No you can not do the same with lui and ori. lw accesses memory, the alternatives don't. You can only use lui/ori to load a known compile-time constant. lw reads memory. Tell me, how do you write for example lw $a0, ($t0) using lui/ori?

    – Jester
    Mar 28 at 19:36







  • 4





    "How could be 4 Bytes stored into RAM without using sw?" By using 4 sb instructions, or 2 sh instructions.

    – Michael
    Mar 28 at 20:45







2




2





No you can't. lw is not the same as lui and ori. You are probably thinking of la.

– Jester
Mar 28 at 19:17





No you can't. lw is not the same as lui and ori. You are probably thinking of la.

– Jester
Mar 28 at 19:17













Why not? lw loads one word to register. Is not same, but it's possible to do the same with lui and ori. And i'm looking for same instructions set, that could exchange sw.

– dancingsushii
Mar 28 at 19:34





Why not? lw loads one word to register. Is not same, but it's possible to do the same with lui and ori. And i'm looking for same instructions set, that could exchange sw.

– dancingsushii
Mar 28 at 19:34




3




3





No you can not do the same with lui and ori. lw accesses memory, the alternatives don't. You can only use lui/ori to load a known compile-time constant. lw reads memory. Tell me, how do you write for example lw $a0, ($t0) using lui/ori?

– Jester
Mar 28 at 19:36






No you can not do the same with lui and ori. lw accesses memory, the alternatives don't. You can only use lui/ori to load a known compile-time constant. lw reads memory. Tell me, how do you write for example lw $a0, ($t0) using lui/ori?

– Jester
Mar 28 at 19:36





4




4





"How could be 4 Bytes stored into RAM without using sw?" By using 4 sb instructions, or 2 sh instructions.

– Michael
Mar 28 at 20:45





"How could be 4 Bytes stored into RAM without using sw?" By using 4 sb instructions, or 2 sh instructions.

– Michael
Mar 28 at 20:45












1 Answer
1






active

oldest

votes


















0
















First of all, lui/ori construct a value in a register from an immediate, without accessing data memory. They're not in any way equivalent to lw. Perhaps you're thinking of li, which is a pseudo-instruction for lui and/or ori. Only load instructions can access memory; immediate ALU instructions take data from the instruction itself but that doesn't really count.




MIPS provides pairs of instructions for loading/storing the left and right parts of an unaligned word. The stores are SWL (left) and SWR (store word right).



Their effect depends on the endian mode of your MIPS (it support big and little endian). MARS simulates a MIPS in little-endian mode.



In little-endian mode, SWL $t1, buf stores the high byte of $t1 to the first byte of buf, for an aligned buf.



In little-endian mode, on an address that is aligned (like sw requires1), SWR acts like SW, storing all 4 bytes.



These instructions are interesting because they can modify 1 to 4 bytes in a word. Including 3 bytes, which you can't do with one sb (byte) or sh (half-word).




http://db.cs.duke.edu/courses/fall02/cps104/homework/lwswlr.html explains how to use the SPARC instructions of the same name. I think MIPS (in big-endian mode) would be the same, and MIPS in little-endian mode like MARS simulates is like that but reversed.



So in big-endian mode, I think swl is equivalent to sw for aligned addresses, but I haven't tested.




Footnote 1:
MIPS32R6 removed LWL/R, and requires LW to support unaligned store / load. Wikipedia doesn't mention stores for that, only loads.



See also https://www.linux-mips.org/wiki/Alignment: Linux MIPS has a kernel option to emulate unaligned load/store instead of delivering SIGBUS on unaligned LW or SW.






share|improve this answer



























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405306%2falternative-for-sw-mips-instruction%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0
















    First of all, lui/ori construct a value in a register from an immediate, without accessing data memory. They're not in any way equivalent to lw. Perhaps you're thinking of li, which is a pseudo-instruction for lui and/or ori. Only load instructions can access memory; immediate ALU instructions take data from the instruction itself but that doesn't really count.




    MIPS provides pairs of instructions for loading/storing the left and right parts of an unaligned word. The stores are SWL (left) and SWR (store word right).



    Their effect depends on the endian mode of your MIPS (it support big and little endian). MARS simulates a MIPS in little-endian mode.



    In little-endian mode, SWL $t1, buf stores the high byte of $t1 to the first byte of buf, for an aligned buf.



    In little-endian mode, on an address that is aligned (like sw requires1), SWR acts like SW, storing all 4 bytes.



    These instructions are interesting because they can modify 1 to 4 bytes in a word. Including 3 bytes, which you can't do with one sb (byte) or sh (half-word).




    http://db.cs.duke.edu/courses/fall02/cps104/homework/lwswlr.html explains how to use the SPARC instructions of the same name. I think MIPS (in big-endian mode) would be the same, and MIPS in little-endian mode like MARS simulates is like that but reversed.



    So in big-endian mode, I think swl is equivalent to sw for aligned addresses, but I haven't tested.




    Footnote 1:
    MIPS32R6 removed LWL/R, and requires LW to support unaligned store / load. Wikipedia doesn't mention stores for that, only loads.



    See also https://www.linux-mips.org/wiki/Alignment: Linux MIPS has a kernel option to emulate unaligned load/store instead of delivering SIGBUS on unaligned LW or SW.






    share|improve this answer





























      0
















      First of all, lui/ori construct a value in a register from an immediate, without accessing data memory. They're not in any way equivalent to lw. Perhaps you're thinking of li, which is a pseudo-instruction for lui and/or ori. Only load instructions can access memory; immediate ALU instructions take data from the instruction itself but that doesn't really count.




      MIPS provides pairs of instructions for loading/storing the left and right parts of an unaligned word. The stores are SWL (left) and SWR (store word right).



      Their effect depends on the endian mode of your MIPS (it support big and little endian). MARS simulates a MIPS in little-endian mode.



      In little-endian mode, SWL $t1, buf stores the high byte of $t1 to the first byte of buf, for an aligned buf.



      In little-endian mode, on an address that is aligned (like sw requires1), SWR acts like SW, storing all 4 bytes.



      These instructions are interesting because they can modify 1 to 4 bytes in a word. Including 3 bytes, which you can't do with one sb (byte) or sh (half-word).




      http://db.cs.duke.edu/courses/fall02/cps104/homework/lwswlr.html explains how to use the SPARC instructions of the same name. I think MIPS (in big-endian mode) would be the same, and MIPS in little-endian mode like MARS simulates is like that but reversed.



      So in big-endian mode, I think swl is equivalent to sw for aligned addresses, but I haven't tested.




      Footnote 1:
      MIPS32R6 removed LWL/R, and requires LW to support unaligned store / load. Wikipedia doesn't mention stores for that, only loads.



      See also https://www.linux-mips.org/wiki/Alignment: Linux MIPS has a kernel option to emulate unaligned load/store instead of delivering SIGBUS on unaligned LW or SW.






      share|improve this answer



























        0














        0










        0









        First of all, lui/ori construct a value in a register from an immediate, without accessing data memory. They're not in any way equivalent to lw. Perhaps you're thinking of li, which is a pseudo-instruction for lui and/or ori. Only load instructions can access memory; immediate ALU instructions take data from the instruction itself but that doesn't really count.




        MIPS provides pairs of instructions for loading/storing the left and right parts of an unaligned word. The stores are SWL (left) and SWR (store word right).



        Their effect depends on the endian mode of your MIPS (it support big and little endian). MARS simulates a MIPS in little-endian mode.



        In little-endian mode, SWL $t1, buf stores the high byte of $t1 to the first byte of buf, for an aligned buf.



        In little-endian mode, on an address that is aligned (like sw requires1), SWR acts like SW, storing all 4 bytes.



        These instructions are interesting because they can modify 1 to 4 bytes in a word. Including 3 bytes, which you can't do with one sb (byte) or sh (half-word).




        http://db.cs.duke.edu/courses/fall02/cps104/homework/lwswlr.html explains how to use the SPARC instructions of the same name. I think MIPS (in big-endian mode) would be the same, and MIPS in little-endian mode like MARS simulates is like that but reversed.



        So in big-endian mode, I think swl is equivalent to sw for aligned addresses, but I haven't tested.




        Footnote 1:
        MIPS32R6 removed LWL/R, and requires LW to support unaligned store / load. Wikipedia doesn't mention stores for that, only loads.



        See also https://www.linux-mips.org/wiki/Alignment: Linux MIPS has a kernel option to emulate unaligned load/store instead of delivering SIGBUS on unaligned LW or SW.






        share|improve this answer













        First of all, lui/ori construct a value in a register from an immediate, without accessing data memory. They're not in any way equivalent to lw. Perhaps you're thinking of li, which is a pseudo-instruction for lui and/or ori. Only load instructions can access memory; immediate ALU instructions take data from the instruction itself but that doesn't really count.




        MIPS provides pairs of instructions for loading/storing the left and right parts of an unaligned word. The stores are SWL (left) and SWR (store word right).



        Their effect depends on the endian mode of your MIPS (it support big and little endian). MARS simulates a MIPS in little-endian mode.



        In little-endian mode, SWL $t1, buf stores the high byte of $t1 to the first byte of buf, for an aligned buf.



        In little-endian mode, on an address that is aligned (like sw requires1), SWR acts like SW, storing all 4 bytes.



        These instructions are interesting because they can modify 1 to 4 bytes in a word. Including 3 bytes, which you can't do with one sb (byte) or sh (half-word).




        http://db.cs.duke.edu/courses/fall02/cps104/homework/lwswlr.html explains how to use the SPARC instructions of the same name. I think MIPS (in big-endian mode) would be the same, and MIPS in little-endian mode like MARS simulates is like that but reversed.



        So in big-endian mode, I think swl is equivalent to sw for aligned addresses, but I haven't tested.




        Footnote 1:
        MIPS32R6 removed LWL/R, and requires LW to support unaligned store / load. Wikipedia doesn't mention stores for that, only loads.



        See also https://www.linux-mips.org/wiki/Alignment: Linux MIPS has a kernel option to emulate unaligned load/store instead of delivering SIGBUS on unaligned LW or SW.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 29 at 4:28









        Peter CordesPeter Cordes

        158k23 gold badges254 silver badges406 bronze badges




        158k23 gold badges254 silver badges406 bronze badges































            draft saved

            draft discarded















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405306%2falternative-for-sw-mips-instruction%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript