Go to USC home page USC Logo Computer Science & Engineering
UNIVERSITY OF SOUTH CAROLINA
J. Davis Home Page | Research | CSE Site Map | CSE Faculty
Dr. James P. Davis
Associate Professor
Department of Computer Science and Engineering
University of South Carolina
Columbia, SC 29208

3A63 Swearingen
jimdavis in domain cse.sc.edu
803-777-5855(voice)
803-777-3767(fax)
Office hours: 2:00-4:30pm T-TH

 

CSCE 313 course home page

Course Description & Grading
313—Embedded Systems Laboratory. (3) (Prereq: CSCE 211, 212) design and implementation of microprocessor based systems; assembly language programming. This is the Link to Department Syllabus.

Homework 30%, Exams(2) 30%, Labs 40%.


Textbook
MacKenzie, I. Scott, The 68000 Processor, Prentice-Hall Publishers, Inc., 1995.

MacKenzie, I. Scott, Lab Manual 68KMB, (C) 1994, Scott MacKenzie.  (This is the manual for the labs, and is based on using the 68KMB board and lab apparatus).

Course Times & Location
Tuesday & Thursday: 12:30 - 13:45,  SWGN 2A19

Lab sessions meet in 1D11 and/or 1D15 on appointed Thursdays when we are using the WISM68K tools.

Lab sessions meet in 2A16 at appointed times when we are using the 68KMB lab boards.

 


Course Overview

Embedded microprocessor and micro-controller systems are the data analysis and processing technology "backbone" of many industries—automotive, military and aerospace, manufacturing and production, transportation, and consumer electronics—to name a few.  The millions of lines of embedded software code drives many of the critical systems that makes our global economy work as it does.  (Remember the Y2K “scare” a few years back?  Experts were mostly worried about the impact of the date rollover problem on the execution of the embedded systems more than any other factor.)  Embedded systems are where "the rubber meets the road", so to speak, in that we are concerned about the level where the higher layers of systems and application software integrate with the underlying hardware on which the software executes--through the Instruction Set Architecture (ISA) layer.  In addition, at this level, we need to concern ourselves with the interfacing and integration of disparate systems and devices which would come under the control of the embedded system.  Embedded systems interface with humans and with their environment--all of which is done through "peripheral" interfacing.

Many millions of lines of code used in embedded systems are written in low-level assembler languages, and in direct machine code sequences, supported by the microprocessor or micro-controller used in the specific systems.  This is in addition to code written in high-level languages such as C/C++.  We will take one popular and well-known processor, the Motorola® 68000 and its descendants, and explore its Instruction Set Architecture (ISA) model and hardware architecture, so that we can write efficient, correct and maintainable programs that exploit the capabilities of this processor “workhorse” to specific programming tasks we have in mind.


Course Outline

The following outline has been devised for the course, based on the large class size and the limited number of 68KMB lab stations this semester.  The topics above the dotted lines will be covered without reference to the 68KMB Lab apparatus. Labs up to this point will be done using the WISM68K software simulator tool set.

  1. Chapters 0 & 1: Review of Digital Logic and Computer Architecture concepts (CSCE 211, CSCE 212).
  2. Selected Topics 1: Layers of the Virtual Machine, the place of the ISA Layer (Fetch, Decode, Execute).
  3. Chapter 2: Motorola 68000 Architecture – Registers, Buses, and Memory Organization.
  4. Chapters 2 & 3: Motorola ISA Layer – Addressing Modes, Instruction Set
  5. Chapter 5: Programming Examples (using the WISM68 Emulator Toolset).
  6. Chapter 4: The Discipline, Methods, and Process of Assembler Program Development.
  7. Chapter 3: The Machine Instruction Format and Instruction Timing (also Appendices C & D).
  8. Selected Topics 2: Interface between OS,  ISA and RTL Layers of the Virtual Machine model.
  9. Chapter 5: More Programming Examples with Algorithm Analysis.
  10. Chapter 6: Interrupts, Privilege States and Exception Handling.

-----------------------------------------------------------------------------------------------------------------------------------

  1. Chapter 7: Principles of I/O Interfacing.
  2. Chapter 8: The 68KMB Embedded Processor Board.
  3. Chapter 9: Interfacing Examples.
  4. Selected Topics 3: Software Engineering of 68K Programs for Reactive Real-time Systems (using UML).

Lecture Notes

The lecture notes are organized according to the MWF lecture schedule.  Since we are on a TTH lecture schedule this Spring, the Notes #s won't line up exactly.

