PS03 - For each remaining problem, (1) draw a flowchart ,...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 109 Spring 2010 Name:__________________________________________ Section:______________________ Feb 22-25, 2010 1 Problem Session 3 1. Warm-ups (20 pts – 4 pts each): Write a sequence of LC-3 instructions (ADD, AND, NOT, BR) in binary to perform each task. (NOTE: Each task is independent – do not rely on the results of one task to perform the next.) (a) Put the value 0 into R0. (b) Put the value 6 into R1. (c) Put the value 30 into R2. (NOTE: 30 is too large to fit in the 5-bit immediate field of ADD/AND.) (d) Clear the low-order four bits of R0. (In other words, set bits 3:0 to zero. Leave all other bits unchanged.) (e) Clear all except the low-order four bits of R1. (In other words, set all bits to zero except bits 3:0. Leave those bits unchanged.)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ECE 109 Spring 2010 Name:__________________________________________ Section:______________________ Feb 22-25, 2010 2
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: For each remaining problem, (1) draw a flowchart , and (2) write a sequence of LC-3 instructions. All tasks can be done using only ADD, AND, NOT, and BR instructions. 2. (25 pts flowchart, 15 pts instructions) Find the maximum of the values in R0 and R1, and write it into R2. Do not change R0 or R1. (NOTES: To compare two numbers, subtract one from the other and see if the result is negative, zero, or positive. To subtract, add the negative of the second number. To create the negative of a number, flip the bits and add +1.) ECE 109 Spring 2010 Name:__________________________________________ Section:______________________ Feb 22-25, 2010 3 3. (25 pts flowchart, 15 pts instructions) Shift the value in R0 to the left by n bits, where n is the value stored in R1. Assume that n is a value between 0 and 15. (NOTE: To shift a value to the left by one bit, add the value to itself.)...
View Full Document

This note was uploaded on 04/18/2010 for the course ECE 109 taught by Professor Bradley during the Spring '08 term at N.C. State.

Page1 / 3

PS03 - For each remaining problem, (1) draw a flowchart ,...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online