Lab 5: Usage of semaphores

Contents

Contents. 2

Setup. 2

Description

Results required to complete the exercise. 2

Change history. 2

Setup

For this lab, you will need a Xilinx Zybo Z7-20 FPGA Board and a USB cable. Connect the USB cable to the PC and the Zybo Z7-20 board to connector PROG/UART. With this cable, the programming of the FPGA will be done, as well as serial communication between the board and PC.

Description

Basing on the hardware and operating system from the previous lab, write the software using semaphores in multi-threaded system. Provide demonstration of the operation. For example: start 4 threads, denoted as 0 to 3. Each thread should continuously check the single switch from SW0...SW3 connected to the thread, (i.e. for each i: thread i checks the switch SWi). When the switch is turned on, the thread starts its main operation, when the switch is turned off, the thread stops. Additional condition for running the thread i is that thread i-1 must be already running (does not apply to thread i=0, which is controlled only by the switch SW0). The operation of the thread must be indicated by the appropriate message on the terminal. To use switches, you need to add GPIO to your system in Vivado and connect them using Connection Automation to the sws_4bits.

For remote realization of the lab: emulate the hardware switches SW0-SW3 using serial port, putty and the PC keyboard.

Results required to complete the exercise

Present the operation of your software and prove that is working.

Change history

Adaptation to version Vivado 2018.3: M. Wójcikowski (08/2020).