Summary:This laboratory exercise provides practice with machine and assembly language instructions.
Open this page in a new window by right-clicking on the link and choosing "Open Link in New Window" and then come back to this lab. This will bring up the full Knob & Switch Machine Simulator. In addition to the usual Data Path and Main Memory regions, you now have a complete and working Control Unit.
Enable JavaScript on this page by clicking the "Options" button in the lower-right corner of the window and selecting either Temporarily allow all this page or Allow dave-reed.com, depending on your preferences.
ADD R2 R1 R0
(It may help to add some formatting spaces to help you parse the code. Start at the left and work your way to the right as you interpret the bits.)1000001001001010
HALT instruction in memory location 2.
HALT instructionHALT
instruction? How would the control unit react?
HALT in memory
address 2 to something else (anything you like). You may need to change the
"View as" pulldown to something other than "Instr" first.
By the time you finish this lab, you've written several programs in assembly language—something even some CS majors never do. You should feel proud of yourself.
BREZ RR MMMMMwhich means, if register RR is equal to zero, set the program counter to the memory address MMMMM. That is, "BRanch if Equal to Zero." Then you could exhibit looping behavior you've seen in Python programs.
This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United
States License
.