PS03-soln - ECE 109 Spring 2010 Name:_ Section:_ Problem...

Info iconThis preview shows pages 1–2. 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. 0101 000 000 1 00000 ; AND R0, R0, 0 (b) Put the value 6 into R1. 0101 001 001 1 00000 ; AND R1, R1, 0 – clear R1 0001 001 001 1 00110 ; ADD R1, R1, 6 – add 6 to R1 (c) Put the value 30 into R2. (NOTE: 30 is too large to fit in the 5-bit immediate field of ADD/AND.) 0101 010 010 1 00000 ; AND R2, R2, 0 – clear R2 0001 010 010 1 01111 ; ADD R2, R2, 15 – R2 now holds 15 0001 010 010 000 010 ; ADD R2, R2, R2 – double R2, now holds 30 (d) Clear the low-order four bits of R0. (In other words, set bits 3:0 to zero. Leave all other bits unchanged.) 0101 000 000 1 10000 ; AND R0, R0, -16 – will be sign-extended to xFFF0
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the 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-soln - ECE 109 Spring 2010 Name:_ Section:_ Problem...

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

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