COMPUTER ORGANIZATION (ELE408) LAB 1

 

 

 

Introduction to ColdFire M5208EVB Computer Board and Design Tools

 

1.      Pre-lab Report

·        Read M5208 User's Manual.

·        Read chapters 1-3 of the ColdFire Microprocessor Family Programmer's Reference Manual.

·        * Read this lab handout carefully. Take notes and prepare the programs required in this handout.

·        Study the dBUG command set and the SBCTools User Manual.

 

Items marked by "*" must be included in a written pre-lab report. The pre-lab must be shown to the Teaching Assistant at the beginning of each lab section. The prelab must be initialed by the TA and attached as an appendix in the final report. This rule applies to all labs.

 

 

2.      Objectives of this Lab

 

This lab is intended to familiarize you with the Motorola ColdFire microprocessor, the M5208EVB, and several modern engineering tools for development of embedded computer systems. You will apply your knowledge of mathematics, science, and engineering that you have learnt in your previous classes to the lab experiments. Examples of such knowledge include different number systems, programming languages (assembly & C), hardware concepts, and programming skills. Your knowledge together with the modern tools available in the lab settings will enable you to design and perform simple experiments, as well as to analyze and interpret data.

Specifically, you will learn and exercise the basics of

A simple firmware, called dBUG, resides in bottom 256K of the M5208EVB external Flash. dBUG contains an assembler, a line disassembler, and a program debugging facility. It supports communication to the workstation via an RS232 serial link. The board also features a uCLinux "Getting Started" demonstration pre-flashed on the board such that users can immediately examine the compelling features of the MCF520x family. SBC tool is a high level development tool installed on the workstation allowing users to develop applications.

 

3.      Basics

 

Both MCF5208 User's Manual and the ColdFire Programmer's Reference manual describe the internal register structure of the ColdFire. Registers D0-D7 are used primarily as accumulators. Registers A0-A7 are used primarily as address registers pointing to memory. The condition codes are essentially the same as those used by the Motorola 6800(ELE205). The manuals also describe how each of the instructions affects the condition codes. Read the instruction set summary of the ColdFire to get an overview of the instruction set. In ColdFire assembly language you can address operands in a number of ways:

 

         1. Register direct (to access an internal register)

         2. Register indirect (access memory using an address register)

         3. Absolute (give the memory address directly)

         4. Immediate (give the data directly)

  1. Relative (PC + offset)

 

There are other addressing modes and some variations based on those given above.

 

In this lab you will exercise how these addressing modes work.

The ColdFire can operate on three different units of data: a byte (8 bits), a word (16 bits), or a longword (32 bits). An instruction, for example MOVE, can operate on any of these three units. The user specifies which unit of data is to be used in the following way: MOVE.B means moving one byte (the lowest order byte) of data. Likewise, MOVE.W and MOVE.L specify a word and a longword, respectively. If the data length is not specified, it is usually assumed to be .W as the default. However, since ColdFire is a RISC, it depends on what opcode/instruction you are using, ie some instructions operate on only longword(32 bits). Please refer to Table 3-7 Instruction Set Summary in MCF5407 User's Manual for detail.

The MCF5208 User's Manual explains how integer data is organized in registers and in memory. Note that in all cases the high order byte of a word has the same address as the word. (some other microprocessor don't do it this way).

4. Addressing modes

Use dBUG to assemble the following programs. The purpose of this section is to point out some things about what the different addressing modes do. Load these programs into memory anywhere in user space.
 
 

MOVE.L #$FFFFFFFF, DO

MOVE.W #$3000,D0

ADD.L #$FFFF0000,D0

MOVEA.W #$3000,A0

MOVEA.W #$4000,A1
 
 

Use the TRACE feature to single-step through the program above. After each instruction executes, make note of the contents of D0 and the condition codes. Explain for each instruction why the condition codes were set as they were and why D0 changed as it did, so to A0 and A1.

Try to assemble the following instructions:

MOVEA.B #$FE, A0

ADD.L #$E000,D0

ADD.L #$FE,D0

ADDA.L #$E000,A0

ADDA.L A0, A1
   

What happened when you run this code? Explain the results.

5.  Simple program design
 
 

    1. Five 16-bit integers are stored in sequential memory location starting at $40040000 (and going upward). Write a program to add these numbers and place the sum in register D7. Use indirect addressing (you might want to use post-increment).
       

 
 
 
 
 

 
 
 
 

    1. Write a program to store $30 in all memory locations between (A0) and (A1). Assume (A1) is greater than (A0).  Please don't use dBUG command listed to get the same result.  Program your own procedure.
       

 
 
 
 
 

    1. Write a program to store $ABCD in all memory locations between (A0) and (A1). What happens if the difference between (A0) and (A1) is not an even number? What is A0 is odd? Your program should handle all possibilities.
       

 
 
 
 
 

    1. Write a program to convert a 4-digit BCD (Binary Coded Decimal) number into its binary equivalent.

Please design these programs using ColdFire assembly code language first and use asm commands of the dBUG monitor to input them into the MVF5208. After you finish the assembly code, you may wan to try to do the same programs using SBC tools available on the workstations.

 

For each of the above programs hand in the debugged source code with comments; the machine code is not necessary. Be very specific with your comments that explain what you are doing and why you are doing it.