Lectures #1 & #2 (week 1/10): Introduction - Structure and content of the course.  Introduction to the problem of embedded systems design & programming.  Lecture Topics 1 & 2 Notes (PDF).  Role of the microprocessor in computing systems; the layered "virtual machine" model; the "big picture" about how a CPU basically does FETCH, DECODE & EXECUTE functions over and over.  Writing programs for the CPU where it will read instructions and data from memory to do useful work.  Mackenzie Chapters 0 & 1. Representation and encoding of numbers and characters (see Chapter 0).

Lectures #3 & #4 (week 1/17): Overview of Microcomputer architecture concepts: Use of patterns in defining the abstraction layers between the Instruction Set Architecture (ISA) layer and higher layers in a microprocessor-based system. Lecture Topics 3 & 4 Notes (PDF).  Discussion of 68000 instructions, register allocation and memory access (in general terms).  Embedded systems development process, methods and tools. Lecture Topics  3a Notes - Process (PDF).  Chapters 2 & 3, discussion of 68000 statements = instruction opcode (operation) + operands.  Types of addressing modes for accessing operand data and addresses.  Memory definition and memory access--at the heart of the Fetch, Decode, Execute cycle.   Lecture Topics 5 Notes (PDF).   Lecture Topic 6 Notes (PDF).

Lectures #5 & #6 (week 1/24): Details of MC68000 architecture: register model, memory model, instruction format (opcodes, operands, addressing modes, sources and destinations).  MacKenzie, Chapter 2, sections 2.2 and 2.3.  Lecture Topic 7 Notes (PDF).  Addressing modes in detail: coverage of the various modes and the data sizes to which they apply.  MacKenzie, section 2.4, 58-69.  Lecture Topic  8 Notes (PDF).  Chapter 2, sections 2.5 & 2.6, pp. 69-77.  Lecture Topics 9&10 Notes (PDF) Detailed discussion of 68000 instruction set.  Chapter 3, section 3.2.   Lecture Topic 11 Notes (PDF).

Lectures #7 & #8 (week 1/31):  Programming examples.  We'll examine some of the programs in Chapter 5, and discuss how the programs are constructed.  MacKenzie, Chapter 5, Example 5.6 Find Negative Numbers in a Sequence (pp. 133-135), Example 5.9 Conversion of ASCII to Binary (pp. 137-139), and Example 5-10 Sort a List of Bytes (pp. 139-141).  Download the routines if you don't have a book yet.  We will focus on using the WISM68 simulation tools to execute the model in either 1D11, 1D15 or 1D25 (I'll let you know which).  For lab, the Count Negative Numbers NEG2 (ASM) and Bubblesort SORT (ASM) programs.  Download them here into your directory for use in lab.

Lectures #9 & #10 (week 2/7):  Instruction machine formats, and instruction decoding.  This involves hand assembly and disassembly of instructions, to gain insight into how they are organized for decoding and execution on the 68K architecture.  MacKenzie, Chapter 3, section 3.3 and Appendix B.  Lecture Topic 15 Notes (PDF) covering some general principles for examining instructions.  MacKenzie, Chapter 3, section 3.4 and Appendix C. Lecture Topics 16 & 18 Notes (PDF) on the topics of instruction machine codes and instruction timing.

Take a look at the examples at the end of Chapter 3, as these are good ones.

Lectures #11 & #12 (week 2/14):  Laboratory work on the 5 programs that are part of MacKenzie Lab #5 (PDF).  Download this document, as this is what we'll be working on.  Also, see description for Assignment #8, below.  We have lecture on Tuesday, and we'll meet in the lab on Thursday, so I can get you started on the problem statement for the programming assignments.

Lectures #13 & #14 (week 2/21):  Laboratory work, both Tuesday and Thursday.  I am presenting a paper at a conference, and so I will be gone both class days.  Achraf (our T.A.) will be present during the lab sessions to work with you and answer any questions you have about the problems.  Work together in your teams.

Lectures #15 & #16 (week 2/28):  Discussion of homework; Tuesday's lecture on additional points from Chapter 3 and Chapter 5 (based on questions about the homework assignments).  Laboratory work on Thursday (to finish up the coding and simulation verification of the programming exercises).

Lectures  (week 3/7):  Spring Break week; no classes.  Have a good holiday; get caught up on stuff.

Lectures #17 & #18 (week 3/14):  Putting it all together, and Review for Exam. We're finishing the first half of the course, where we have a good understanding of the 68000 architecture and programming model.  We'll work through a "practice exam" (get the PDF here) and discuss how the topics fit together.  We'll meet in class for Thursday's class instead of in the lab.

Lectures #19 & #20 (week 3/21):  Tuesday: MacKenzie, Chapter 4 (we have covered this by example, but there are some points that I want to make note of).  Chapter 6.1-6.5 (pp. 145-157).  Interrupts, vectoring.  Lecture Notes - Week 11 (PDF).     Thursday: Exam.  Chapters 0, 1, 2, 3, 5 of MacKenzie. Closed book.  I will provide the 68000 programming manual pages as part of the exam, if they are needed.  See the Code of Academic Responsibility to remind yourself about test-taking ethics.

