CS 2810 Objective: The objective of this lab assignment is to demonstrate your ability in Moving...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
■ CS 2810 Objective: The objective of this lab assignment is to demonstrate your ability in Moving data from memory locations to a register and vice versa; Negating a positive integer; Adding two numbers with both numbers stored in registers or one stored in a register and one being a literal; ■ Programming Assignment 1 Performing logical ADD, NOT, and OR operations; Checking the parity of a number. Lab Statement: Two numbers, X and Y, are stored in memory locations Ox3050 and Ox3051 respectively. Write an LC-3 machine language program that does the following: 1. Compute the sum of X and Y and place it at location Ox3052. 2. Compute X - Y and store the result at location x3053 3. Compute X AND Y and store the result at location Ox3054. 4. Compute NOT(X) and store the result at location Ox3055. 5. Compute X OR Y and store the result at location Ox3056. 6. Compute X + 3 and store the result at location Ox3057. 7. Computer X-3 and store the result at location Ox3058. 8. If X is even, place 0 at location Ox3059; otherwise, meaning if X is odd, place 1 at 0x3059. LC-3 Syntax: 1. Move data to/from memory locations. LC-3 has three set of instructions to move data to/from memory locations: LD/ST, LDR/STR, and LDI/STI. They differ in how they calculate the address of the memory location. LD/ST use a PCoffset9, meaning the address is calculated by adding the incremented PC to a 9-bit offset supplied by the user in the instruction. Since the offset is limited to a 9-bit 2's complement integer, the range of the offset is -256 to 255 in decimal, or x1FF-xOFF. You can use LD/ST if the target location is within this range. In this lab assignment, if the program begins at x3000, the target locations, x3050-x3058, are within the offset range. We can use LD/ST to move the data around. For example, if the first statement, which is stored in x3000, is to move X, stored in x3050, to RO, the instruction will be formed as followed: Opcode: 0010 Operand 1: 000 (DR) Operand 2: The PC will be incremented to x3001 when this instruction is being executed and the location for X is x3050. Therefore the offset is (x3050)- (x3001)=x004F. So the 9-bit offset is x04F or 001001111. Instruction: 0010000001001111=x204F 2. Subtraction LC-3 does not have an instruction for subtraction. However, X - Y = X + (-Y). We need to form - Y through 2's complement by finding NOT (Y) first then add one to the result. 3. OR operation LC-3 does not have an OR instruction. However, de Morgan rule says, AANDB = ĀORB = A OR B. Therefore A or B can be evaluated as NOT((NOT A) AND (NOT B)) 4. Checking parity In binary format, the parity can be decided by the least significant bit, or bit 0. An integer is even if bit 0 is 0 and is odd if bit 0 if 1. One way to determine the parity is to AND the number with x0001 (which is a bit mask for this purpose). Testing: Use the following pairs of (X, Y) for testing: (10, 21), (-11, 15), (9, 12). Submission: 1. Your machine code, either in binary or hex, in a text file. 2. For each pair of (X, Y), the screen shot of contents of locations Ox3050 through Ox3059. Content X Y X + Y X-Y X AND Y Location 0x3050 Ox3051 Ox3052 0x3053 0X3054 0x3055 0x3056 Ox3057 0x3058 0x3059 NOT (X) X OR Y X + 3 X-3 0 if X is even; 1 if X is odd ■ CS 2810 Objective: The objective of this lab assignment is to demonstrate your ability in Moving data from memory locations to a register and vice versa; Negating a positive integer; Adding two numbers with both numbers stored in registers or one stored in a register and one being a literal; ■ Programming Assignment 1 Performing logical ADD, NOT, and OR operations; Checking the parity of a number. Lab Statement: Two numbers, X and Y, are stored in memory locations Ox3050 and Ox3051 respectively. Write an LC-3 machine language program that does the following: 1. Compute the sum of X and Y and place it at location Ox3052. 2. Compute X - Y and store the result at location x3053 3. Compute X AND Y and store the result at location Ox3054. 4. Compute NOT(X) and store the result at location Ox3055. 5. Compute X OR Y and store the result at location Ox3056. 6. Compute X + 3 and store the result at location Ox3057. 7. Computer X-3 and store the result at location Ox3058. 8. If X is even, place 0 at location Ox3059; otherwise, meaning if X is odd, place 1 at 0x3059. LC-3 Syntax: 1. Move data to/from memory locations. LC-3 has three set of instructions to move data to/from memory locations: LD/ST, LDR/STR, and LDI/STI. They differ in how they calculate the address of the memory location. LD/ST use a PCoffset9, meaning the address is calculated by adding the incremented PC to a 9-bit offset supplied by the user in the instruction. Since the offset is limited to a 9-bit 2's complement integer, the range of the offset is -256 to 255 in decimal, or x1FF-xOFF. You can use LD/ST if the target location is within this range. In this lab assignment, if the program begins at x3000, the target locations, x3050-x3058, are within the offset range. We can use LD/ST to move the data around. For example, if the first statement, which is stored in x3000, is to move X, stored in x3050, to RO, the instruction will be formed as followed: Opcode: 0010 Operand 1: 000 (DR) Operand 2: The PC will be incremented to x3001 when this instruction is being executed and the location for X is x3050. Therefore the offset is (x3050)- (x3001)=x004F. So the 9-bit offset is x04F or 001001111. Instruction: 0010000001001111=x204F 2. Subtraction LC-3 does not have an instruction for subtraction. However, X - Y = X + (-Y). We need to form - Y through 2's complement by finding NOT (Y) first then add one to the result. 3. OR operation LC-3 does not have an OR instruction. However, de Morgan rule says, AANDB = ĀORB = A OR B. Therefore A or B can be evaluated as NOT((NOT A) AND (NOT B)) 4. Checking parity In binary format, the parity can be decided by the least significant bit, or bit 0. An integer is even if bit 0 is 0 and is odd if bit 0 if 1. One way to determine the parity is to AND the number with x0001 (which is a bit mask for this purpose). Testing: Use the following pairs of (X, Y) for testing: (10, 21), (-11, 15), (9, 12). Submission: 1. Your machine code, either in binary or hex, in a text file. 2. For each pair of (X, Y), the screen shot of contents of locations Ox3050 through Ox3059. Content X Y X + Y X-Y X AND Y Location 0x3050 Ox3051 Ox3052 0x3053 0X3054 0x3055 0x3056 Ox3057 0x3058 0x3059 NOT (X) X OR Y X + 3 X-3 0 if X is even; 1 if X is odd
Expert Answer:
Answer rating: 100% (QA)
To complete this assignment youll need to write LC3 machine language code to perform the specified operations on the given memory locations Heres a stepbystep guide to help you Load X into a register ... View the full answer
Related Book For
Computer Organization and Design The Hardware Software Interface
ISBN: 978-0124077263
5th edition
Authors: David A. Patterson, John L. Hennessy
Posted Date:
Students also viewed these programming questions
-
Assignment: PART 5 (30 points): Mr. Smith died, leaving an insurance policy to his heir, John Smith. The contract provides that the beneficiary can choose any one of the following four options: A)...
-
This assignment is to demonstrate your ability to use Excel 2013 to track and report stock prices and then use critical thinking to analyze and report the performance of each stock and portfolio You...
-
The CEO of WeStudy has a personal cost of working C(H) = 15H2, where H is the number of days she works hard each quarter. Without any effort, the company's stock is expected be worth $50, but for...
-
Suppose that the following equations describe an economy: C = 170 + 0.60YD M s = 735; P = 1 T = 200 I = 100 - 4i Md = 0.75Y - 6i G = 350 a) what is the equation for equilibrium in the goods market?...
-
Financial accounting statements are limited to information that can be expressed in monetary terms. What are some factors that are vitally important in evaluating the health and prospects of a...
-
Bidwell Leasing purchased a single-engine plane for its fair value of $645,526 and leased it to Red Baron Flying Club on January 1, 2018. Terms of the lease agreement and related facts were: a. Eight...
-
Central Appliance Service Co., Inc., has achieved fast growth in the St. Louis area by selling service contracts on large appliances, such as washers, dryers, and refrigerators. For a fee, Central...
-
Anthony Liu, CPA, prepared the flowchart on the next page that portrays the raw materials purchasing function of one of Anthonys clients, Medium-Sized Manufacturing Company, from the preparation of...
-
FINAL TASK/MAJOR PERFORMANCE TASK - PRECALCULUS (REAL-LIFE APPLICATION OF CIRCLE, PARABOLA, ELLIPSE) Take a picture or photo grab an image (cite the reference) of an object, structure, an...
-
A ladder of length L and mass M has its bottom end attached to the ground by a pivot. It makes an angle ? with the horizontal, and is held up by a massless stick of length ? which is also attached to...
-
Arlene Propane, a provider of propane and propane accessories is bidding on a contract to install propane pumps and lines at 25 locations throughout Arlene township. The senior manager Mr. Hill...
-
Each of the following applies to concepts used in variables sampling. Choose the best response. a. An important statistic to consider when using a statistical sampling audit plan is the population...
-
List the four types of data codes-serial, block sequence, hierarchical, and association-in increasing order of: a. Mnemonic value b. Compactness c. Flexibility for expansion
-
What are the functions of money?
-
You are doing price tests of raw materials inventory for the Merties Manufacturing Company using statistical sampling. Your sampling plan calls for a random sample of 125 part numbers. Since you are...
-
What are the main money market instruments?
-
Roland Services, Inc., has $8,200 cash on hand on May 1. The company requires a minimum cash balance of $7,000. May cash collections are $548,460. Total cash payments for May are $575,320. Prepare a...
-
In exchange for land, the company received a 12-month note on January 1. The face amount of the note is $1,000, and the stated rate of interest is 13%, compounded annually. The 13% rate is equal to...
-
To support multiple virtual machines, two levels of memory virtualization are needed. Each virtual machine still controls the mapping of virtual address (VA) to physical address (PA), while the...
-
Rewrite the loop from Exercise 2.29 to reduce the number of MIPS instructions executed. Exercise 2.29 Translate the following loop into C. Assume that the C-level integer i is held in register $t1,...
-
Consider the following instruction: Instruction: AND Rd,Rs,Rt Interpretation: Reg[Rd] = Reg[Rs] AND Reg[Rt] 1. What are the values of control signals generated by the control in Figure 4.2 for the...
-
A tiny home uses approximately \(12 \mathrm{~kW}\) of electricity per day. What size solar system would be needed to fuel \(80 \%\) of a home's needs for a month (30 days)?
-
Accrual-and Cash-Basis Expenses} Speedy Delivery Company provides next-day delivery across Eastern Canada. During May, Speedy incurred \(\$ 132,600\) in fuel costs. Speedy paid \(\$ 95,450\) of the...
-
Accrual- and Cash-Basis Revenue Magnani Music sells used CDs for \(\$ 2.00\) each. During the month of April, Magnani sold 8,750 CDs for cash and 15,310 CDs on credit. Magnani's cash collections in...
Study smarter with the SolutionInn App