An Example VHDL Application for the TM-4



Similar documents
12. A B C A B C A B C 1 A B C A B C A B C JK-FF NETr

VGA video signal generation

LAB #3 VHDL RECOGNITION AND GAL IC PROGRAMMING USING ALL-11 UNIVERSAL PROGRAMMER

Digital Design with VHDL

if-then else : 2-1 mux mux: process (A, B, Select) begin if (select= 1 ) then Z <= A; else Z <= B; end if; end process;

ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process)

VHDL programmering H2

Digital Systems Design. VGA Video Display Generation

CNC FOR EDM MACHINE TOOL HARDWARE STRUCTURE. Ioan Lemeni

Lenguaje VHDL. Diseño de sistemas digitales secuenciales

Step : Create Dependency Graph for Data Path Step b: 8-way Addition? So, the data operations are: 8 multiplications one 8-way addition Balanced binary

Implementation of Web-Server Using Altera DE2-70 FPGA Development Kit

In this example the length of the vector is determined by D length and used for the index variable.

(1) D Flip-Flop with Asynchronous Reset. (2) 4:1 Multiplexor. CS/EE120A VHDL Lab Programming Reference

VHDL Test Bench Tutorial

PetaLinux SDK User Guide. Application Development Guide

Sprites in Block ROM

VHDL GUIDELINES FOR SYNTHESIS

Hardware Implementation of the Stone Metamorphic Cipher

Command Line Crash Course For Unix

Using Xilinx ISE for VHDL Based Design

Introduction to the Altera Qsys System Integration Tool. 1 Introduction. For Quartus II 12.0

SQLITE C/C++ TUTORIAL

Basic C Shell. helpdesk@stat.rice.edu. 11th August 2003

Quartus II Introduction for VHDL Users

CS170 Lab 11 Abstract Data Types & Objects

CPE 462 VHDL: Simulation and Synthesis

CS 103 Lab Linux and Virtual Machines

Leak Check Version 2.1 for Linux TM

Modeling a GPS Receiver Using SystemC

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

Lesson 1 - Creating a Project

A Crash Course on UNIX

Virtuozzo Virtualization SDK

FINITE STATE MACHINE: PRINCIPLE AND PRACTICE

Andreas Burghart 6 October 2014 v1.0

Configuring Renoir to Drive Simulation on Remote Machines

Introduction to Operating Systems

Informatica e Sistemi in Tempo Reale

Project 2: Bejeweled

UNIX, Shell Scripting and Perl Introduction

Working With Derby. Version 10.2 Derby Document build: December 11, 2006, 7:06:09 AM (PST)

Setting Up the Site Licenses

University of Pennsylvania Department of Electrical and Systems Engineering Digital Audio Basics

Introduction. dnotify

Supported platforms & compilers Required software Where to download the packages Geant4 toolkit installation (release 9.6)

Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, Introduction 1. 2 Invoking Shell Scripts 2

Creating a Java application using Perfect Developer and the Java Develo...

ODBC Driver User s Guide. Objectivity/SQL++ ODBC Driver User s Guide. Release 10.2

Application Note: AN00141 xcore-xa - Application Development

Start Active-HDL by double clicking on the Active-HDL Icon (windows).

Embedded Software Development

Spam Marshall SpamWall Step-by-Step Installation Guide for Exchange 5.5

ENGI E1112 Departmental Project Report: Computer Science/Computer Engineering

SAIP 2012 Performance Engineering

Setting up PostgreSQL

EC313 - VHDL State Machine Example

CRSP MOVEit Cloud Getting Started Guide

Asynchronous & Synchronous Reset Design Techniques - Part Deux

State Machines in VHDL

lug create and edit TeX Local User Group web pages

1. Product Information

Generating MIF files

Online Backup Client User Manual Linux

An Incomplete C++ Primer. University of Wyoming MA 5310

AklaBox. The Ultimate Document Platform for your Cloud Infrastructure. Installation Guideline

Beginners Shell Scripting for Batch Jobs

Quartus II Software Download and Installation Quick Start Guide

