User Tools

Site Tools


old_lab_1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

old_lab_1 [2014/09/01 16:42] (current)
hutch created
Line 1: Line 1:
 +====== Lab 1: RIMS & Hello World on Zedboard ======
 +===== Overview =====
 +This lab will show you how to setup a project in the Xilinx SDK so you can learn how to compile and execute programs on the Zedboard. You are also required to do the RIMS examples from the first chapter of the book.
  
 +===== Objective =====
 +Learn how to use the Xilinx SDK and to download and run programs on the ZED board.
 +
 +===== Software =====
 +
 +You have two options for running the RIMS software. You can run it on the PCs in Room 413 or install the software directly on your own PC or laptop. Your subscription to the Zyante textbook provides a license that you can use. 
 +Instructions for setting up the RIMS software and installing the license can be found [[downloading_running_rims|here]].
 +===== Specifications =====
 +  - Complete all RIMs examples in Ch. 1 of the Programming Embedded Systems book. RIMS is already installed on the lab computers. If you want to download it for your own computer follow the instructions on the Zyante web-site. The exercises are: Try 1.3.1, 1.3.2, 1.3.3, 1.5.1, 1.5.2, 1.5.4.
 +  - Follow the [[SDK Setup Tutorial]] to get a Hello World program working on the Zedboard.
 +  - Next, complete the [[Tera Term Tutorial]].
 +  - Complete the exercise below on both RIMS and the Zedboard. For the Zedboard, use the slide switches (SW0 - SW7) for the inputs A0 - A7 and use LD0 as the B0 output. Start with the code below by pasting it into a helloworld.c file (just generate a new Hello World project as you did in the tutorial and overwrite the contents of that file with the code below). Experiment with the code to see what it does and then modify the code so that it implements the functionality described in the exercise below. Experiment with the XGpio_DiscreteRead() and XGpio_DiscreteWrite() functions. Also, see if you can find the code for these functions in the board support package generated for your project.
 +  - **Exercise 1**: //Write C code that sets B0 to 1 only if A0-A3 are all 1s or if A4-A7 are all 1s (or if both situations are true). Using border and sample input value combinations,​ test the written code with RIMS, and generate a timing diagram showing the test results. Also complete this exercise on the ZED board but don't worry about the test vectors for the ZED-board version. //
 +
 +<​code>​
 +#include <​stdio.h>​
 +#include "​platform.h"​
 +#include "​xgpio.h"​
 +
 +XGpio Switches;
 +XGpio LEDs;
 +
 +int main()
 +{
 + init_platform();​
 +
 + int xStatus;
 + //​~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + //Step-1 :AXI GPIO Initialization
 + //​~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + xStatus = XGpio_Initialize(&​Switches,​XPAR_SWS_8BITS_DEVICE_ID);​
 + if(XST_SUCCESS != xStatus)
 + print("​GPIO INIT FAILED\n\r"​);​
 + xStatus = XGpio_Initialize(&​LEDs,​XPAR_LEDS_8BITS_DEVICE_ID);​
 + if(XST_SUCCESS != xStatus)
 + print("​GPIO INIT FAILED\n\r"​);​
 + //​~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + //Step-2 :AXI GPIO Set the Direction
 + //​~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + XGpio_SetDataDirection(&​Switches,​ 1, 0xFF);
 + XGpio_SetDataDirection(&​LEDs,​ 1, 0);
 +
 + while(1) {
 +
 + // This code reads the switches
 + u32 switchValue = XGpio_DiscreteRead(&​Switches,​ 1);
 + xil_printf("​%x ", switchValue);​
 +
 + // This code writes the switch value to the LEDs.
 + u32 ledValue = switchValue;​
 + XGpio_DiscreteWrite(&​LEDs,​ 1, ledValue);
 + }
 +
 + return 0;
 +}
 +</​code>​
 +
 +===== Grading =====
 +
 +When you get Exercise 1 working on RIMS and the Zedboard show the TA to get passed off. You will need to turn in the things below so your other work in RIMS can be graded.
 +
 +Print out and turn in the code you wrote for Exercise 1.3.2 which says:
 +
 +> Try: Write a C program for RIM that sets B0=1 whenever the numbers of 1s on A2, A1, and A0 is two or more (i.e., when A2A1A0 are 011, 110, 101, or 111). Hint: Use logical OR (||). Run the program in RIMS to test the program.
 +
 +Also print out and turn in the JPEG waveform created in Exercise 1.5.1 which says:
 +
 +> Save, compile, and run the below program. Click the input switches to achieve the following values: A1A0=00, then 01, then 00, then 10, then 00, then 01, then 11, then 00. Press "​Break",​ then press the "​Generate/​View Timing Diagram"​ button, causing a timing diagram window to appear, and observe how the timing diagram corresponds to the output values you observed just prior (and should closely match the above RITS figure). Press RITS' "Save JPEG" button to save the timing diagram to a JPEG file. Open the saved JPEG file using a picture viewing tool (not included with the RI tools). Finally, back on RIMS, press the "​Terminate"​ button.
 +
 +In addition, write up and hand in feedback for this lab. We'll ask you to turn in some feedback for every lab, with a few extra questions on this first lab to help us improve the course. You shouldn'​t need to spend too much time on these feedback questions.
 +  * What is your major?
 +  * Have you taken CS 235, 236, or 240?
 +  * What days and times do you typically see yourself using the lab for this class?
 +  * How many hours did this lab take you to complete?
 +  * What were the biggest bugs/​challenges you ran into, and how did you fix them?
 +  * Were there any aspects of the lab specs that were confusing or ambiguous?
old_lab_1.txt ยท Last modified: 2014/09/01 16:42 by hutch