




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Answers to project1 Material Type: Assignment; Professor: Thweatt; Class: Microprocessor System Design; Subject: Electrical & Computer Engineer; University: Virginia Polytechnic Institute And State University; Term: Fall 2007;
Typology: Assignments
1 / 8
This page cannot be seen from the preview
Don't miss anything!





THIS ASSIGNMENT IS TO BE DONE INDIVIDUALLY
Honor pledge : I have neither given nor received unauthorized assistance on this assignment.
[Digitally] Signed: ________________________________________________________________
This lab will help you become familiar with the Digilent Spartan3E board configured with a MicroBlaze processor, and with the software tools that are needed to interface with it. Completion of this lab assignment should take about four hours. Please read over the entire handout before starting.
A formal, written laboratory report is not required for this assignment. Instead, write your answers directly (and neatly) on a printout of this assignment. You should turn in a single, completed printout to your instructor, in class, on the due date.
Most of these items are described at your Blackboard site, or at the CEL web site, www.ece.vt.edu/cel:
References
Refer to the sources listed below as needed:
All of these documents are available on your Blackboard site.
Electrostatic discharge can destroy the Spartan3E board. Always discharge yourself by touching the board’s ground connection, next to the power jack, before touching components on the board, changing jumpers, connecting communications cables, or wiring components on the breadboards. Always transport your board when it is inside of the provided anti-static bubble-wrap pouch.
Among other things, this lab will help you test your Spartan3E board for correct operation. Although each unit was tested before it was shipped, a very small number of hardware failures have been observed. If at any time during the semester you think that your kit has a hardware failure, you should first try the tests described here again before concluding that your board is broken. (In the past, the vast majority of “hardware failures” have turned out to be wiring or programming errors.) If these tests fail, then you should try the self-test station in the CEL. To learn about the test procedure, see the instructions posted at www.ece.vt.edu/cel/help/hardware-support.html.
Notes:
cd c:/fall07-1/Applications
mb-as -als=blinky.lst -o blinky.o blinky.s
**** Error:Invalid register number at ',r0,0'
The above instruction attempts to write its result to general-purpose register r63. How many general-purpose registers are there in the MicroBlaze? 32
What is the machine code value for the instruction,
xori r27,r7,-1 0xAB67FFFF hex
If register r7 contained the value 0x1234 prior to the execution of this instruction, what would
be the contents of r27 be after the instruction executed? 0xFFFFEDCB
mb-ld -o blinky.elf blinky.o -Ttext 0
This command will create the executable file, blinky.elf. ELF is a type of executable file, and is also an acronym.
Use Google or other online resources to determine what ELF stands for:
Executable and Linking (or Linkable) Format
mb-size blinky.elf
How big, in bytes, is the text portion of the blinky.elf program?
216 bytes (base 10).
Executing Blinky. To proceed from here, you must connect your board to your laptop using the supplied USB cable, plug-in and connect the power cable to your board, and turn on the sliding ON switch in the upper left corner of the board. Make sure that the slide switches on the lower right-hand side of the board are slid to the down (off) position (slid towards the bottom of the board).
cd c:/fall07-
xmd
This will produce lots of text, ending with something similar to:
JTAG MDM Connected to MicroBlaze 1 Connected to "mb" target. id = 0 Starting GDB server for "mb" target (id = 0_ at TCP port no 1234 XMD% INFO: MDT - XMP File already loaded XMD%
If you do not see this, you could have a connectivity problem between your laptop USB and the board.
dow Applications/blinky.elf
The program counts faster, because 4 “no-op” instructions have been removed from a delay loop.
This step will be used in validation.
MicroBlaze Assembly Language
When you first look at the instruction list in Chapter 4 of the MicroBlaze Processor Reference Guide, you may be puzzled by the lack of specific instructions for common operations such as clearing, complementing, incrementing, decrementing and copying register values. Older architectures such as the 68HC11 and PIC processors have these instructions. Provide a single MicroBlaze instruction equivalent to each of the following operations:
clear r5: add r5,r0,r0 (several possibililties)
complement r10: xori r10,r10,-1 (several possibilities)
increment r3: addi r3, r3, 1 (a few other possibilities)
decrement r4: addi r4, r4, -1 (a few other possibilities)
copy r7 to r8: add r8, r7, r0 (a few other possibilities)
There is a Type A and a Type B version of most instructions. When performing integer arithmetic, describe the circumstances in which you would use each of these instruction types: (2 points)
Type B instructions are essential when using immediate constants.
Type A instructions are essential when operating on three registers at the same time.
In the context of the MicroBlaze architecture, what is sign extension and why is it necessary for Type B instructions? (2 points)
When a 16-bit immediate value is given, it must typically be converted to a 32-bit value for compatibility with values stored in general-purpose registers. “Sign extension” replicates the MSB of the 16-bit immediate data to the full 32 bits, thereby preserving both the magnitude and the sign of the original value.
What is the difference between a MicroBlaze machine instruction and an assembler directive? Give an example of each. (3 points)
A machine instruction is a 32-bit word that can be executed by the MicroBlaze. A machine- language instruction is typically generated by the assembler from a single assembly-language instruction. Example: addi r3,r5, 1
Assembler directives are instructions for the assembler, not for the MicroBlaze. These directives control the behavior of the assembly process, and help make the code easier to read by humans. Here are some examples:
.equ MY_CONSTANT, 60 .org 0x
Validation
A correct validation is worth 12 points. The maximum possible score for this assignment is 50 points.