Stata R Release 13 Installation Guide

RecoveryVault Express Client User Manual

Table of Contents. The RCS MINI HOWTO

Accessing RCS IBM Console in Windows Using Linux Virtual Machine

ELEC 377. Operating Systems. Week 1 Class 3

Online Backup Linux Client User Manual

Lab 7: VHDL 16-Bit Shifter

Online Backup Client User Manual

Printed Circuit Board Design with HDL Designer

GAUSS 9.0. Quick-Start Guide

Help on the Embedded Software Block

Site Configuration SETUP GUIDE. Windows Hosts Single Workstation Installation. May08. May 08

Hands-On UNIX Exercise:

Sources: On the Web: Slides will be available on:

Altera Software Licensing

Tutorial Guide to the IS Unix Service

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters

The Advanced JTAG Bridge. Nathan Yawn 05/12/09

Channel Access Client Programming. Andrew Johnson Computer Scientist, AES-SSG

Unix the Bare Minimum

SSL Tunnels. Introduction

How to Write a Simple Makefile

An Introduction to MPLAB Integrated Development Environment

1 Recommended Readings. 2 Resources Required. 3 Compiling and Running on Linux

MAX II ISP Update with I/O Control & Register Data Retention

Prepare the environment Practical Part 1.1

LAE Enterprise Server Installation Guide

Code::Block manual. for CS101x course. Department of Computer Science and Engineering Indian Institute of Technology - Bombay Mumbai

Example of a Java program

Getting Started Using Mentor Graphic s ModelSim

Transcription:

An Example VHDL Application for the TM-4 Dave Galloway Edward S. Rogers Sr. Department of Electrical and Computer Engineering University of Toronto March 2005 Introduction This document describes a simple application circuit written in VHDL for the TM-4, and explains how to create, compile and run it. The circuit implements a 32-bit counter. A program running on a workstation will read the output of the counter over the network. Getting the Source for the Circuit The source for this example circuit is on the EECG machines in the directory tm4/examples/countervhd. Sign on to one of the EECG Debian Linux workstations (ex: crunch.eecg). Make a new directory, and copy some of the files from the example directory: mkdir counter cd counter set mydir=$cwd pushd tm4/examples/countervhd cp makefile counter.vhd counter.qsf counter.ports suncounter.c $mydir popd Add the following directory to your path, so that the Transmogrifier commands are available to you: set path=( tm4/bin $path) You should probably add that line to your.cshrc file so that the change will be permanent. The four files that you copied are: counter.vhd counter.qsf the circuit that will run on the Transmogrifier, described in VHDL a file containing commands for Altera s Quartus software counter.ports a description of the inputs and outputs of the circuit makefile used to compile the circuit and the program

- 2 - suncounter.c a C program that runs on a UNIX workstation and talks to the circuit Compiling the Example To compile the circuit into a form that can be used to program the TM-4, type: make bits The counter.vhd source will be compiled by the VHDL compiler, and the resulting circuit description will be passed through a series of scripts and programs that will produce the programming bits for the chips on the board. It will place the results, along with a number of intermediate files, into a new subdirectory called tm4 in your current directory. Any existing tm4 subdirectory will be removed. The whole process will take about 3 minutes (on a 1.4 GHz Linux workstation). To compile the program that runs on a Linux workstation and talks to the circuit, type: make my_linux_counter Downloading the Example to the Transmogrifier First, you must decide which of the Transmogrifiers you want to use. By default, the commands will use the TM-4 attached to crunch.eecg. If you want any of the other Transmogrifiers, you must set the TM4_SERVER environment variable to the name of the workstation that is attached to the Transmogrifier you want, something like this: setenv TM4_SERVER some_other_machine.eecg At this point, you may want to run the Transmogrifier status monitor display on your workstation. Make sure your DISPLAY environment variable is set correctly and run: tm4status -t & This will produce a new window on your screen which displays the name of the design currently running in the machine, and a column of green and red lights. Now use the tm4get command to reserve the Transmogrifier for 10 minutes: tm4get If someone else is using the machine, you will get a message telling you how long you will have to wait: sorry, drg has it (priority 100) for 597 more seconds To download your circuit into the TM-4, type: tm4run If you are running tm4status, you will see the lights go red as the previous design is stopped, and then

