Virgil Applications and Libraries

This page contains information about applications written in Virgil and libraries such as hardware drivers for particular devices that are readily available for Virgil developers. Most of the applications on this page are fairly simple and are for instructional purposes only.

Virgil Demo Package

Virgil is a relatively new language intended for small devices, and as such, only a few demo applications exist. The applications here are meant to demonstrate the features of the language and its expressive power. As more applications of Virgil are developed and deployed, this list will grow to include more hardware drivers and complete programs. Although Virgil is a platform-independent language, the applications here are for the AVR series of microcontrollers from Atmel. In a previous project we developed the Avrora simulator, which allows simulating the execution of AVR microcontrollers and analyzing machine code programs in various ways.

To build these applications, you will need to:

You can also download the source code to these applications separately: apps-a01.zip.

Blink

Blink is a simple program that demonstrates using interrupt handlers and IO pins to achieve a simple purpose: it simply toggles an LED off and on at a regular interval, driven by a timer device. Blink is a very small application that demonstrates the efficiency of the Virgil compiler: a small application produces a very small binary that uses very little memory.

BubbleSort

The BubbleSort application implements a simple bubblesort routine to test the impact of various optimizations on execution time.

LinkedList

The LinkedList application demonstrates the use of delegates to accomplish some common tasks with linked lists.

Decoder

The Decoder application demonstrates the utility of Virgil's initialization time concept. This application builds a binary tree for disambiguating a list of bit patterns that are computed at compile time. The initialization phase determines the structure of the tree and prunes it for efficiency. The application then saves the whole tree for use at runtime. The compiler will automatically remove the complex initialization routines from the program, since they are needed at runtime.

Fannkuch

The Fannkuch (from the German for pancake) application is from the Computer Language Shootout benchmarks. The core of this computation is permuting the order of elements within an array.

MsgKernel - Message Passing Kernel

The MsgKernel application is a small excerpt of the SOS operating system ported to Virgil. This application models message passing between processes by using inheritance and delegates and includes two example modules that communicate to blink the LEDs of the Mica2 device on and off.

TestADC

The TestADC application is a small test program that demonstrates how to use the ADC (analog to digital converter) device on the AVR.

TestSPI

The TestSPI application is a small test program that demonstrates how to use the SPI device on the AVR.

TestUSART

The TestUSART application is a small test program that demonstrates how to use the USART device on the AVR.