Homework 2: What is a Wombat Anyway?
The goals of this homework are:
- Encode a WOMBAT instruction in machine language.
- Understand the Fetch-Decode-Execute cycle.
- Write a simple program in WOMBAT assembly language.
- Make sure that you can use the WOMBAT envornment.
Wikipedia says "Humans can receive puncture wounds from wombat claws, as well as bites. Startled wombats can also charge humans and bowl them over, with the attendant risks of broken bones from the fall."
While my wombat is friendly, waiting until the last minute to get to know it might provoke attacks similar to those described above.
Please do the following:
- [1 pont each] Provide the WOMBAT machine language representation for each of the following WOMBAT assembly instructions
- ADDI 23
- ADD hx2F2
- jmpz 102
- 1 point each] Provide the WOMBAT assembly code for each of the following WOMBAT machine instructions
- 1101 0000 0010 00102
- 906616
- 0300008
- [1 point] Give the low level (CPU component level) RTN needed to accomplish the WOMBAT instruction LOAD 100. Do not include the Fetch portion of this instruction.
- [1 point] Give the low level (CPU component level) RTN needed to accomplish the WOMBAT instruction LOADI 100. Do not include the Fetch portion of this instruction.
- [1 point] Would you expect a difference in the amount of time it takes to exectue LOAD 100 vs LOADI 100? Why or why not?
- [1 point] The WOMBAT instruction allows a 12 bit address. What is the highest memory location available? Why?
- [4 points] Write a program which reads in integers representing a lower bound, an upper bound and a skip factor, and prints the numbers from the lower bound to the upper bound inclusive.
- If the input is 1, 5, 1 the program should print 1 2 3 4 5
- If the input is 1, 5, 2 the program should print 1 3 5
- If the input is 1, 5, 3 the program should print 1 4
The input will be in the proper order, the lower bound will always be less than the upper bound, and the increment will be greater than 0.
- [6 points] Write a program in WOMBAT assembly that reads in a single positive integer greater than 2. If the integer is prime, print a 1 otherwise print a 0.
[bennett@mirkwood wmb]$ sim a.out
Enter a value=> 13
Output value : 1
[bennett@mirkwood wmb]$ sim a.out
Enter a value=> 14
Output value : 0
Submission
- Submit the written portion on paper in class on the day the homework is due.
- Submit the programming portions by email to danbennett360@gmail.com by class time on the day the homework is due.
- Please submit programs as attachments to the message.
- Please make sure that the title of the message includes the fact that this is Homework 2 for Computer Architecture.