- 3 - change to green as your design is loaded. The name of the directory containing your design will be displayed at the top of the status display. Interacting with the Circuit To communicate with the circuit, run the my_linux_counter program that you compiled earlier: % my_linux_counter 0 1 2 3 4 5 6 7 8 9 Every time you run it, you will get another 10 numbers from the counter. Stopping the Circuit and Releasing the Transmogrifier You can stop the design, disabling the chips in the machine, by typing: tm4 stop You should now release the Transmogrifier so that someone else can use it: tm4release How the Sample Design Works The circuit is written in VHDL. The complete counter.vhd file contains this: library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity counter is port( tm4_devbus : inout std_logic_vector(40 downto 0); tm4_glbclk0 : in std_logic ); end; architecture arch_counter of counter is type count_states is (count_null, count_idle, count_count); signal counter : std_logic_vector(31 downto 0); signal count : std_logic; signal count_state, next_count_state : count_states; signal count_reset : std_logic; signal want_count : std_logic; signal count_ready : std_logic; signal result : std_logic_vector(31 downto 0); component tm4_portmux

- 4 - port( tm4_devbus : inout std_logic_vector(40 downto 0); result : in std_logic_vector(31 downto 0); count_ready : in std_logic; want_count : out std_logic; tm4_glbclk0 : in std_logic); end component; begin tm4_portmux_inst: tm4_portmux port map ( tm4_devbus, result, count_ready, want_count, tm4_glbclk0); process(count_state, want_count) begin case(count_state) is when count_null => count_reset <= 1 ; next_count_state <= count_idle; count_ready <= 0 ; count <= 0 ; when count_idle => count_reset <= 0 ; count_ready <= 1 ; count <= 0 ; if want_count = 1 then next_count_state <= count_count; else next_count_state <= count_idle; when count_count => count_ready <= 0 ; count_reset <= 0 ; if want_count = 1 then next_count_state <= count_count; count <= 0 ; else next_count_state <= count_idle; count <= 1 ; end case; end process; process(count_reset,tm4_glbclk0) begin

- 5 - if count_reset = 1 then counter <= "00000000000000000000000000000000"; count_state <= count_idle; elsif tm4_glbclk0 event and tm4_glbclk0 = 1 then if count = 1 then counter <= counter + 1; count_state <= next_count_state; result <= counter; end process; end arch_counter; The circuit has one 32-bit output port called result, and two 1-bit handshaking variables called want_count and count_ready. The circuit sits in an infinite loop, waiting for someone to ask for a count. It performs a handshake with the outside world using the want_count and count_ready variables, increments the counter, and waits for the next request. The circuit uses the TM-4 ports package to communicate with the outside world. The connections to the outside world are handled by the component named tm4_portmux_inst. This component is automatically supplied by the TM-4 ports package. Read The TM-4 Ports Package for a description of how this works. The counter.ports file contains: # Name direction bits Handshake_from_circuit Handshake_from_workstation result o 32 count_ready want_count It describes the single 32-bit output called result along with the two handshaking variables. The suncounter.c program that runs on the workstation looks like this: /* A program to test a simple counter on the TM-4, using the ports package */ #include <stdio.h> main(argc, argv) int argc; char *argv[]; { int portresult; int result[512 * 1024]; int i, count; tm_init(""); if((portresult = tm_open("result", "r")) < 0) { printf("can t open port result\n"); exit(1);

- 6 - } count = 10; if(argc>1) count = atoi(argv[1]); if(tm_read(portresult, result, count * sizeof(int))!= (count * sizeof(int))) { fprintf(stderr, "suncounter: error in reading\n"); exit(1); } for(i=0; i<count; i++) printf("%d ", result[i]); printf("\n\n"); exit(0); } It initializes the ports package by calling tm_init(), opens the result port with tm_open, reads 10 values of the counter with a single call to tm_read() and then prints them out.