ECE 3430 Exam 1



ECE 3430 Exam #1 (Fall 2014)Your Name: ____________________(127 points possible)You may use your calculator, pencil, and scratch paper if you need it. No phones! Datasheets are provided with this exam. For multiple-choice questions, circle the single correct answer to each question. For short answer questions, write your answer in the space provided on this exam paper. Remember to include the number base for any numerical answers—else it will get counted wrong!Which of the following is an assembler directive and not processed by the MSP430 CPU? [2 points]movdssubxorWhich of the following is not one of the fundamental components of all microcomputers: [2 points]InputOutputControl unitMemoryDatapathTimersmov.w @R5, 8(R4) exhibits which MSP430 addressing modes? [2 points]Register direct, register directAbsolute, indexedRegister indirect, indexedSymbolic, register indirectThe MSP430 assembler recognizes instruction mnemonics and assembler directives as the: [2 points]First fieldSecond fieldThird fieldForth fieldA peripheral device that provides input to a microcontroller and reacts to changes in the environment is called a/an: [2 points]SensorActuatorSignal conditioning circuitDevice driverWhich of the following registers in the MSP430 controls the directionality of bi-directional pins in port 1: [2 points]P1OUTP1DIRP1INP1RENWhat is the minimum number of bus cycles required to move a 16-bit word of data in the MSP430? [2 points]The LaunchPad (housing the MSP430 microcontroller) communicates with the host PC in the laboratory: [2 points]Using a parallel cable and port 1Via a USB-based emulator chipUsing the RS-232 transceiver and the MSP430 SCI subsystemUsing a wireless adapterA certain byte-addressable microprocessor has 20 address lines. How many bytes can be addressed by this microprocessor? [2 points]The MSP430 “mov” instruction supports a total of ____ destination addressing modes (only consider the 4 fundamental addressing modes): [2 points]1234An MSP430 instruction using absolute addressing for both the source and destination operand occupies a total of ____ words of memory: [2 points]1234The number prefix “#” identifies what to the MSP430 assembler? [2 points]A commentAbsolute addressingA hex numberA binary numberImmediate addressingDS is an: [2 points]MSP430 assembly language directive used to reserve initialized data memoryMSP430 assembly language directive used to reserve uninitialized data memoryMSP430 instruction used to reserve initialized data memoryMSP430 instruction used to reserve uninitialized data memoryIf R5 contained the number 0x1234, “mov @R5,R6” means what? [2 points]Initialize the register R6 to the number 0x1234Initialize the register R6 to the contents of memory location 0x1234Copy the contents of R5 into R6The MSP430 instruction “mov.w R4, 0x0136” means which of the following to the CPU? [2 points]Store the upper part of R4 to memory location 0x0137 and the lower half of R4 to memory location 0x0136Store the upper part of R4 to memory location 0x0136 and the lower half of R4 to memory location 0x0137Assume R7 contains the value 0x1273. The MSP430 instruction “mov.b 3(R7),R8” means which of the following to the CPU? [2 points]Load the byte stored in 0x1276 into the lower part of R8Load the byte stored in 0x1276 into the upper part of R8Load the value 0x12 into the lower part of R8 and 0x76 into the upper part of R8Load the value 0x76 into the lower part of R8 and 0x12 into the upper part of R8Assembly language programs: [2 points]Allow the programmer to optimize space, power, and speedMust be executed via read-only memoryMust be executed via read-write memoryUse all of the available addressing modes while C/C++ programs only use extended and immediate addressing modesThe instruction “mov #45, &0x5678” requires how many 16-bit operands? [2 points]Fill out the contents of the MSP430 registers for the given code segment. Your answers should reflect the content after each instruction has executed. If the contents are unknown, write a question mark (?) in the blank. All numbers should be given in hex! [10 points, 1 point each]ORG0x0200Florian:DS2Ralf: DS2ORG0xC000main:mov.w #0x1234, R4PC = _______mov.w R4, Florian M(Florian) = _______ mov.w#Ralf, R6 R6 = _______ mov.w #0x1230, R6 R6 = _______ mov.w#0x1235, R7 R7 = _______add.wR6, R7R7 = _______sub.wR6, R7R7 = _______ bis.w#00001111b, R4R4 = _______xor.wR7, R7R7 = _______ and.w R4, R4 R4 = _______Hand assemble (or encode) the following assembly code into machine code. All answers should be in hex format! Write the instruction code (IC) as a 16-bit value and all operands as 16-bit values. [10 points, 2 points each] ORG0xC000main:and.b R10,0x0040IC = _______Operand(s) = _______ mov.w R4,R13IC = _______Operand(s) = _______ bis.w @R11,R12IC = _______Operand(s) = _______ add.w &0x0200, R5IC = _______Operand(s) = _______ xor.w #0x5678, R8IC = _______Operand(s) = _______…Decode (or reverse-assemble or inverse-assemble) the following machine code back to the original assembly code. Each line decodes to a single instruction. Each instruction code and operand is provided as a 16-bit value. [8 points, 2 points each]C000:47C90008 __________________________C004:5429 __________________________C006:8E3A __________________________C008:E05F1234 __________________________The MSP430 address bus is ___ bits wide and the data bus is ____ bits wide. [2 points]When using immediate addressing, the operand(s) provide: [2 points]The address of the data to work withThe actual data to work withAssume we want to set bit 4 and clear bit 2 (set bit 4 to a 1 and bit 2 to a 0) in an 8-bit control register mapped to memory location 0x0008 simultaneously (in the control register) and without affecting the state of the other bits in that memory location. Show the assembly code required to pull this off. Use only R4 from the programming model. [4 points]Which of the following needs two 16-bit machine code operands? [2 points]xor#0x0040, R5mov0x0234, 0x0456subR5, 0x0056add@R7+, 0x0078Which of the following requires no machine code operands? [2 points]mov#0x0040, R5sub@R9+, R10add4(R5), 0x0056bic@R7, 0x0078Which of the following is an illegal operation on the MSP430? [2 points]mov#0x0051, R5mov0x0053, R11movR5, 0x0086bis@R7+, 0x0068What the 4 significant status register flags controlled directly by the ALU and potentially modified by the completion of an instruction? [2 points]Approximately how long would it take the MSP430 (if the MCLK frequency were 2 MHz) to execute the following code segment? [2 points]main: add.w 0x1234, R7 xor.b#0x10, R8How many words of memory are consumed by the above chunk of code (in question #29)? [2 points]Which two MSP430 registers have “constant generator” capabilities? [2 points]How many writes and reads are performed to and from memory on the MSP430 address/data bus for the given assembly instruction: [2 points]sub.w &0x0200, R7Machine code: 0x8217 0x0200Number of reads = ________Number of writes = ________How many writes and reads are performed to and from memory on the MSP430 address/data bus for the given assembly instruction: [2 points]add.wR6, 3(R5)Machine code: 0x5685 0x0003Number of reads = ________Number of writes = ________Name one thing that makes a microcontroller different from a microprocessor: [2 points]Which of the following fundamental RAM technologies traditionally has a faster read access time and a faster write time—but takes up more silicon space? [2 points]SRAMDRAMShow the optimized machine code for the following instruction—making use of the constant generators: [2 points]add.w #-1, R10________Show the optimized machine code for the following instruction—making use of the constant generators: [2 points]mov.w #0, R11________Name one fundamental ROM technology discussed in lecture: [2 points]When doing a number base conversion from decimal to binary, what phenomenon terminates the consecutive divisions by 2 (when converting the whole number part)? [2 points]When overflow occursAlways after eight division operationsThe remainder becomes 0The quotient becomes 0Give one reason (other than saving money) why saving power in a design (through efficient software and hardware design) is a good idea—even if your design does not run on a limited power supply (a battery). [2 points]Which of the following 16-bit operations will result in two’s complement overflow (all numbers are presented in decimal)? [2 points]-32 – 281270 – 12000-12760 – 2024032766 + 1Show how the 16-bit value 0xABCD would be stored to memory location 0x0200 on both a big endian and little endian machine. Assume the CPU and memory architecture is byte addressable. Write a “?” in the blank if the contents are unknown. Write all answers in hex. [4 points]Big Endian: M(0x01FF) =______M(0x0200) = ______M(0x0201) = ______Little Endian M(0x01FF) = ______M(0x0200) = ______M(0x0201) = ______Which of the bitwise logical instructions available on MSP430 can be used to flip all bits in a register to the opposite state and could also be used to compare two registers for equality? [2 points]What bitwise logical MSP430 instruction should be used to force selected bits to one within a byte without impacting other bits? [2 points]State one good reason why an engineer would want to run an operating system on a microcontroller or a microprocessor: [2 points]What does the following assembly code do? [2 points]ORG0xC000DW0xABCDWhy would using DB and DW within a section of memory mapped to RAM not be a good idea? [2 points]What does the following assembly code do? [2 points]ORG 0xC000DB“Hi”Give one good reason why a radix-2 multiplication algorithm involving shifts and adds (as discussed in lecture) would be preferable over just adding a value to itself n-1 times. [2 points]Show the 8-bit binary representation of -2 (decimal) using the following historical signed number encodings: [3 points]Sign-Magnitude:_______________Ones Complement:_______________Twos Complement:_______________ ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download