Machine Organization and Assembly Language programming
A little more information on Smok

It is now time for you to get familiar with the Smok tool. There is a link to the Smok documentation on the Software link on the home page and here.

Smok is already installed on the lab machines. You can follow the installation guidelines to install it on your home machine. At this point installing Smok should be enough.

Your first task is to get familiar with Smok (you can forget about Sloop and we might not use Cebollita). Read the introduction and the Example Model Construction. After reading the User interface guide, you might want to redo the example of the Example Model Construction.

Another example is a very-very simple machine to multiply two numbers. The machine uses three registers, called A, B, and Product, respectively. It implements the following algorithm:
while (A != 0) {
  Product = Product + B;
  A = A - 1;
}

You can download an example of a machine that implements this algorithm from here. Run it single step multiplying two small numbers. Run it using "go" to multiply two relatively large numbers (note that the numbers are unsigned positive).

As an exercise (not to be turned in), build a better multiplier machine. Your machine should contain three registers, called A, B, and Product, but will use a more savy algorithm for multiplying numbers. It's called the "Russian Peasant's Algorithm":

while (A != 0) {
  if (A % 2 == 1)              // If A is odd
    Product = Product + B;
  B = B << 1;                  // Multiply B by two
  A = A >> 1;                  // Divide A by two
}
Checking for oddness is easy in a binary representation. Just look at the low order bit (use, e.g., a "Bit extract component"). Doubling and halving numbers is easily accomplished by shifting left or right, respectively.

Don't start doing this exercise at the console of your computer. Lay out on paper what you think the basic components are, how they will be connected etc. Then use Smok (save your work often!). As for the previous machime, run this one in single step multiplying two small numbers then run it using "go" to multiply two relatively large numbers.

If you feel like it, you can peek at this solution. (Don't forget to reinitialize the machine and set initial values to A, B and P).

The above machines used simple elements. Be sure to look at the description of more complex ones such as ALU, Memory and memory interface, and PLAs.

As a harbinger of things to come, you can peek at a very partial description of the data path of the MIPS single cycle implementation here


baer@cs.washington.edu (Last Update: 4/25/03 )