{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

PS03-soln

# PS03-soln - ECE 109 Spring 2010 Name Section Problem...

This preview shows pages 1–2. Sign up to view the full content.

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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online