Description
Q1
Write a c program which reads in a text file and finds all the identifiers in the
file. An identifier is a token (sequence of characters) that starts with an
underscore or a letter and continues with underscores or letters or digits.
You are to sort all the identifiers in the input text file and output them in
alphabetical order.
Q2
Create a model for the traffic light simulation and state machine that is detailed
in section 10.4 of the traffic-light-simulator.pdf also here
http://users.ece.utexas.edu/~valvano/Volume1/E-Book/
C10_FiniteStateMachines.htm
This model is a c program that runs on your laptop in Linux. You can use the
code in traffic-model.c. You can then emulate a button press by simple key
presses on the keyboard. For example:-
a) enter the letter N to indicate that the North button is on.
b) enter the letter E to indicate that the East button is on.
c) enter the letter B to indicate that both buttons are on.
d) any other key to indicate that both buttons are off
Q3
Using your code in Q2 build a traffic light controller model and simulation that is
cross compiled for an ARM based SOC.
You can use the qemu-system-arm emulator
https://wiki.qemu.org/Documentation/Platforms/ARM.
1 | P a g e
See here for steps to build a binary for the qemu emulated versatilepb board.
https://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-usingqemu/
See emulating-arm-pl011-serial-ports.pdf for an example which emulates the
serial communications to the qemu emulated versatilepb board.
2 | P a g e