math 442 es:
Topics in Computing Systems
architecture of and language and runtime system support for microcontrollers

This course is a project seminar intended to be an extension of MATH 384: Theory and Design of Programming Languages.

The MATH 442: Topics in Computing Systems courses, in general, focus on the design and implementation of computing systems, especially those whose underpinnings are firmly based on interesting ideas from algorithms or applied logic, or whose implementation offers interesting problems in those areas. An additional goal is to offer participants exposure to the design of computing systems built in practice. The course involves readings from white papers, system documentation, and research papers, seminar-style course meetings and discussion, and significant group and individual implementation projects.

The charge this semester is to design and implement the language and runtime system of the AVR microcontroller that forms the core of the Arduino board. We will be working with the Unix AVR utilities avr-as, avr-gcc, avr-libc, and avrdude to write software, namely in C and AVR assembly, to program the Arduino board.

We will start by looking at the architecture of microprocessors, in general, studying digital circuit design at the gate level. We will study the design of the functional components that make up a basic processor, namely the instruction decode logic, the ALU and the register file, and see how these work in conjunction to execute program instructions. We look at machine arithmetic, and the design of efficient circuits for performing two's complement addition and multiplication. We will then focus on the AVR microcontroller, its interrupt and I/O system for embedded applications.

In preparation for building a language for the Arduino, we will look at the C conventions for managing memory on an AVR. This includes calling conventions for passing values in registers and on the stack for subroutines and also memory heap management.

Finally, we will build a compiler and runtime system for a programming language that provides concurrent threads of control. Compilation will ivolve, parsing, semantic analysis and optimization of the intermediate code, and assembler code genertion. The runtime system will perform basic memory and thread management, scheduling, and synchronization primitives.

Time permitting, we might also look at the design of the memory hierarchy in general purpose computing systems, look at concurrent garbage collection, and survey networked and distributed computing.

The course will draw from a number of readings, including standard textbooks, research papers, white papers, and programming tutorials, both on-line and off. The course is project-based--- our goal is to develop a the language system by the semester's end--- and our readings will inform its design. Class time will be spent discussing the existing system and the design of the language.

Meets: 2:10pm MWF in Library 389.
Course web: http://www.reed.edu/~jimfix/442es
Instructor: Jim Fix
E-mail: jimfix@reed.edu
Office: Library 314
Prerequisites: MATH 384 and basic programming proficiency. Software development experience in a language like C will certainly help, or at least a strong curiosity about how things are built or should be built.

Assignments
hw zero. Build a 1-bit full adder circuit.
hw one. circuit design methods.
lb zero. Build a physical logic circuit using 7400TTL parts.
hw two. Write assembly code for the Arduino.
hw three. Multithreaded life. assignment starting source

Examples
Latches and flipflops

Resources and Links

arduino
AVR freaks
Atmel
AVR ATmega168 datasheets
AVR libc
AVR Downloader/UploaDEr
threads lecture I
threads lecture II
threads lecture III
simple threads examples