ECE243 - “SPRING” 2009

Andreas Moshovos (*)

 

** Warning **

 

There may be errors or omissions in the notes that follow and of course I’m responsible for them. If you do spot an error please let me know. There no intentional errors in the notes. Irrespective of any typos and other errors, you are responsible for the “correct answer” to questions and problems.

 

How these relate to the recommended book: In our lectures we will use a slightly different order than the book and also emphasize some topics more than others. Accordingly, there may not always be a direct correspondence between a lecture and a book section. Where possible I will be noting the book sections each lecture corresponds to.

 

If you want to experiment with NIOS II programs outside of the labs I recommend purchasing a DE-1 board.

 

Chapter 8 from Altera’s NIOS II Processor Reference: NIOS II Instruction Reference

The complete NIOS II Processor Reference: NIOS II Processor Reference Handbook

 

These are the notes from 2008. I will be updating as we progress through the course as needed.

 

THEMATIC SECTION #1: Understanding what computers do at the low level:

What you need to know to successfully program a computer

 

Week of January 5

 

1. Introduction, course goals, digital systems and why they are useful.

(book chapter 1 except 1.6 & 1.7)

 

Week of January 12

 

2. Using Binary Quantities to Represent Other Things. Typos at the last conversion fixed. Jan 23rd, 2009.

(book 2.1)

**** Practice questions Answers

* More information about floating point numbers – we will not cover or discuss any of this material.

3. Behavioral Model of Memory.

(book 2.2 – 2.3)

* if there is time we will cover this in the lectures:

       - The DE1 SRAM memory chip interface: lecture slides, datasheet

**** Practice questions

4. Introduction to the NIOS II programming model.

(book 3.8 and some of 3.9 and 2.4)

 

Week of January 19

 

Please note that in some of the lecture notes I use the io variety of loads and stores. That is a leftover that I have yet to edit from an earlier version of the lab system.

Please replace all ldwio, etc. with the non-io version. IO loads and stores bypass processor caches (we will talk about caches later on). Your program may run slower and in some cases incorrectly if you use the io versions of loads and stores.

 

5. Using Assembly to Write NIOS II programs.

      (book 2.6, 3.10 and the MSL website)

   Step-by-Step Examples of loads and stores

6. Simple Control Flow (non straight-line sequencing).

Additions and modifications on January 19, 2010: Simplified code for understanding (removed %hiadj() and %lo() – code is less efficient). Added discussion of if-then, and examples of branch immediate field calculations.

      (book 2.4.5, 2.4.6, 3.11.1, 3.11.2)

7. For loops, arrays and do-while loops.

      (not as-is in the book related sections 2.11 and 3.15)

 

Week of January 26

8. Subroutines – Requirements – Calling and Returning

9. Subroutines – Passing Arguments

      Examples of functions using strings as arguments

      Strings are zero-terminated in C. So “lala” is stored in memory as five bytes: ‘l’, ‘a’, ‘l’, ‘a’, 0.

      You can think of strings as arrays of bytes where the last element is always zero.

      See lecture 2 for more information.

 

Week of February 2

 

10. A Recursive Subroutine

11. Structures and recursive datatypes

12. Introduction to I/O Devices: The Parallel Port Interface (PIT)

      Please ignore the digital design of the PIT interface and the circuits for address decoding. We will discuss these later in the course.

 

Week of February 9

 

13. The Timer Device

      Fixed typos and rewrote the introduction on Feb 6 and Feb 10.

14. The Serial Port / Universal Asynchronous Receiver Transmitter (UART)

15. Introduction to Interrupts / UART

 

 

Week of February 16

 

Reading week.

 

 

Week of February 23

 

16. Instruction Encoding

 

THEMATIC SECTION #2: Building Processors:

What you need to know to build a computer

 

17. A Single-Cycle Processor

18. Modifying the single-cycle processor

 

 

(*) Permission is given to reproduce these notes provided that a notice of their origin is clearly given. All rights reserved just in case :)

 

Week of March 2

Week of March 9

 

19. Multi-cycle implementation: General principle and the datapath

      Datapath drawing

      Notes formatted for better printing

 

20. Multi-cycle implementation: The control

      Control drawing

      Corrections made on April 3. Please download the corrected control diagram.

 

21. Modifying the multi-cycle implementation

 

22. Multi-programmed Control

 

 

Week of March 16

 

We skipped this à 23. Bus-based datapath/control implementation

 

24. Memory Interface: Connecting to Memory and Devices

            Corrections made on April 3. NIOS II does not enable ME for only one cycle, it stays on for the duration of the transaction.

            Also, one of the byte enable examples was wrong (correction shown in red).

 

 

25. Memory-Mapped I/O: Physical Implementation

 

Week of March 23

 

26. Synthesizing Large Memory from Existing Components

 

27. Caches (Prof. Steffan) – We will be going over this material over several lectures

    Additional Notes on Caches

    Examples on Caches and Execution Time

 

Week of March 30

 

29. The C Switch Statement

 

30. Binary Manipulation Instructions and Multiplication as a series of sum or differences of multiplication with powers of 2 / Booth’s Algorithm

 

Week of April 6

 

31. Instruction Set Classification

 

32. Emulating instructions in software

 

33. Virtual Memory and Pipelining Concept (no notes – not part of the material that will be tested in the final)