Lectures #21 & #22 (week 3/28):  Tuesday: Chapters 6 (conclusion), refer to Lecture Notes for Week 11. Chapter 7, MacKenzie, sections 7.1-7.8 (pp. 159-180).  Thursday: We'll meet in class to discuss the lab setup with the 68000 hardware. Get the MacKenzie Lab #6 (PDF).  Lecture Notes - Week 12-A (PDF).

Lectures #23 & #24 (week 4/4):  Detailed programming of the 68681 DUART device.  Chapter 9, sections 9.1-9.4 (pp. 199-209), Chapter 9, sections 9.5-9.9 (pp. 209-222).   Discussion of program examples from Chapter 9. Thursday: Discussion of  MacKenzie Lab #7 (PDF) Lecture Notes - Week 12-B (PDF).

NEW 4/14/04:  I updated the Lecture Notes for weeks 3/21, 3/28, and 4/4, as these ones originally posted were not the correct ones.

Lectures #25 & #26 (week 4/11): Discussion of the M68KMB Board. Chapter 8, MacKenzie.  Thursday: Discussion of  MacKenzie's Lab #8 (PDF).

Lectures #27 & #28 (week 4/18):  Interfacing to the keypad controller through the 6821 PIA chip.  Chapter 9, sections 9.11, 9.12.  Thursday: We'll also discuss MacKenzie Lab #11 (PDF).  Also, Discussion of Final Exam.

Final Exam: Wed 4/27, 2-4 PM.  All Labs (MacKenzie #s 6, 7, 8, 11) are also due by this point. Make sure you follow the instructions for deliverables.


Homework & Lab Assignments

HW#1: Reading: MacKenzie Chapters 0 & 1. Problems: MacKenzie, Chapter 0, problems 1, 5, 6, 7, 10, 11, 23, 24; pages 35-36.  Due: Tues. 1/25. Total of 10 points.

HW#2: Reading: MacKenzie Chapter 2.  Problems: MacKenzie, Chapter 1, problems 3, 4, 9, 10; page 52.  Due: Thurs. 1/27.  Total of 10 points.

HW#3: Problems: MacKenzie, Chapter 2 (instructions and addressing modes), problems 2, 3, 4, 5, 12, 14, 16, and 30; pp. 77-78.  Due: Thurs. Thurs. 2/3.  Total of 10 points.

HW#4: Reading: MacKenzie, Chapter 3 (instruction set). Problems:  Homework-4 Web PageDue: Tues. 2/8.  Total of 10 points.

HW#5: Problems: MacKenzie, Chapter 3: problems 2, 4, 5, 6 (p.102)  These deal with decoding and encoding instructions, and determining the execution times of instructions and instruction sequences.  Due: Tues. 2/15.  Total of 10 points.

HW#6: Problems: Homework-6 Web PageDue: Thurs. 2/22.  Total of 10 points.

HW#7: Problems: MacKenzie, Chapter 3: problems 11, 16 (writing code fragments), and 12, 14 (determining what is the result of executing a sequence of instructions.  NOTE 2/15: this homework is due Thurs 2/24.  Total of 10 points.

NOTE: You'll complete this assignment by using WISM68 to create your results.  So, for each problem, you'll turn in (1) Listing printout, and (2) resultant Register window (from 'print screen'), after executing the code.  Due: Tues. 3/1.

HW#8:  MacKenzie Lab #5.  Writing programs for the 68000. See the assignment link to obtain the instructions for the lab deliverables.  There are five programs you have to write, and there are specific deliverables required for each.  Please read the lab and the assignment deliverable description carefully.  Total of 50 points.

HW#9: Embedded Systems Design problem:  an embedded systems interface design problem, for which you'll have to write the interface routines to access a device through a defined peripheral interface (which I'll provide to you). The task will be for you (with your project teammate) to write the access routines, interrupt routine, and set up the vectoring through the 68000 trap interface. This will be posted during Week 21.  You'll use WISM68 to "emulate" this behavior of the actual system architecture, and you'll need to turn in the standard deliverables for WISM68K-based assignments.  Total of 100 points.

Go to the M68KMB Lab Page first! 

Don't forget the set of Instructions for Program Deliverables we started using on Lab #5.

HW #10: MacKenzie Labs #1-4 (PDF).  Total of 20 points (for whole submission).

HW #11: MacKenzie Lab #6 (PDF).  Total of 20 points.

HW #12: MacKenzie Lab #7 (PDF).  Total of 20 points.

HW #13: MacKenzie Lab #8 (PDF).  Total of 20 points.

HW #14: MacKenzie Lab #11 (PDF).  Total of 20 points.