CS计算机代考程序代写 algorithm c++ HW2 (100 Points Total) CSC 376 Computer Organization

HW2 (100 Points Total) CSC 376 Computer Organization

Homework Exercises (50 points)
Please complete the following exercises at the end of Chapter 3. Once completed, take the HW2 Exercise Quiz.

3.2 a and d
3.4 a and f
3.6 a and e
3.8 a and c
3.9 a, b, and c
3.10
3.18 a, b, and c
3.23 a, d, g, h
3.25 b, c
3.26 a
3.28 c, d
3.29 a
3.49 a, b
3.53 d, e
3.54 e
3.55 e

Homework Problems (50 points)

Problem 1
3.57 in 4th ed text. (6 points)

Sample starter code
//Implementing binNum[] for 3.57
#include
using namespace std;
int
main ()
{
int binNum[8];
int j;
cout << "Enter an eight-bit binary number with a space between bits: "; for (j = 0; j < 8; j++) { cin >> binNum[j];
}
for (j = 0; j < 8; j++) { cout << binNum[j]; } return 0; } a Paste you link to the C++ code here. Include the algorithm in the comments b Paste your run time stack here Problem 2 3.61 in the 4th ed text (6 points) a Paste you link to the C++ code here. Include the algorithm in the comments. b Paste your run time stack here (after the function is called) Problem 3 (6 points) Show work Using the 14-bit floating point model, what is the Signed Magnitude Representation -normalized & biased for: -99.625 • What is the representation of the Sign? • What is the representation of the Exponent? • What is the representation of the Significand? • What is the entire 14-bit representation? Problem 4: (6 points) Show work Complete the chart below for the following questions for the Pep/8 machine language instructions given. Each Instruction starts from the Original Content (i.e. each instruction is independent and is not based on the previous instruction). You will need to jump ahead to Chapter 6 to determine the last item in the chart (C22A42) Complete the chart Do: What does the instruction do? Register: Which register does it specify? Mode: Which addressing mode does it specify? A: What is in the Accumulator after the instruction executes X: What is in the Index Register after the instruction executes Mem[0A3C]: What is in memory after the instruction executes Mem[2A42]: What is in memory after the instruction executes Do Register Mode A X Mem[0A3C] Mem[2A42] Original Content 10B6 FE25 0A41 0A3C Instruction 792A42 E12A42 A90A3C C22A42 Problem 5: (6 points) (Show your work) Determine the output of the following machine-language program by running it in Pep/8. The left column in each part is the memory address of the first byte on the line: Address Instruction Description ( A. Describe each line of code) 0000 C1000C 0003 18 0004 F1000B 0007 51000B 000A 00 000B 00 000C FFDC B. What is the output of the program? C. The instruction at address 0003 is a unary instruction. What does that mean? D. What is the instruction at 0003 doing? Give the binary value of the accumulator before and after the command. Problem 6 (10 points) Write a machine-language program to output your first name on the output device. Write it in a format suitable for the loader and execute it on the PEP/8 simulator. You may only use instructions in Fig 4.6. You shall submit • A written algorithm • Your commented program similar to the Machine Language (hex) of Fig 4.35 • The hexadecimal program suitable for the Pep/8 loader. (Cut & paste the text into your document so I can check your code) • A screenshot of your program output screen Problem 7: (10 points) Write a machine-language program to add the three numbers 9, -6 and -3 and output the sum on the output device. Note-the inputs can be hard coded in data storage at the end of your code. The accumulator holds 16 bits so use 16-bit Two’s Complement for the -7 and do not use the subtract instruction. Write it in a format suitable for the loader and execute it on the PEP/8 simulator. You may only use instructions in Fig 4.6. (Use the Fig 4.6 revised found with the HW2 assignment) You shall submit: • A written algorithm • Your commented program similar to the Machine Language (hex) of Fig 4.35 • The hexadecimal program suitable for the Pep/8 loader. (Cut & paste the text into your document so I can check your code) • A screenshot of your program output screen • Explain the range of numbers that this will work correctly