Lab 12 - FL13 - ECE 198 JL - University of Illinois - Engineering Wiki

Lab 12 - FL13 - ECE 198 JL - University of Illinois - Engineering Wiki

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

View Full Document Right Arrow Icon
Lab 12 - FL13 This lab is to be done in the EWS computer lab (DCL 440, DCL 520, etc.). Working on it remotely is not advisable as there are numerous technical difficulties in getting the software to work properly with remote access. Plan your time accordingly. Lab 12 assignment is due on Monday, November 18, by 7pm in your svn repository. Programming in LC-3 machine language In this lab, you will write a program in binary LC-3 machine language. Your program will compute max of 10 numbers represented in 2's complement format and will store the result in register R5. Your program will begin at memory location x3100. The ten 16-bit binary numbers to analyze will be stored in memory starting from address x3132. You are provided with 2 template files in your SVN repository, inside lab12 folder. The file lab12.bin is where you will write your binary program. The file numbers.bin will contain the 10 16-bit binary numbers that your program will analyze. Example Given the following 10 numbers: Address Binary Number (in Hex) (in Decimal) x3132 0000 0000 0000 0001 x0001 1 x3133 1111 1111 1000 0000 xFF80 -128 x3134 0000 0000 0000 0100 x0004 4 x3135 1111 1111 1111 1000 xFFF8 -8 x3136 0000 0000 0010 0000 x0020 32 x3137 0000 0010 0000 0000 x0200 512 x3138 1111 1111 1100 0000 xFFC0 -64 x3139 1111 1111 1111 1110 xFFFE -2 x313A 1111 1111 0000 0000 xFF00 -256 x313B 0000 0000 0001 0000 x0010 16 Since number 512 is the largest number in the above set, the following value should be stored in Register 5 after the completion of your program: Value stored in R5 (in Hex) (in Decimal) 0000 0010 0000 0000 x0200 512 Suggested Algorithm/Decomposition If you’re not sure how to get started with this lab assignment, we’ve provided a simple systematic decomposition that you can build on to develop your algorithm and your program. You are not required to use this decomposition; we provide it only as a reference to get you started. Note that we use generic action terms here like “Load” and “Compare” – these are an important part of the algorithm, but it is up to you to figure out how to accomplish these actions. Basic Algorithm 1. Initialize Registers
Background image of page 1

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

View Full Document Right Arrow Icon
a. Initialize two registers to zeros, say, R1 and R2, to be used as intermediate registers for which you can use for calculations b. Initialize a register, say R3, to be used as a pointer to point to the location of the numbers in memory that are being analyzed, starting from address x3132 c. Initialize a register, say R4, to the value 10. This will be used as a counter d. Initialize Register 5 to the value stored in memory at address x3132 2. Set up your loop a. Load in from memory (using R3 to tell you where) one of the ten binary numbers b. Compare the current max number stored in R5 to the number just loaded i. If the new number is bigger than what is in R5 currently, replace the value in R5 with the bigger number ii. if the new number is smaller than (or equal to) what is in R5 currently, do nothing c. Increment pointer and decrement counter d. repeat steps 2.a - 2.c until all 10 numbers have been examined 3. Halt the program Specific Requirements Your code must be written in the binary LC-3 machine language, and be named lab12.bin .
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 6

Lab 12 - FL13 - ECE 198 JL - University of Illinois - Engineering Wiki

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